+ All Categories
Transcript

Java Library MigrationCustom Tailored for embedded systems.

JT Perry

People in the Project

University of Nebraska at Omaha (UNO)

– Faculty Harvey Siy Victor Winter

– Students Az Mametjanov James T. Perry Satish Srinivasan

Sandia National Laboratories (SNL)– Providing the Grant– People Involved

Ben Farkas Jim McCoy Dom Montoya Steve Morrison Greg Wickstrom

The Need for Library Migration

Tiny embedded systems may need to save memory and cannot hold full Libraries.

Some embedded systems may have restricted functionality.– These systems may then be unable to handle the

code in the Libraries. (such as floating point numbers)

LIBRARIESJAVA

??? ?X = (int) 10.5;

How should libraries be edited?

1. Must remove all unsupported code.

2. While remaining syntactically correct.

3. And also, it must keep maximum functionality.

Concept of correct editing. (Example: remove “float”)

1. Must remove all unsupported code.

2. While remaining syntactically correct.

3. And also, it must keep maximum functionality.

Transforming Java ClassesWith automation

There are many steps to automate such processes.

One such tool is the class parser included with Sun’s compiler “javap.”

How do I start using javap?

First you must compile the java file using javac– Example:

Compiling will generate a class file of the java file.– Shown:

Now you are able to run javap on the class name.– Example:

What does javap produce?

With no options, javap simply shows the fields and methods in the class.

Without options, we do not have a clear view of the class, which is we use the -verbose option.

Javap -verbose Cafe

Constant pool

Fields and Methods (with bytecodes)

Bellow are snapshots from using javap.

Example of javap

This walk-through will be done with the java file shown on the right:

After Compiling… “javap TinyCafe”produces:

Example:“javap -verbose TinyCafe”

Constant pool: We can now see how java labels methods and fields.

Example, continued:“javap -verbose TinyCafe”

Constant pool:

This applies to all the methods and fields in the Constant pool.

Thus, all the information is stored in the comment

Walk-through of Transformation- Using class “TransformCafe.java”

Walk-through of Transformation- Using class “TransformCafe.java”

Other issues….Constructor methods can be tricky.

“javap -verbose FunkyCafe.java”

Other issues….Constructor methods can be tricky.

“javap -verbose FunkyCafe.java”

We see that this line is NOT within the body

(between first and last line)

Thus, the method is NOT dependent on this float.

Other issues….Constructor methods can be tricky.

“javap -verbose FunkyCafe2.java”

Huge Difference… same bytecodesConstructor methods can be tricky.

“javap –verbose” on FunkyCafe3.java & FunkyCafe4.java

Impossible to tell?

SOLUTION:

Pretty Print File

To Remove

Confusion!

IT’S THE SAME!

Other Questions?


Top Related