Presentation is loading. Please wait.

Presentation is loading. Please wait.

© 2007 IBM Corporation IBM Software Group September 26, 2007 Tactics for Minimal Interference from Class Loading in Real-Time Java™ The 5th International.

Similar presentations


Presentation on theme: "© 2007 IBM Corporation IBM Software Group September 26, 2007 Tactics for Minimal Interference from Class Loading in Real-Time Java™ The 5th International."— Presentation transcript:

1 © 2007 IBM Corporation IBM Software Group September 26, 2007 Tactics for Minimal Interference from Class Loading in Real-Time Java™ The 5th International Workshop on Java Technologies for Real-time and Embedded Systems - JTRES 2007 Institute of Computer Engineering Vienna University of Technology Vienna, Austria Sean Foley, IBM Software Group, Ottawa, Canada Sean_Foley@ca.ibm.com 613-726-5516

2 IBM Software Group Tactics for Minimal Interference from Class Loading in Real-Time Java | JTRES 2007 © 2007 IBM Corporation 2 Agenda  Motivations for altering class loading behaviour in Real-Time Java  Tactics, experiences, results : –Reducing the size and number of classes to load –Elimination of premature loading –Redistribution of loading –Elimination of repeated loading –Alternative class formats  Requirements for Implementation of Techniques

3 IBM Software Group Tactics for Minimal Interference from Class Loading in Real-Time Java | JTRES 2007 © 2007 IBM Corporation 3 Loading Takes Time

4 IBM Software Group Tactics for Minimal Interference from Class Loading in Real-Time Java | JTRES 2007 © 2007 IBM Corporation 4 Motivations and Rationale  Class Loading Impacts Real-Time Requirements  Simplest approach: load everything at startup –Can be optimized –Not necessarily easy (code paths, development) –Can be excessive (memory/time), particularly for large apps. –Not all classes needed for each invocation  Startup time possibly subject to timing constraints  Alternative approaches beneficial for optimal usage of resources

5 IBM Software Group Tactics for Minimal Interference from Class Loading in Real-Time Java | JTRES 2007 © 2007 IBM Corporation 5 Instantiated Type Analysis (ITA) determines what methods and classes can be removed ITA instantiates objects for more accurate analysis to determine reachable items Basic control flow analysis follows all references with the code

6 IBM Software Group Tactics for Minimal Interference from Class Loading in Real-Time Java | JTRES 2007 © 2007 IBM Corporation 6 Advanced Control Flow Analysis ITA control flow analysis involves exception object throwing and virtual method invocations

7 IBM Software Group Tactics for Minimal Interference from Class Loading in Real-Time Java | JTRES 2007 © 2007 IBM Corporation 7 Elimination of loading Induced by Verification  Runtime bytecode verifier loads classes to verify inheritance.  Can be avoided by inserting checkcast bytecodes. OperationVerifier requirement Non-static field access or method invocationReceiver must be subtype of declaring class of field/method Field storeStored object must be subtype of field type Method invocationArguments must be subtypes of parameters Return instructionReturned object must be subtype of return type Throw instruction or exception handlerThrown or caught object must be Throwable Example: static BaseClass aMethod(SubClass subClass) { if(subClass == null) throw new NullPointerException(); return subClass; } Bytecodes: aload_0 aconst_null ifnull new invokespecial checkcast athrow aload_0 checkcast areturn (Throwable) (BaseClass)

8 IBM Software Group Tactics for Minimal Interference from Class Loading in Real-Time Java | JTRES 2007 © 2007 IBM Corporation 8 Cold Method Refactoring: Distributed Loading Refactoring steps: 1.Identify a method to be migrated 2.Create a counterpart static method in a shell class 3.Migrate the body of the original method 4.Replace the method body with an invocation of the counterpart Result:  Bytecode verification of the original method is delayed  Loading time of original class is split The most expensive stage of loading is bytecode verification.

9 IBM Software Group Tactics for Minimal Interference from Class Loading in Real-Time Java | JTRES 2007 © 2007 IBM Corporation 9 Persistent Class Sharing  Class representations shared amongst VMs: concurrently, sequentially  Cache can exist in shared memory or on file system  Share: classes, strings, compiled code  Not everything shareable: constraints from verifier, advanced optimizations  Multiple shared caches more flexible IBM LS20 Blade Server / real-time linux / IBM Java5 VM

10 IBM Software Group Tactics for Minimal Interference from Class Loading in Real-Time Java | JTRES 2007 © 2007 IBM Corporation 10 Alternative File Formats  Load precompiled native code (AOT or ahead-of-time)  With IBM’s WebSphere Real-Time, the steps are:  Other class file formats have been designed  The class file format specification itself allows the delivery of additional data Jar files Compile AOT Bound jar files Real-time execution Other jar files Compile Java Source files Run

11 IBM Software Group Tactics for Minimal Interference from Class Loading in Real-Time Java | JTRES 2007 © 2007 IBM Corporation 11 Summary  Class Loading can Interference with Real-Time Constraints  Tactics to alter loading: –Reducing the size and number of classes to load –Elimination of premature loading –Temporal redistribution of loading –Elimination of repeated loading –Alternative methods of loading  Implementation require analysis, tuning, building, some insight into the app  Tools and resources are available for implementation


Download ppt "© 2007 IBM Corporation IBM Software Group September 26, 2007 Tactics for Minimal Interference from Class Loading in Real-Time Java™ The 5th International."

Similar presentations


Ads by Google