The Java Legacy Interface

23
The Java Legacy Interface Stephan Korsholm Centre for Embedded Software Systems (CISS) Aalborg University Denmark

description

The Java Legacy Interface. Stephan Korsholm Centre for Embedded Software Systems (CISS) Aalborg University Denmark. Background. Ph. D. work. 1-17. Introducing Java to a C/Assembler legacy platform. KIRK DECT handsets. KIRK generic wireless control module. 16 bit. 512 Kb. 16 Mhz. - PowerPoint PPT Presentation

Transcript of The Java Legacy Interface

Page 1: The Java Legacy Interface

The Java Legacy Interface

Stephan KorsholmCentre for Embedded Software Systems (CISS)

Aalborg University Denmark

Page 2: The Java Legacy Interface

Ph. D. work

Background

1-17

Page 3: The Java Legacy Interface

Introducing Java to a C/Assembler legacy platform

Java for GUIs Java for end user customization

KIRK DECT handsets KIRK generic wirelesscontrol module.

16 bit

512 Kb

16 Mhz

2-17

Page 4: The Java Legacy Interface

Introducing Java to a C/Assembler legacy platform

Legacy code is very important,

• Represents decades of software development.

• Is the ”golden egg” of the company.

• But, legacy code is in general, ”Untouchable” code. Written by engineers without proper SW development skills. Hard to maintain, hard to refactor. A burden that will never go away.

3-17

Page 5: The Java Legacy Interface

Introducing Java to a C/Assembler legacy platform

Legacy code is very important,

• Represents decades of software development.

• Is the ”golden egg” of the company.

• But, legacy code is in general, ”Untouchable” code. Written by engineers without proper SW development skills. Hard to maintain, hard to refactor. A burden that will never go away.

How can Java be introduced into such a setting?

They need HELP!

3-17

Page 6: The Java Legacy Interface

Introducing Java to a C/Assembler legacy platform

• The KIRK legacy software architecture.

• Scheduling a JVM using the legacy scheduler.

• Java/C Communication using the legacy message exchange protocol.

• Code samples.

• Looking ahead….

Overview,

4-17

Page 7: The Java Legacy Interface

The KIRK legacy software architecture

Application

DECT protocol

MAC Layer

Layered architecture

5-17

Page 8: The Java Legacy Interface

The KIRK legacy software architecture

Application

DECT protocol

MAC Layer

Layered architecture

Event dispatcher

Event handlers

Events

getEvent

putEvent

HW

5-17

Page 9: The Java Legacy Interface

Scheduling the JVM

Integrate from the legacy architecture(JNI unfortunately not an option).

Schedule the JVM in an event driven system.

Run the JVM as a short lived event handler.

6-17

Page 10: The Java Legacy Interface

Scheduling the JVM

Event dispatcher

Event handlers

EventsJLI function,

JLI_runVM(int timeout)

Executes bytecodes a certainamount of time.

Suspends the VM.

Queues an event to be handledby the VM event handler.

Returns to the scheduler. VM event handler

7-17

Page 11: The Java Legacy Interface

Implementing JLI_runVM(int timeout)

• Divide the execution into smaller units.• Eliminate recursion and long loops.• E.g. change the interpreter loop.• Enable suspend/resume of interpreter loop.

Slice the JVM,

Slicing an existing JVM (SimpleRTJ VM),

• Analyzed program dependency graph.• Refactored JVM source code.• Introduced slicing points into the code.

8-17

Page 12: The Java Legacy Interface

Scheduling the JVM

Event dispatcher

Event handlers

EventsLegacy Events

JVM Events

Handling of legacy code and Java code is intermixed.

Selfregulating prioritization of Java code.

Legacy code unaware and unaffected of Java code.

Seamless integration.

9-17

Page 13: The Java Legacy Interface

Communication

10-17

Page 14: The Java Legacy Interface

Communication

• Support queueing events to Java from legacy code.

• Support queueing events to legacy code from Java.

Event handlers communicate by sending events to each other,

The KIRK Java API adds functionality for subscribing to events in Java

• Steal events and handle them in Java.

• Change events and send them on.

• Look at events and send them on unchanged.

10-17

Page 15: The Java Legacy Interface

Communication

Event dispatcher

Event handlers

EventsJLI function,

void JLI_subscribe(int event) int JLI_available(int event) void JLI_getData(byte[] data) void JLI_setFate(bool fate)

Java handler

subscribe

available?

getData

setFate

11-17

Page 16: The Java Legacy Interface

Communication

12-17

Page 17: The Java Legacy Interface

Possibilities – GUI customization

KIRK Dect Handsets

Subscribe to GUI events (e.g. key press).

Implement different handling of selected events.

Manipulate GUI by sending new events.

Adding new behaviour to basic firmware.

Increasing end user experience.

Sell add-on Java applications.

13-17

Page 18: The Java Legacy Interface

Possibilities – Core software development

100%

0%

Java Legacy

Today

14-17

Page 19: The Java Legacy Interface

Possibilities – Core software development

100%

0%

Java Legacy

100%

0%

Java Legacy

Incrementel (baby steps) porting of legacy code into Java

Today Tomorrow

14-17

Page 20: The Java Legacy Interface

Looking ahead....

• Event driven programming vs. other types of paradigms.

• VM slicing – effect on real-time behaviour?

• WCET of JLI_runVM? Give proper value of timeout parameter.

• Integrating legacy code with, JIT compiled Java. AOT compiled Java.

15-17

Page 21: The Java Legacy Interface

Summing up.

• Given initial specification of JLI (Java Legacy Interface), Focused on event driven embedded legacy platforms.

• Implemented JLI in a interpreter, Implemented VM slicing. Implemented Java/legacy message exchange.

• Implemented the KIRK API, Supports handling events in Java. Supports implementing selected functionality in Java. Supports incremental transition from legacy code (C) to Java.

16-17

Page 22: The Java Legacy Interface

What has been gained?

17-17

• The ability to run Java components. Yes.

• Fine grained customization of application behaviour using Java. Yes.

• The option of incrementally porting legacy code into Java. Yes.

On event driven legacy platforms we have gained,

• Real-time? No! Certainly not (slicing has an impact on a real-time profile).

• Efficiency? No! Certainly not (currently we only support interpretation).

Page 23: The Java Legacy Interface

Your Comments?

17-17