superinstructions and replication in the cacao jvm
play

Superinstructions and Replication in the Cacao JVM interpreter M. - PowerPoint PPT Presentation

Superinstructions and Replication in the Cacao JVM interpreter M. Anton Ertl Christian Thalinger Andreas Krall TU Wien Why interpreters? Execution Time Architecture Mono Cacao 1000 Alpha interp. JIT AMD64 JIT JIT ARM JIT JIT


  1. Superinstructions and Replication in the Cacao JVM interpreter M. Anton Ertl Christian Thalinger Andreas Krall TU Wien

  2. Why interpreters? Execution Time Architecture Mono Cacao 1000 Alpha interp. JIT AMD64 JIT JIT ARM JIT JIT Interpreters HP-PA interp. IA32 JIT JIT 100 IA64 JIT MIPS JIT MIPS64 JIT PowerPC JIT JIT 10 PowerPC64 interp. s390 JIT s390x JIT JITs SPARC 1 SPARC64 0.1 1 10 100 1000 Porting/Retargetting Effort (d)

  3. Threaded Code VM Code VM instruction routines imul Machine code for imul iadd Dispatch next instruction iadd Machine code for iadd ... Dispatch next instruction

  4. Dynamic Superinstructions data segment data segment code segment dyn. superinst code threaded VM Code VM routine template iload Machine code for isub b Machine code for iload Dispatch next iload Machine code for iload Machine code for iload c Machine code for isub Dispatch next isub Machine code for istore Machine code for istore istore ... Dispatch next a Dispatch next ...

  5. Replication No Replication Replication iload iload b b Machine code for iload Machine code for iload iload iload Machine code for iload Machine code for iload c c Machine code for isub Machine code for isub isub isub Machine code for istore Machine code for istore istore istore ... ... a a Dispatch next Dispatch next ... ... iload iload e e Machine code for iload iload iload Machine code for iload f f Machine code for isub isub isub Machine code for istore istore istore ... d d Dispatch next ... ... + Increases BTB prediction accuracy + Simpler − Increases code size

  6. JVM and .NET problems • Quickening • Potential exception-throwing instructions • How much benefit?

  7. Quickable Instructions ACONST INVOKESPECIAL ARRAYCHECKCAST INVOKESTATIC CHECKCAST INVOKEVIRTUAL GETFIELD CELL MULTIANEWARRAY GETFIELD INT NATIVECALL GETFIELD LONG PUTFIELD CELL GETSTATIC CELL PUTFIELD INT GETSTATIC INT PUTFIELD LONG GETSTATIC LONG PUTSTATIC CELL INSTANCEOF PUTSTATIC INT INVOKEINTERFACE PUTSTATIC LONG

  8. Simple Solution data segment data segment code segment dyn. superinst code threaded VM Code VM routine template iload Machine code for iload b Machine code for iload Dispatch next getfield_quick Dispatch next Machine code for istore Example.i Machine code for istore Dispatch next offset ... Machine code for getfield istore Dispatch next Dispatch next a Machine code for getfield_quick ... Dispatch next before executing getfield after executing getfield

  9. SableVM’s Sophisticated Solution data segment data segment code segment dyn. superinst code threaded VM Code VM routine template super|goto Machine code for skip_operand prepseq Machine code for iload iload Machine code for getfield_quick b Machine code for iload getfield_quick Machine code for istore Dispatch next offset ... Machine code for istore istore Dispatch next Dispatch next a Machine code for getfield ... Dispatch next Machine code for getfield_quick iload Dispatch next b getfield Machine code for goto Dispatch next Example.i op-ptr Machine code for replace replace Dispatch next super inst-ptr istore a ... goto behind before executing prepseq unused slot after executing prepseq

  10. Cacao’s Sophisticated Solution data segment data segment code segment dyn. superinst code threaded VM Code VM routine template super|iload Machine code for iload b Machine code for iload Dispatch next getfield Machine code for getfield_quick Machine code for istore Example.i Machine code for istore Dispatch next offset ... Machine code for getfield istore Dispatch next Dispatch next a Machine code for getfield_quick ... Dispatch next last quickable inst threaded code start real-machine code superstart table before executing getfield after executing getfield

  11. Potential Exception-Throwing Instructions IALOAD GETFIELD CELL LALOAD GETFIELD INT AALOAD GETFIELD LONG BALOAD PUTFIELD CELL CALOAD PUTFIELD INT SALOAD PUTFIELD LONG IASTORE INVOKEVIRTUAL LASTORE INVOKESPECIAL BASTORE INVOKEINTERFACE CASTORE ARRAYLENGTH IDIV CHECKNULL IREM

  12. Problem and Solution getfield_cell: getfield_cell: mov (%edi),%eax mov (%edi),%eax add $0x8,%edi add $0x8,%edi test %ebp,%ebp test %ebp,%ebp je throw jne no_throw jmp *0x2a0(%esp) no_throw: add $0x4,%edi add $0x4,%edi mov (%eax,%ebp,1),%ebp mov (%eax,%ebp,1),%ebp jmp *-4(%edi) jmp *-4(%edi)

  13. Speedup over plain threaded code plain threaded code Pentium 4 -throw simple -repl -throw soph -repl -throw simple +repl -throw soph +repl speedup +throw simple -repl +throw soph -repl +throw simple +repl +throw soph +repl 4 2.8 2 1.4 1.0 compress jess db javac mpegaudio mtrt jack

  14. Speedup of various JVMs over Cacao with Superinstructions Kaffe int JamVM gij HotSpot int J9 int SableVM cacao threaded cacao +throw soph +repl cacao jit HotSpot mixed J9 mixed Jikes RVM jrockit kaffe jit speedup Pentium 4 10 5 2 1.0 0.5 0.2 0.1 0.05 0.02 compress jess db javac mpegaudio mtrt jack

  15. Conclusion • Superinstructions can provide big speedups • Replication has little impact • Quickening: New sophisticated solution but simple solution performs well in JIT setting • Relocatability of throwing VM instructions: Big performance impact Solution: replace relative with indirect jumps

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend