Invoke dynamic your api to hotspot
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Invoke dynamic your api to hotspot

on

  • 375 views

 

Statistics

Views

Total Views
375
Views on SlideShare
375
Embed Views
0

Actions

Likes
0
Downloads
3
Comments
1

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • Slides from Tony Arcieri presentation at the Boundary TechTalk Oct 11th 2012
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Invoke dynamic your api to hotspot Presentation 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. Once upon a time...Java was slow
  • 6. Anamorphic
  • 7. AnamorphicStrongTalk
  • 8. Anamorphic StrongTalk• Optional static typing• Modern garbage collector• JIT compiler
  • 9. Anamorphic Sun MicrosystemsStrongTalk Java
  • 10. Anamorphic Sun MicrosystemsStrongTalk Java Stolen legacy!
  • 11. Anamorphic Sun MicrosystemsStrongTalk Java Stolen legacy!
  • 12. Anamorphic Sun MicrosystemsStrongTalk Java Stolen legacy!
  • 13. HotSpot
  • 14. JIT
  • 15. Just-In-Time CompilerCompile When Code Runs
  • 16. JIT Spectrum
  • 17. JIT SpectrumEager Lazy
  • 18. JIT SpectrumEager Lazy V8CLR HotSpot HiPE
  • 19. JIT SpectrumEager Lazy V8CLR HotSpot HiPE Static Optimizations Runtime Optimizations
  • 20. HotSpot• C1: Client Compiler• C2: Server Compiler
  • 21. HotSpot• C1: Client Compiler• C2: Server Compiler• -XX:+TieredCompilation
  • 22. Mixed Mode Profiling JIT
  • 23. Start by interpretingJVM “emulates” bytecodes in userspace BYTECODE
  • 24. Locate “hot spots”Using runtime profiling information BYTECODE
  • 25. Generate machine code Compile JVM bytecode to native ISA after 10,000 calls 1 1 1 1 1 0 0 0 0 0 1 1 BYTECODE 1 1 1 0 0 0 0 0
  • 26. Optimizations• Inlining methods• Unrolling loops• Eliding locks• Eliminating dead code• Escape analysis
  • 27. Optimizations• Inlining methods• Unrolling loops• Eliding locks• Eliminating dead code• Escape analysis
  • 28. InliningCombine and optimize across calls Method 1 CALL Method 2
  • 29. InliningCombine and optimize across calls Method 1 Method 2
  • 30. Call SitesWhere the magic happens... CALL
  • 31. Call Sites• Profile data• Monomorphic inline cache• Polymorphic inline cache
  • 32. “Shapes”
  • 33. MonomorphicOnly one type seen at call site A CALL
  • 34. BimorphicTwo types seen at call site A CALL B
  • 35. PolymorphicMany types seen at call site A CALLB C
  • 36. MegamorphicToo many types seen at call site F D A CALL E G B C
  • 37. Inlining• Measure invocations and branches• Make an educated guess• Inline the code in question• Back out if we guessed wrong
  • 38. Deopt• Check invariants at a “safe point”• Did we guess wrong?• Revert optimization and try again
  • 39. JVM Limitations
  • 40. Made for Java • InvokeVirtual • InvokeInterface • InvokeStatic • InvokeSpecial
  • 41. Non-Java call sites are opaque to HotSpot Can’t be inlined Method 1 CALL Method 2
  • 42. Teach HotSpot?See through non-Java call sites Method 1 CALL Method 2
  • 43. Inline just like Java Method 1 Method 2
  • 44. What if it worked for any language?
  • 45. Even Ruby?
  • 46. InvokeDynamic
  • 47. InDy
  • 48. InDy• JSR-292: “Supporting Dynamically Typed Languages on the Java Platform”• Initial version shipped in Java 7• Feeds directly into HotSpot in Java 8
  • 49. New JVMinstruction
  • 50. java.lang.invoke
  • 51. InvokeDynamic
  • 52. InvokeDynamic
  • 53. InvokeDynamic
  • 54. “User defineddata endpoint”
  • 55. JVM Data Endpoints • Invoke operations • Array element access • Property lookup • And more!
  • 56. InDy Use Cases• Custom invocation• “Constant” values (e.g. globals, language intrinsics)• Scoped values (e.g. instance variables)
  • 57. InDyHow does it work?
  • 58. Pieces of InDy• Bootstrap methods• Call sites• Method handles• Switch points
  • 59. Bootstrap method
  • 60. Bootstrap method Wire up the call site
  • 61. Bootstrap method Your own code!
  • 62. Bootstrap Method• Called the first time each InDy call site is used• Find MethodHandle to dispatch• Return CallSite object
  • 63. Call SiteReplaces InDy instruction in bytecode
  • 64. Call SiteHolds onto a chain of MethodHandles
  • 65. java.lang.invoke.CallSite • ConstantCallSite: unchangeable • VolatileCallSite: seen coherently across cores • MutableCallSite: may appear different across cores
  • 66. Any of those can be subclassed
  • 67. java.lang.invoke.MethodHandle • Directly executable reference to a Java method (i.e. fast-as-Java) • Inlineable by HotSpot • MethodHandles all the way down
  • 68. Methods are first- class objects
  • 69. Project Lambda Lambdas for the JVMComing in Java 8! (Summer 2013)
  • 70. Guarded Invocation
  • 71. Guarded InvocationMethodHandle.guardWithTest(! MethodHandle test,! MethodHandle target,! MethodHandle fallback)
  • 72. fallback can rebind the call site Handle new types as they’re seen
  • 73. SwitchPoints
  • 74. SwitchPointsSwitchPoint.guardWithTest(! MethodHandle target,! MethodHandle fallback)SwitchPoint.invalidateAll(! SwitchPoint[])
  • 75. 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)
  • 76. Putting it together
  • 77. Invocation exampleCallSite: where the call is taking place
  • 78. Invocation exampleCallSite: where the call is taking place SwitchPoint: did the class change?
  • 79. Invocation exampleCallSite: where the call is taking place SwitchPoint: did the class change? GuardWithTest: is this the type we bound?
  • 80. Invocation exampleCallSite: where the call is taking place SwitchPoint: did the class change? GuardWithTest: is this the type we bound? Target: invoke the target method
  • 81. Invocation exampleCallSite: where the call is taking place SwitchPoint: did the class change? GuardWithTest: is this the type we bound? Target: invoke the target method - or - Rebind: lookup new method and rebuild call site
  • 82. Invocation exampleCallSite: where the call is taking place SwitchPoint: did the class change? GuardWithTest: is this the type we bound? Target: invoke the target method - or - Rebind: lookup new method and rebuild call site - or - Rebind: lookup potentially changed methods
  • 83. InDy in the real world
  • 84. Is it good? To the assembly!
  • 85. Enabling ASM outputjava -XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly
  • 86. Contrived Ruby code def foo; 1; end def invoker; foo; end i = 0 while i < 10000   invoker   i+=1 end
  • 87. 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
  • 88. 0x00000001060a1be0: mov  0x00000001060a1be7: push %eax,-0x14000(%rsp) %rbp Stack juggling  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  0x00000001060a1be7: push %eax,-0x14000(%rsp) %rbp Is “self” a Ruby object?  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
  • 90. 0x00000001060a1be0: mov  0x00000001060a1be7: push %eax,-0x14000(%rsp) %rbp Same metaclass as before?  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
  • 91. 0x00000001060a1be0: mov  0x00000001060a1be7: push %eax,-0x14000(%rsp) %rbp Store Fixnum “1” for return  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
  • 92. 0x00000001060a1be0: mov  0x00000001060a1be7: push %eax,-0x14000(%rsp) %rbp Note: inside the “foo” method  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
  • 93. 0x00000001060a1be0: mov  0x00000001060a1be7: push %eax,-0x14000(%rsp) %rbp Stack juggling  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
  • 94. 0x00000001060a1be0: mov  0x00000001060a1be7: push %eax,-0x14000(%rsp) %rbp Safe point check  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
  • 95. 0x00000001060a1be0: mov  0x00000001060a1be7: push %eax,-0x14000(%rsp) %rbp Done!  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
  • 96. Benchmarks
  • 97. That’s it!
  • 98. Twitter: @bascule Celluloid: celluloid.io Blog:unlimitednovelty.com