The Java Legacy Interface
description
Transcript of The Java Legacy Interface
The Java Legacy Interface
Stephan KorsholmCentre for Embedded Software Systems (CISS)
Aalborg University Denmark
Ph. D. work
Background
1-17
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
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
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
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
The KIRK legacy software architecture
Application
DECT protocol
MAC Layer
Layered architecture
5-17
The KIRK legacy software architecture
Application
DECT protocol
MAC Layer
Layered architecture
Event dispatcher
Event handlers
Events
getEvent
putEvent
HW
5-17
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
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
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
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
Communication
10-17
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
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
Communication
12-17
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
Possibilities – Core software development
100%
0%
Java Legacy
Today
14-17
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
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
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
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).
Your Comments?
17-17