90 likes | 310 Views
Mohamed. M. Saad. Hydra VM: Extracting Parallelization From Legacy Code Using STM . Hydra VM. Java Virtual Machine Prototype based on Jikes RVM Targets Code profiling/visualization using execution flow Utilize large number of cores through possible parallel portions of code. Jikes RVM.
E N D
Mohamed. M. Saad Hydra VM: Extracting Parallelization From Legacy Code Using STM
Hydra VM • Java Virtual Machine Prototype based on Jikes RVM • Targets • Code profiling/visualization using execution flow • Utilize large number of cores through possible parallel portions of code
Jikes RVM • Adaptive Online System • Compiler • Baseline Complier • JIT Compiler
The Basic Idea … • Insert TM_start& TM_endat every independent possible path • Lazy commit (write-buffer) • Contention Resolution based on • Program Order • Execution Frequency
Execution Tracking Tool • Modifying the Baseline Compiler • TemplateCompilerFramework class • Converting Java Bytecode into Machine language (Assembly) genCode(){ ….. switch(opcode){ case <instruction bytecode>: emmit_<instruction>: } } • Plugin some code to profile block start event • Profiling execution using GraphViz script
Example 0: iconst_0 1: istore_1 2: iconst_0 3: istore_2 4: goto 29 7: invokestatic #13; 10: ldc2_w #19; 13: dcmpl 14: ifle 23 17: iinc 1, 1 20: goto 26 23: iinc 1, -1 26: iinc 2, 1 29: iload_2 30: bipush 12 32: if_icmplt 7 35: return 0: iconst_0 1: istore_1 2: iconst_0 3: istore_2 4: goto 29 7: invokestatic #13; 10: ldc2_w #19; 13: dcmpl 14: ifle 23 17: iinc 1, 1 20: goto 26 23: iinc 1, -1 26: iinc 2, 1 29: iload_2 30: bipush 12 32: if_icmplt 7 35: return int counter = 0; for(inti=0; i<2; i++) if(Math.random()>0.3) counter++; else counter--;
Example public class Test{ public static void foo(){int counter = 0; for(inti=0; i<12; i++) if(Math.random()>0.3) counter++; else counter--; } public static void zoo(){System.out.println("hi"); } public static void main(String[] args){inti=6; if(i<10)foo(); else zoo(); }}
Milestones • Building execution flow tracking system • Split the code to basic blocks • Collect execution patterns • Visualizing execution • Parallelizing the execution of the code using different threads • Dependency analysis • Branch prediction • Packaging & grouping blocks (superblock) • Preserving program order and data consistency using STM • Checkpointing • Closed nesting in loop parallelization