200 likes | 310 Views
Java Library Migration Custom 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
E N D
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) JAVA LIBRARIES X = (int) 10.5;
How should libraries be edited? • Must remove all unsupported code. • While remaining syntactically correct. • And also, it must keep maximum functionality.
Concept of correct editing. (Example: remove “float”) • Must remove all unsupported code. • While remaining syntactically correct. • 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 • Bellow are snapshots from using javap. Fields and Methods (with bytecodes) Constant pool
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: • Thus, all the information is stored in the comment • This applies to all the methods and fields in the Constant pool.
Walk-through of Transformation- Using class “TransformCafe.java”
Walk-through of Transformation- Using class “TransformCafe.java”
The float is not here! Other issues….Constructor methods can be tricky. • “javap -verbose FunkyCafe.java” It's here! Look! Check Table
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 FunkyCafe.java”
Other issues….Constructor methods can be tricky. • “javap -verbose FunkyCafe2.java”
Impossible to tell? Huge Difference… same bytecodesConstructor methods can be tricky. • “javap –verbose” on FunkyCafe3.java & FunkyCafe4.java SOLUTION: Pretty Print File To Remove Confusion! IT’S THE SAME!