InvokeDynamic: Your API for HotSpot

4131d2f57a0db2a2b4d9a62bd389fd44?s=47 tarcieri
October 11, 2012

InvokeDynamic: Your API for HotSpot

4131d2f57a0db2a2b4d9a62bd389fd44?s=128

tarcieri

October 11, 2012
Tweet

Transcript

  1. InvokeDynamic Your API for HotSpot Tony Arcieri Boundary October 11th,

    2012
  2. Who am I?

  3. Who am I?

  4. Our story begins...

  5. Java was slow Once upon a time...

  6. Anamorphic

  7. Anamorphic StrongTalk

  8. •Optional static typing •Modern garbage collector •JIT compiler Anamorphic StrongTalk

  9. Anamorphic StrongTalk Sun Microsystems Java

  10. Anamorphic StrongTalk Sun Microsystems Java Stolen legacy!

  11. Anamorphic StrongTalk Sun Microsystems Java Stolen legacy!

  12. Anamorphic StrongTalk Sun Microsystems Java Stolen legacy!

  13. None
  14. HotSpot

  15. JIT

  16. Compile When Code Runs Just-In-Time Compiler

  17. JIT Spectrum

  18. JIT Spectrum Eager Lazy

  19. JIT Spectrum Eager Lazy CLR HiPE V8 HotSpot

  20. JIT Spectrum Eager Lazy CLR HiPE V8 HotSpot Static Optimizations

    Runtime Optimizations
  21. •C1: Client Compiler •C2: Server Compiler HotSpot

  22. •C1: Client Compiler •C2: Server Compiler •-XX:+TieredCompilation HotSpot

  23. Mixed Mode Profiling JIT

  24. Start by interpreting JVM “emulates” bytecodes in userspace BYTECODE

  25. Locate “hot spots” BYTECODE Using runtime profiling information

  26. Generate machine code Compile JVM bytecode to native ISA BYTECODE

    1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 after 10,000 calls
  27. •Inlining methods •Unrolling loops •Eliding locks •Eliminating dead code •Escape

    analysis Optimizations
  28. •Inlining methods •Unrolling loops •Eliding locks •Eliminating dead code •Escape

    analysis Optimizations
  29. Inlining Combine and optimize across calls Method 1 CALL Method

    2
  30. Inlining Combine and optimize across calls Method 1 Method 2

  31. Call Sites Where the magic happens... CALL

  32. Call Sites •Profile data •Monomorphic inline cache •Polymorphic inline cache

  33. “Shapes”

  34. Monomorphic Only one type seen at call site CALL A

  35. Bimorphic Two types seen at call site CALL A B

  36. Polymorphic Many types seen at call site CALL A C

    B
  37. Megamorphic Too many types seen at call site CALL A

    C B D E F G
  38. •Measure invocations and branches •Make an educated guess •Inline the

    code in question •Back out if we guessed wrong Inlining
  39. •Check invariants at a “safe point” •Did we guess wrong?

    •Revert optimization and try again Deopt
  40. JVM Limitations

  41. Made for Java •InvokeVirtual •InvokeInterface •InvokeStatic •InvokeSpecial

  42. Non-Java call sites are opaque to HotSpot Can’t be inlined

    Method 1 CALL Method 2
  43. Teach HotSpot? See through non-Java call sites Method 1 CALL

    Method 2
  44. Inline just like Java Method 1 Method 2

  45. What if it worked for any language?

  46. Even Ruby?

  47. InvokeDynamic

  48. InDy

  49. InDy •JSR-292: “Supporting Dynamically Typed Languages on the Java Platform”

    •Initial version shipped in Java 7 •Feeds directly into HotSpot in Java 8
  50. New JVM instruction

  51. java.lang.invoke

  52. InvokeDynamic

  53. InvokeDynamic

  54. InvokeDynamic

  55. “User defined data endpoint”

  56. JVM Data Endpoints •Invoke operations •Array element access •Property lookup

    •And more!
  57. InDy Use Cases •Custom invocation •“Constant” values (e.g. globals, language

    intrinsics) •Scoped values (e.g. instance variables)
  58. InDy How does it work?

  59. Pieces of InDy •Bootstrap methods •Call sites •Method handles •Switch

    points
  60. Bootstrap method

  61. Bootstrap method Wire up the call site

  62. Bootstrap method Your own code!

  63. Bootstrap Method •Called the first time each InDy call site

    is used •Find MethodHandle to dispatch •Return CallSite object
  64. Call Site Replaces InDy instruction in bytecode

  65. Call Site Holds onto a chain of MethodHandles

  66. java.lang.invoke.CallSite •ConstantCallSite: unchangeable •VolatileCallSite: seen coherently across cores •MutableCallSite: may

    appear different across cores
  67. Any of those can be subclassed

  68. java.lang.invoke.MethodHandle •Directly executable reference to a Java method (i.e. fast-as-Java)

    •Inlineable by HotSpot •MethodHandles all the way down
  69. Methods are first- class objects

  70. Project Lambda Lambdas for the JVM Coming in Java 8!

    (Summer 2013)
  71. Guarded Invocation

  72. MethodHandle.guardWithTest( ! MethodHandle test, ! MethodHandle target, ! MethodHandle fallback

    ) Guarded Invocation
  73. fallback can rebind the call site Handle new types as

    they’re seen
  74. SwitchPoints

  75. SwitchPoint.guardWithTest( ! MethodHandle target, ! MethodHandle fallback ) SwitchPoint.invalidateAll( !

    SwitchPoint[] ) SwitchPoints
  76. java.lang.invoke.SwitchPoint •Publish events across threads (e.g. blow caches when classes

    change) •Only event is valid -> invalid •Hooks directly into the HotSpot deoptimizer (no additional branches)
  77. Putting it together

  78. CallSite: where the call is taking place Invocation example

  79. CallSite: where the call is taking place SwitchPoint: did the

    class change? Invocation example
  80. CallSite: where the call is taking place SwitchPoint: did the

    class change? GuardWithTest: is this the type we bound? Invocation example
  81. CallSite: where the call is taking place SwitchPoint: did the

    class change? GuardWithTest: is this the type we bound? Target: invoke the target method Invocation example
  82. CallSite: where the call is taking place SwitchPoint: did the

    class change? GuardWithTest: is this the type we bound? Target: invoke the target method Rebind: lookup new method and rebuild call site - or - Invocation example
  83. CallSite: where the call is taking place SwitchPoint: did the

    class change? GuardWithTest: is this the type we bound? Target: invoke the target method Rebind: lookup new method and rebuild call site - or - - or - Rebind: lookup potentially changed methods Invocation example
  84. InDy in the real world

  85. Is it good? To the assembly!

  86. java -XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly Enabling ASM output

  87. def foo; 1; end def invoker; foo; end i =

    0 while i < 10000 invoker i+=1 end Contrived Ruby code
  88. 0x00000001060a1be0: mov %eax,-0x14000(%rsp) 0x00000001060a1be7: push %rbp 0x00000001060a1be8: sub $0x30,%rsp ;*synchronization

    entry ; - ruby.__dash_e__::method__1$RUBY$invoker@-1 (line 1) 0x00000001060a1bec: mov 0x8(%rcx),%r10d ; implicit exception: dispatches to 0x00000001060a1c55 0x00000001060a1bf0: cmp $0xfb7aedc9,%r10d ; {oop('org/jruby/RubyObject')} 0x00000001060a1bf7: jne 0x00000001060a1c39 0x00000001060a1bf9: mov %rcx,%r10 ;*checkcast ; - org.jruby.runtime.invokedynamic.InvocationLinker::testMetaclass@2 (line 633) ; - java.lang.invoke.MethodHandle::invokeExact@3 ; - java.lang.invoke.MethodHandle::invokeExact@5 ; - java.lang.invoke.MethodHandle::invokeExact@29 ; - ruby.__dash_e__::method__1$RUBY$invoker@3 (line 1) 0x00000001060a1bfc: mov 0x10(%r10),%ebp ;*getfield metaClass ; - org.jruby.RubyBasicObject::getMetaClass@1 (line 520) ; - org.jruby.runtime.invokedynamic.InvocationLinker::testMetaclass@5 (line 633) ; - java.lang.invoke.MethodHandle::invokeExact@3 ; - java.lang.invoke.MethodHandle::invokeExact@5 ; - java.lang.invoke.MethodHandle::invokeExact@29 ; - ruby.__dash_e__::method__1$RUBY$invoker@3 (line 1) 0x00000001060a1c00: cmp $0xfed77602,%ebp ; {oop(a 'org/jruby/MetaClass')} 0x00000001060a1c06: jne 0x00000001060a1c1e ;*if_acmpne ; - org.jruby.runtime.invokedynamic.InvocationLinker::testMetaclass@8 (line 633) ; - java.lang.invoke.MethodHandle::invokeExact@3 ; - java.lang.invoke.MethodHandle::invokeExact@5 ; - java.lang.invoke.MethodHandle::invokeExact@29 ; - ruby.__dash_e__::method__1$RUBY$invoker@3 (line 1) 0x00000001060a1c08: movabs $0x7f6bf4bb0,%rax ;*areturn ; - ruby.__dash_e__::method__0$RUBY$foo@6 (line 1) ; - java.lang.invoke.MethodHandle::invokeExact@6 ; - java.lang.invoke.MethodHandle::invokeExact@31 ; - java.lang.invoke.MethodHandle::invokeExact@29 ; - ruby.__dash_e__::method__1$RUBY$invoker@3 (line 1) ; {oop(a 'org/jruby/RubyFixnum')} 0x00000001060a1c12: add $0x30,%rsp 0x00000001060a1c16: pop %rbp 0x00000001060a1c17: test %eax,-0xec3c1d(%rip) # 0x00000001051de000 ; {poll_return} 0x00000001060a1c1d: retq
  89. 0x00000001060a1be0: mov %eax,-0x14000(%rsp) 0x00000001060a1be7: push %rbp 0x00000001060a1be8: sub $0x30,%rsp ;*synchronization

    entry ; - ruby.__dash_e__::method__1$RUBY$invoker@-1 (line 1) 0x00000001060a1bec: mov 0x8(%rcx),%r10d ; implicit exception: dispatches to 0x00000001060a1c55 0x00000001060a1bf0: cmp $0xfb7aedc9,%r10d ; {oop('org/jruby/RubyObject')} 0x00000001060a1bf7: jne 0x00000001060a1c39 0x00000001060a1bf9: mov %rcx,%r10 ;*checkcast ; - org.jruby.runtime.invokedynamic.InvocationLinker::testMetaclass@2 (line 633) ; - java.lang.invoke.MethodHandle::invokeExact@3 ; - java.lang.invoke.MethodHandle::invokeExact@5 ; - java.lang.invoke.MethodHandle::invokeExact@29 ; - ruby.__dash_e__::method__1$RUBY$invoker@3 (line 1) 0x00000001060a1bfc: mov 0x10(%r10),%ebp ;*getfield metaClass ; - org.jruby.RubyBasicObject::getMetaClass@1 (line 520) ; - org.jruby.runtime.invokedynamic.InvocationLinker::testMetaclass@5 (line 633) ; - java.lang.invoke.MethodHandle::invokeExact@3 ; - java.lang.invoke.MethodHandle::invokeExact@5 ; - java.lang.invoke.MethodHandle::invokeExact@29 ; - ruby.__dash_e__::method__1$RUBY$invoker@3 (line 1) 0x00000001060a1c00: cmp $0xfed77602,%ebp ; {oop(a 'org/jruby/MetaClass')} 0x00000001060a1c06: jne 0x00000001060a1c1e ;*if_acmpne ; - org.jruby.runtime.invokedynamic.InvocationLinker::testMetaclass@8 (line 633) ; - java.lang.invoke.MethodHandle::invokeExact@3 ; - java.lang.invoke.MethodHandle::invokeExact@5 ; - java.lang.invoke.MethodHandle::invokeExact@29 ; - ruby.__dash_e__::method__1$RUBY$invoker@3 (line 1) 0x00000001060a1c08: movabs $0x7f6bf4bb0,%rax ;*areturn ; - ruby.__dash_e__::method__0$RUBY$foo@6 (line 1) ; - java.lang.invoke.MethodHandle::invokeExact@6 ; - java.lang.invoke.MethodHandle::invokeExact@31 ; - java.lang.invoke.MethodHandle::invokeExact@29 ; - ruby.__dash_e__::method__1$RUBY$invoker@3 (line 1) ; {oop(a 'org/jruby/RubyFixnum')} 0x00000001060a1c12: add $0x30,%rsp 0x00000001060a1c16: pop %rbp 0x00000001060a1c17: test %eax,-0xec3c1d(%rip) # 0x00000001051de000 ; {poll_return} 0x00000001060a1c1d: retq Stack juggling
  90. 0x00000001060a1be0: mov %eax,-0x14000(%rsp) 0x00000001060a1be7: push %rbp 0x00000001060a1be8: sub $0x30,%rsp ;*synchronization

    entry ; - ruby.__dash_e__::method__1$RUBY$invoker@-1 (line 1) 0x00000001060a1bec: mov 0x8(%rcx),%r10d ; implicit exception: dispatches to 0x00000001060a1c55 0x00000001060a1bf0: cmp $0xfb7aedc9,%r10d ; {oop('org/jruby/RubyObject')} 0x00000001060a1bf7: jne 0x00000001060a1c39 0x00000001060a1bf9: mov %rcx,%r10 ;*checkcast ; - org.jruby.runtime.invokedynamic.InvocationLinker::testMetaclass@2 (line 633) ; - java.lang.invoke.MethodHandle::invokeExact@3 ; - java.lang.invoke.MethodHandle::invokeExact@5 ; - java.lang.invoke.MethodHandle::invokeExact@29 ; - ruby.__dash_e__::method__1$RUBY$invoker@3 (line 1) 0x00000001060a1bfc: mov 0x10(%r10),%ebp ;*getfield metaClass ; - org.jruby.RubyBasicObject::getMetaClass@1 (line 520) ; - org.jruby.runtime.invokedynamic.InvocationLinker::testMetaclass@5 (line 633) ; - java.lang.invoke.MethodHandle::invokeExact@3 ; - java.lang.invoke.MethodHandle::invokeExact@5 ; - java.lang.invoke.MethodHandle::invokeExact@29 ; - ruby.__dash_e__::method__1$RUBY$invoker@3 (line 1) 0x00000001060a1c00: cmp $0xfed77602,%ebp ; {oop(a 'org/jruby/MetaClass')} 0x00000001060a1c06: jne 0x00000001060a1c1e ;*if_acmpne ; - org.jruby.runtime.invokedynamic.InvocationLinker::testMetaclass@8 (line 633) ; - java.lang.invoke.MethodHandle::invokeExact@3 ; - java.lang.invoke.MethodHandle::invokeExact@5 ; - java.lang.invoke.MethodHandle::invokeExact@29 ; - ruby.__dash_e__::method__1$RUBY$invoker@3 (line 1) 0x00000001060a1c08: movabs $0x7f6bf4bb0,%rax ;*areturn ; - ruby.__dash_e__::method__0$RUBY$foo@6 (line 1) ; - java.lang.invoke.MethodHandle::invokeExact@6 ; - java.lang.invoke.MethodHandle::invokeExact@31 ; - java.lang.invoke.MethodHandle::invokeExact@29 ; - ruby.__dash_e__::method__1$RUBY$invoker@3 (line 1) ; {oop(a 'org/jruby/RubyFixnum')} 0x00000001060a1c12: add $0x30,%rsp 0x00000001060a1c16: pop %rbp 0x00000001060a1c17: test %eax,-0xec3c1d(%rip) # 0x00000001051de000 ; {poll_return} 0x00000001060a1c1d: retq Is “self” a Ruby object?
  91. 0x00000001060a1be0: mov %eax,-0x14000(%rsp) 0x00000001060a1be7: push %rbp 0x00000001060a1be8: sub $0x30,%rsp ;*synchronization

    entry ; - ruby.__dash_e__::method__1$RUBY$invoker@-1 (line 1) 0x00000001060a1bec: mov 0x8(%rcx),%r10d ; implicit exception: dispatches to 0x00000001060a1c55 0x00000001060a1bf0: cmp $0xfb7aedc9,%r10d ; {oop('org/jruby/RubyObject')} 0x00000001060a1bf7: jne 0x00000001060a1c39 0x00000001060a1bf9: mov %rcx,%r10 ;*checkcast ; - org.jruby.runtime.invokedynamic.InvocationLinker::testMetaclass@2 (line 633) ; - java.lang.invoke.MethodHandle::invokeExact@3 ; - java.lang.invoke.MethodHandle::invokeExact@5 ; - java.lang.invoke.MethodHandle::invokeExact@29 ; - ruby.__dash_e__::method__1$RUBY$invoker@3 (line 1) 0x00000001060a1bfc: mov 0x10(%r10),%ebp ;*getfield metaClass ; - org.jruby.RubyBasicObject::getMetaClass@1 (line 520) ; - org.jruby.runtime.invokedynamic.InvocationLinker::testMetaclass@5 (line 633) ; - java.lang.invoke.MethodHandle::invokeExact@3 ; - java.lang.invoke.MethodHandle::invokeExact@5 ; - java.lang.invoke.MethodHandle::invokeExact@29 ; - ruby.__dash_e__::method__1$RUBY$invoker@3 (line 1) 0x00000001060a1c00: cmp $0xfed77602,%ebp ; {oop(a 'org/jruby/MetaClass')} 0x00000001060a1c06: jne 0x00000001060a1c1e ;*if_acmpne ; - org.jruby.runtime.invokedynamic.InvocationLinker::testMetaclass@8 (line 633) ; - java.lang.invoke.MethodHandle::invokeExact@3 ; - java.lang.invoke.MethodHandle::invokeExact@5 ; - java.lang.invoke.MethodHandle::invokeExact@29 ; - ruby.__dash_e__::method__1$RUBY$invoker@3 (line 1) 0x00000001060a1c08: movabs $0x7f6bf4bb0,%rax ;*areturn ; - ruby.__dash_e__::method__0$RUBY$foo@6 (line 1) ; - java.lang.invoke.MethodHandle::invokeExact@6 ; - java.lang.invoke.MethodHandle::invokeExact@31 ; - java.lang.invoke.MethodHandle::invokeExact@29 ; - ruby.__dash_e__::method__1$RUBY$invoker@3 (line 1) ; {oop(a 'org/jruby/RubyFixnum')} 0x00000001060a1c12: add $0x30,%rsp 0x00000001060a1c16: pop %rbp 0x00000001060a1c17: test %eax,-0xec3c1d(%rip) # 0x00000001051de000 ; {poll_return} 0x00000001060a1c1d: retq Same metaclass as before?
  92. 0x00000001060a1be0: mov %eax,-0x14000(%rsp) 0x00000001060a1be7: push %rbp 0x00000001060a1be8: sub $0x30,%rsp ;*synchronization

    entry ; - ruby.__dash_e__::method__1$RUBY$invoker@-1 (line 1) 0x00000001060a1bec: mov 0x8(%rcx),%r10d ; implicit exception: dispatches to 0x00000001060a1c55 0x00000001060a1bf0: cmp $0xfb7aedc9,%r10d ; {oop('org/jruby/RubyObject')} 0x00000001060a1bf7: jne 0x00000001060a1c39 0x00000001060a1bf9: mov %rcx,%r10 ;*checkcast ; - org.jruby.runtime.invokedynamic.InvocationLinker::testMetaclass@2 (line 633) ; - java.lang.invoke.MethodHandle::invokeExact@3 ; - java.lang.invoke.MethodHandle::invokeExact@5 ; - java.lang.invoke.MethodHandle::invokeExact@29 ; - ruby.__dash_e__::method__1$RUBY$invoker@3 (line 1) 0x00000001060a1bfc: mov 0x10(%r10),%ebp ;*getfield metaClass ; - org.jruby.RubyBasicObject::getMetaClass@1 (line 520) ; - org.jruby.runtime.invokedynamic.InvocationLinker::testMetaclass@5 (line 633) ; - java.lang.invoke.MethodHandle::invokeExact@3 ; - java.lang.invoke.MethodHandle::invokeExact@5 ; - java.lang.invoke.MethodHandle::invokeExact@29 ; - ruby.__dash_e__::method__1$RUBY$invoker@3 (line 1) 0x00000001060a1c00: cmp $0xfed77602,%ebp ; {oop(a 'org/jruby/MetaClass')} 0x00000001060a1c06: jne 0x00000001060a1c1e ;*if_acmpne ; - org.jruby.runtime.invokedynamic.InvocationLinker::testMetaclass@8 (line 633) ; - java.lang.invoke.MethodHandle::invokeExact@3 ; - java.lang.invoke.MethodHandle::invokeExact@5 ; - java.lang.invoke.MethodHandle::invokeExact@29 ; - ruby.__dash_e__::method__1$RUBY$invoker@3 (line 1) 0x00000001060a1c08: movabs $0x7f6bf4bb0,%rax ;*areturn ; - ruby.__dash_e__::method__0$RUBY$foo@6 (line 1) ; - java.lang.invoke.MethodHandle::invokeExact@6 ; - java.lang.invoke.MethodHandle::invokeExact@31 ; - java.lang.invoke.MethodHandle::invokeExact@29 ; - ruby.__dash_e__::method__1$RUBY$invoker@3 (line 1) ; {oop(a 'org/jruby/RubyFixnum')} 0x00000001060a1c12: add $0x30,%rsp 0x00000001060a1c16: pop %rbp 0x00000001060a1c17: test %eax,-0xec3c1d(%rip) # 0x00000001051de000 ; {poll_return} 0x00000001060a1c1d: retq Store Fixnum “1” for return
  93. 0x00000001060a1be0: mov %eax,-0x14000(%rsp) 0x00000001060a1be7: push %rbp 0x00000001060a1be8: sub $0x30,%rsp ;*synchronization

    entry ; - ruby.__dash_e__::method__1$RUBY$invoker@-1 (line 1) 0x00000001060a1bec: mov 0x8(%rcx),%r10d ; implicit exception: dispatches to 0x00000001060a1c55 0x00000001060a1bf0: cmp $0xfb7aedc9,%r10d ; {oop('org/jruby/RubyObject')} 0x00000001060a1bf7: jne 0x00000001060a1c39 0x00000001060a1bf9: mov %rcx,%r10 ;*checkcast ; - org.jruby.runtime.invokedynamic.InvocationLinker::testMetaclass@2 (line 633) ; - java.lang.invoke.MethodHandle::invokeExact@3 ; - java.lang.invoke.MethodHandle::invokeExact@5 ; - java.lang.invoke.MethodHandle::invokeExact@29 ; - ruby.__dash_e__::method__1$RUBY$invoker@3 (line 1) 0x00000001060a1bfc: mov 0x10(%r10),%ebp ;*getfield metaClass ; - org.jruby.RubyBasicObject::getMetaClass@1 (line 520) ; - org.jruby.runtime.invokedynamic.InvocationLinker::testMetaclass@5 (line 633) ; - java.lang.invoke.MethodHandle::invokeExact@3 ; - java.lang.invoke.MethodHandle::invokeExact@5 ; - java.lang.invoke.MethodHandle::invokeExact@29 ; - ruby.__dash_e__::method__1$RUBY$invoker@3 (line 1) 0x00000001060a1c00: cmp $0xfed77602,%ebp ; {oop(a 'org/jruby/MetaClass')} 0x00000001060a1c06: jne 0x00000001060a1c1e ;*if_acmpne ; - org.jruby.runtime.invokedynamic.InvocationLinker::testMetaclass@8 (line 633) ; - java.lang.invoke.MethodHandle::invokeExact@3 ; - java.lang.invoke.MethodHandle::invokeExact@5 ; - java.lang.invoke.MethodHandle::invokeExact@29 ; - ruby.__dash_e__::method__1$RUBY$invoker@3 (line 1) 0x00000001060a1c08: movabs $0x7f6bf4bb0,%rax ;*areturn ; - ruby.__dash_e__::method__0$RUBY$foo@6 (line 1) ; - java.lang.invoke.MethodHandle::invokeExact@6 ; - java.lang.invoke.MethodHandle::invokeExact@31 ; - java.lang.invoke.MethodHandle::invokeExact@29 ; - ruby.__dash_e__::method__1$RUBY$invoker@3 (line 1) ; {oop(a 'org/jruby/RubyFixnum')} 0x00000001060a1c12: add $0x30,%rsp 0x00000001060a1c16: pop %rbp 0x00000001060a1c17: test %eax,-0xec3c1d(%rip) # 0x00000001051de000 ; {poll_return} 0x00000001060a1c1d: retq Note: inside the “foo” method
  94. 0x00000001060a1be0: mov %eax,-0x14000(%rsp) 0x00000001060a1be7: push %rbp 0x00000001060a1be8: sub $0x30,%rsp ;*synchronization

    entry ; - ruby.__dash_e__::method__1$RUBY$invoker@-1 (line 1) 0x00000001060a1bec: mov 0x8(%rcx),%r10d ; implicit exception: dispatches to 0x00000001060a1c55 0x00000001060a1bf0: cmp $0xfb7aedc9,%r10d ; {oop('org/jruby/RubyObject')} 0x00000001060a1bf7: jne 0x00000001060a1c39 0x00000001060a1bf9: mov %rcx,%r10 ;*checkcast ; - org.jruby.runtime.invokedynamic.InvocationLinker::testMetaclass@2 (line 633) ; - java.lang.invoke.MethodHandle::invokeExact@3 ; - java.lang.invoke.MethodHandle::invokeExact@5 ; - java.lang.invoke.MethodHandle::invokeExact@29 ; - ruby.__dash_e__::method__1$RUBY$invoker@3 (line 1) 0x00000001060a1bfc: mov 0x10(%r10),%ebp ;*getfield metaClass ; - org.jruby.RubyBasicObject::getMetaClass@1 (line 520) ; - org.jruby.runtime.invokedynamic.InvocationLinker::testMetaclass@5 (line 633) ; - java.lang.invoke.MethodHandle::invokeExact@3 ; - java.lang.invoke.MethodHandle::invokeExact@5 ; - java.lang.invoke.MethodHandle::invokeExact@29 ; - ruby.__dash_e__::method__1$RUBY$invoker@3 (line 1) 0x00000001060a1c00: cmp $0xfed77602,%ebp ; {oop(a 'org/jruby/MetaClass')} 0x00000001060a1c06: jne 0x00000001060a1c1e ;*if_acmpne ; - org.jruby.runtime.invokedynamic.InvocationLinker::testMetaclass@8 (line 633) ; - java.lang.invoke.MethodHandle::invokeExact@3 ; - java.lang.invoke.MethodHandle::invokeExact@5 ; - java.lang.invoke.MethodHandle::invokeExact@29 ; - ruby.__dash_e__::method__1$RUBY$invoker@3 (line 1) 0x00000001060a1c08: movabs $0x7f6bf4bb0,%rax ;*areturn ; - ruby.__dash_e__::method__0$RUBY$foo@6 (line 1) ; - java.lang.invoke.MethodHandle::invokeExact@6 ; - java.lang.invoke.MethodHandle::invokeExact@31 ; - java.lang.invoke.MethodHandle::invokeExact@29 ; - ruby.__dash_e__::method__1$RUBY$invoker@3 (line 1) ; {oop(a 'org/jruby/RubyFixnum')} 0x00000001060a1c12: add $0x30,%rsp 0x00000001060a1c16: pop %rbp 0x00000001060a1c17: test %eax,-0xec3c1d(%rip) # 0x00000001051de000 ; {poll_return} 0x00000001060a1c1d: retq Stack juggling
  95. 0x00000001060a1be0: mov %eax,-0x14000(%rsp) 0x00000001060a1be7: push %rbp 0x00000001060a1be8: sub $0x30,%rsp ;*synchronization

    entry ; - ruby.__dash_e__::method__1$RUBY$invoker@-1 (line 1) 0x00000001060a1bec: mov 0x8(%rcx),%r10d ; implicit exception: dispatches to 0x00000001060a1c55 0x00000001060a1bf0: cmp $0xfb7aedc9,%r10d ; {oop('org/jruby/RubyObject')} 0x00000001060a1bf7: jne 0x00000001060a1c39 0x00000001060a1bf9: mov %rcx,%r10 ;*checkcast ; - org.jruby.runtime.invokedynamic.InvocationLinker::testMetaclass@2 (line 633) ; - java.lang.invoke.MethodHandle::invokeExact@3 ; - java.lang.invoke.MethodHandle::invokeExact@5 ; - java.lang.invoke.MethodHandle::invokeExact@29 ; - ruby.__dash_e__::method__1$RUBY$invoker@3 (line 1) 0x00000001060a1bfc: mov 0x10(%r10),%ebp ;*getfield metaClass ; - org.jruby.RubyBasicObject::getMetaClass@1 (line 520) ; - org.jruby.runtime.invokedynamic.InvocationLinker::testMetaclass@5 (line 633) ; - java.lang.invoke.MethodHandle::invokeExact@3 ; - java.lang.invoke.MethodHandle::invokeExact@5 ; - java.lang.invoke.MethodHandle::invokeExact@29 ; - ruby.__dash_e__::method__1$RUBY$invoker@3 (line 1) 0x00000001060a1c00: cmp $0xfed77602,%ebp ; {oop(a 'org/jruby/MetaClass')} 0x00000001060a1c06: jne 0x00000001060a1c1e ;*if_acmpne ; - org.jruby.runtime.invokedynamic.InvocationLinker::testMetaclass@8 (line 633) ; - java.lang.invoke.MethodHandle::invokeExact@3 ; - java.lang.invoke.MethodHandle::invokeExact@5 ; - java.lang.invoke.MethodHandle::invokeExact@29 ; - ruby.__dash_e__::method__1$RUBY$invoker@3 (line 1) 0x00000001060a1c08: movabs $0x7f6bf4bb0,%rax ;*areturn ; - ruby.__dash_e__::method__0$RUBY$foo@6 (line 1) ; - java.lang.invoke.MethodHandle::invokeExact@6 ; - java.lang.invoke.MethodHandle::invokeExact@31 ; - java.lang.invoke.MethodHandle::invokeExact@29 ; - ruby.__dash_e__::method__1$RUBY$invoker@3 (line 1) ; {oop(a 'org/jruby/RubyFixnum')} 0x00000001060a1c12: add $0x30,%rsp 0x00000001060a1c16: pop %rbp 0x00000001060a1c17: test %eax,-0xec3c1d(%rip) # 0x00000001051de000 ; {poll_return} 0x00000001060a1c1d: retq Safe point check
  96. 0x00000001060a1be0: mov %eax,-0x14000(%rsp) 0x00000001060a1be7: push %rbp 0x00000001060a1be8: sub $0x30,%rsp ;*synchronization

    entry ; - ruby.__dash_e__::method__1$RUBY$invoker@-1 (line 1) 0x00000001060a1bec: mov 0x8(%rcx),%r10d ; implicit exception: dispatches to 0x00000001060a1c55 0x00000001060a1bf0: cmp $0xfb7aedc9,%r10d ; {oop('org/jruby/RubyObject')} 0x00000001060a1bf7: jne 0x00000001060a1c39 0x00000001060a1bf9: mov %rcx,%r10 ;*checkcast ; - org.jruby.runtime.invokedynamic.InvocationLinker::testMetaclass@2 (line 633) ; - java.lang.invoke.MethodHandle::invokeExact@3 ; - java.lang.invoke.MethodHandle::invokeExact@5 ; - java.lang.invoke.MethodHandle::invokeExact@29 ; - ruby.__dash_e__::method__1$RUBY$invoker@3 (line 1) 0x00000001060a1bfc: mov 0x10(%r10),%ebp ;*getfield metaClass ; - org.jruby.RubyBasicObject::getMetaClass@1 (line 520) ; - org.jruby.runtime.invokedynamic.InvocationLinker::testMetaclass@5 (line 633) ; - java.lang.invoke.MethodHandle::invokeExact@3 ; - java.lang.invoke.MethodHandle::invokeExact@5 ; - java.lang.invoke.MethodHandle::invokeExact@29 ; - ruby.__dash_e__::method__1$RUBY$invoker@3 (line 1) 0x00000001060a1c00: cmp $0xfed77602,%ebp ; {oop(a 'org/jruby/MetaClass')} 0x00000001060a1c06: jne 0x00000001060a1c1e ;*if_acmpne ; - org.jruby.runtime.invokedynamic.InvocationLinker::testMetaclass@8 (line 633) ; - java.lang.invoke.MethodHandle::invokeExact@3 ; - java.lang.invoke.MethodHandle::invokeExact@5 ; - java.lang.invoke.MethodHandle::invokeExact@29 ; - ruby.__dash_e__::method__1$RUBY$invoker@3 (line 1) 0x00000001060a1c08: movabs $0x7f6bf4bb0,%rax ;*areturn ; - ruby.__dash_e__::method__0$RUBY$foo@6 (line 1) ; - java.lang.invoke.MethodHandle::invokeExact@6 ; - java.lang.invoke.MethodHandle::invokeExact@31 ; - java.lang.invoke.MethodHandle::invokeExact@29 ; - ruby.__dash_e__::method__1$RUBY$invoker@3 (line 1) ; {oop(a 'org/jruby/RubyFixnum')} 0x00000001060a1c12: add $0x30,%rsp 0x00000001060a1c16: pop %rbp 0x00000001060a1c17: test %eax,-0xec3c1d(%rip) # 0x00000001051de000 ; {poll_return} 0x00000001060a1c1d: retq Done!
  97. Benchmarks

  98. None
  99. None
  100. That’s it!

  101. Twitter: @bascule Celluloid: celluloid.io Blog: unlimitednovelty.com