1 / 36

Jikes RVM and Java Operating Systems

The UK Memory Management Network Workshop, November 9 th 2006 Dr. Ian Rogers, Research Fellow, The University of Manchester ian.rogers@manchester.ac.uk. Jikes RVM and Java Operating Systems. Presentation Outline. A bit about the Jikes RVM A view of a Jikes RVM Operating System

orenda
Download Presentation

Jikes RVM and Java Operating Systems

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. The UK Memory Management Network Workshop, November 9th 2006 Dr. Ian Rogers, Research Fellow, The University of Manchester ian.rogers@manchester.ac.uk Jikes RVM and Java Operating Systems

  2. Presentation Outline • A bit about the Jikes RVM • A view of a Jikes RVM Operating System • Some early results • Other work: • Parallelization • Adaptive parallelization optimization • Potpourri

  3. The Jikes RVM • Overview of the adaptive compilation system:

  4. The baseline compiler • Used to compile code the first time it’s invoked • Very simple code generation: Load t0, [locals + 0] Store [stack+0], t0 Load t0, [locals + 4] Store [stack+4], t0 Load t0, [stack+0] Load t1, [stack+4] Add t0, t0, t1 Store [stack+0], t0 Load t0, [stack+0] Store [locals + 0], t0 • iload_0 • iload_1 • iadd • istore_0

  5. The baseline compiler • Pros: • Easy to port – just write emit code for each bytecode • Minimal work needed to port runtime and garbage collector • Fast compilation speed • Cons: • Low performance

  6. The boot image • Hijack the view of memory (mapping of objects to addresses) • Compile list of primordial classes • Write view of memory to disk (the boot image) • The boot image runner loads the disk image and branches into the code block for VM.boot

  7. The boot image • Problems: • Difference of views between: • Jikes RVM • Classpath • Bootstrap JVM • Fix by writing null to some fields (new oracle feature appearing in post 2.4.6 Jikes RVM) • Jikes RVM runtime needs to keep pace with Classpath

  8. The runtime • M-of-N threading • Thread yields are GC points • Native code can deadlock the VM • JNI written in Java with knowledge of C layout • Classpath interface written in Java

  9. The Jikes RVM • Overview of the adaptive compilation system: • Methods recompiled based on their predicted future execution time and the time taken to compile • Some optimisation levels are skipped

  10. The optimizing compiler • Structured from compiler phases based on HIR, LIR and MIR phases from Muchnick • IR object holds instructions in linked lists in a control flow graph • Instructions are an object with: • One operator • Variable number of use operands • Variable number of def operands • Support for def/use operands • Some operands and operators are virtual

  11. The optimizing compiler • HIR: • Infinite registers • Operators correspond to bytecodes • SSA phase performed • LIR: • Load/store operators • Java specific operators expanded • GC barrier operators • SSA phase performed • MIR: • Fixed number of registers • Machine operators

  12. The optimizing compiler • Factored control graph: • Don’t terminate blocks on Potentially Exceptioning Instructions (PEIs) • Bound check • Null check • Checks define guards which are used by: • Putfield, getfield, array load/store, invokevirtual • Eliminating guards requires propagation of use

  13. The optimizing compiler • Java – can we capture and benefit from strong type information? • Extended Array SSA: • Single assignment • Array – Fortran style - a float and an int array can’t alias • Extended – different fields and different objects can’t alias • Phi operator – for registers, heaps and exceptions • Pi operator – define points where knowledge of a variable is exposed. E.g. A = new int[100], later uses of A can know the array length is 100 (ABCD)

  14. The optimizing compiler • HIR: Simplification, tail recursion elimination, estimate execution frequencies, loop unrolling, branch optimizations, (simple) escape analysis, local copy and constant propagation, local common sub-expression elimination • SSA in HIR: load/store elimination, redundant branch elimination, global constant propagation, loop versioning • AOS framework

  15. The optimizing compiler • LIR: Simplification, estimate execution frequencies, basic block reordering, branch optimizations, (simple) escape analysis, local copy and constant propagation, local common sub-expression elimination • SSA in LIR: global code placement, live range splitting • AOS framework

  16. The optimizing compiler • MIR: instruction selection, register allocation, scheduling, simplification, branch optimizations • Fix-ups for runtime

  17. Speculative Optimisations • Often in a JVM there’s potentially not a complete picture, in particular for dynamic class loading • On-stack replacement allows optimisation to proceed with a get out clause • On-stack replacement is a virtual Jikes RVM instruction

  18. Applications of on-stack replacement • Safe invalidation for speculative optimisation • Class hierarchy-based inlining • Deferred compilation • Don’t compile uncommon cases • Improve dataflow optimization and improve compile time • Debug optimised code via dynamic deoptimisaton • At break-point, deoptimize activation to recover program state • Runtime optimization of long-running activities • Promote long-running loops to higher optimisation levels

  19. Operating Systems • Overview of our work

  20. Work done • Addition of Java 1.5 features to the Jikes RVM • Support in the Jikes RVM for isolation • Made the Jikes RVM and JNode runtimes compatible

  21. Early Performance Results

  22. Early Performance Results

  23. PearColator

  24. PearColator

  25. PearColator • Decoder: • Disassembler • Interpreter (Java threaded) • Translator • Generic components: • Loaders • System calls • Memory

  26. Other work • Loop parallelization: • Using extended array SSA form we have a lot of dependence information already • Loop parallelization requires analysis of loops and loop carried dependencies • Currently parallelize loops with scalars and arrays with affine indices • Fine grain threads not suited to current architectures

  27. Loop Parallelization in JaVM(Jikes RVM for JAMAICA)

  28. Fine grain threads slow things down on x86

  29. But with lightweight hardware threads…

  30. Adaptive parallelization optimisation • Adapt code by: • Recompilation • Modifying parameters • Amount of work created • Switching policies • Constant number of threads vs. recursive thread distribution

  31. Speed up over parallelization by adaptation

  32. Speed up over parallelization by adaptation

  33. Speed up over parallelization by adaptation

  34. Speed up over parallelization by adaptation

  35. Potpourri • Multithreaded compilation for the Jikes RVM • Interpreter within the Jikes RVM (written in Java) • Debugger (JDWP), Eclipsification and other enhancements

  36. Thanks! • Any questions? • Find out more at: • http://www.cs.manchester.ac.uk/apt/projects/jamaica • http://jikesrvm.sourceforge.net/

More Related