Skip to content

Instantly share code, notes, and snippets.

@nschlimm
Created January 9, 2012 14:29
Show Gist options
  • Save nschlimm/1583170 to your computer and use it in GitHub Desktop.
Save nschlimm/1583170 to your computer and use it in GitHub Desktop.
ThreadLocalRandomGenerator Assembly Code
Decoding compiled method 0x00c39888:
Code:
[Constants]
0x00c399a0 (offset: 0): 0x00000000 0x4340000000000000
0x00c399a4 (offset: 4): 0x43400000
0x00c399a8 (offset: 8): 0xf4f4f4f4 0xf4f4f4f4f4f4f4f4
0x00c399ac (offset: 12): 0xf4f4f4f4
[Disassembling for mach='i386']
[Entry Point]
# {method} 'run' '()V' in 'com/schlimm/java7/concurrency/random/generators/ThreadLocalRandomGenerator'
# [sp+0x70] (sp of caller)
;; block B9 [0, 0]
0x00c399b0: nop ; {no_reloc}
0x00c399b1: nop
0x00c399b2: nop
0x00c399b3: nop
0x00c399b4: nop
0x00c399b5: nop
0x00c399b6: nop
0x00c399b7: cmp 0x4(%ecx),%eax
0x00c399ba: jne 0x00bead90 ; {runtime_call}
[Verified Entry Point]
0x00c399c0: mov %eax,0xffff8000(%esp)
0x00c399c7: push %ebp
0x00c399c8: sub $0x68,%esp ;*aload_0
; - com.schlimm.java7.concurrency.random.generators.ThreadLocalRandomGenerator::run@0 (line 13)
;; block B0 [0, 15]
0x00c399cb: movsd 0x8(%ecx),%xmm0 ;*getfield r
; - com.schlimm.java7.concurrency.random.generators.ThreadLocalRandomGenerator::run@2 (line 13)
0x00c399d0: mov $0x100d2118,%esi ; {oop(a 'java/lang/Class' = 'java/util/concurrent/ThreadLocalRandom')}
0x00c399d5: mov 0x68(%esi),%esi ;*getstatic localRandom
; - java.util.concurrent.ThreadLocalRandom::current@0 (line 113)
; - com.schlimm.java7.concurrency.random.generators.ThreadLocalRandomGenerator::run@5 (line 13)
0x00c399d8: mov %ecx,0x38(%esp)
0x00c399dc: mov %esi,%ecx ;*invokevirtual get
; - java.util.concurrent.ThreadLocalRandom::current@3 (line 113)
; - com.schlimm.java7.concurrency.random.generators.ThreadLocalRandomGenerator::run@5 (line 13)
0x00c399de: movsd %xmm0,0x58(%esp)
0x00c399e4: nop
0x00c399e5: nop
0x00c399e6: nop
0x00c399e7: call 0x00beafd0 ; OopMap{[56]=Oop off=60}
;*invokevirtual get
; - java.util.concurrent.ThreadLocalRandom::current@3 (line 113)
; - com.schlimm.java7.concurrency.random.generators.ThreadLocalRandomGenerator::run@5 (line 13)
; {optimized virtual_call}
0x00c399ec: cmp $0x0,%eax
0x00c399ef: je 0x00c39a07
0x00c399f5: cmpl $0x20237c88,0x4(%eax) ; {oop('java/util/concurrent/ThreadLocalRandom')}
0x00c399fc: jne 0x00c39b39
0x00c39a02: jmp 0x00c39a07
0x00c39a07: mov %eax,%ecx ;*checkcast
; - java.util.concurrent.ThreadLocalRandom::current@6 (line 113)
; - com.schlimm.java7.concurrency.random.generators.ThreadLocalRandomGenerator::run@5 (line 13)
0x00c39a09: mov 0x18(%ecx),%eax ; implicit exception: dispatches to 0x00c39b52
0x00c39a0c: mov 0x1c(%ecx),%edx ;*getfield rnd
; - java.util.concurrent.ThreadLocalRandom::next@2 (line 129)
; - java.util.Random::nextDouble@3 (line 438)
; - com.schlimm.java7.concurrency.random.generators.ThreadLocalRandomGenerator::run@8 (line 13)
0x00c39a0f: mov $0xdeece66d,%esi
0x00c39a14: mov $0x5,%edi
0x00c39a19: mov %ecx,0x3c(%esp)
0x00c39a1d: mov %esi,%ebx
0x00c39a1f: mov %edi,%ecx
0x00c39a21: imul %ebx,%edx
0x00c39a24: imul %eax,%ecx
0x00c39a27: add %edx,%ecx
0x00c39a29: mul %ebx
0x00c39a2b: add %ecx,%edx
0x00c39a2d: mov $0xb,%ebx
0x00c39a32: mov $0x0,%ecx
0x00c39a37: add %ebx,%eax
0x00c39a39: adc %ecx,%edx
0x00c39a3b: mov %ebx,0x40(%esp)
0x00c39a3f: mov %ecx,0x44(%esp)
0x00c39a43: mov $0xffffffff,%ebx
0x00c39a48: mov $0xffff,%ecx
0x00c39a4d: and %ebx,%eax
0x00c39a4f: and %ecx,%edx
0x00c39a51: mov %ebx,0x48(%esp)
0x00c39a55: mov %ecx,0x4c(%esp)
0x00c39a59: mov 0x3c(%esp),%ebx
0x00c39a5d: mov %eax,0x18(%ebx)
0x00c39a60: mov %edx,0x1c(%ebx) ;*putfield rnd
; - java.util.concurrent.ThreadLocalRandom::next@17 (line 129)
; - java.util.Random::nextDouble@3 (line 438)
; - com.schlimm.java7.concurrency.random.generators.ThreadLocalRandomGenerator::run@8 (line 13)
0x00c39a63: mov %eax,0x50(%esp)
0x00c39a67: mov %edx,0x54(%esp)
0x00c39a6b: mov 0x50(%esp),%eax
0x00c39a6f: mov 0x54(%esp),%edx
0x00c39a73: imul %esi,%edx
0x00c39a76: imul %eax,%edi
0x00c39a79: add %edx,%edi
0x00c39a7b: mul %esi
0x00c39a7d: add %edi,%edx
0x00c39a7f: mov 0x40(%esp),%esi
0x00c39a83: mov 0x44(%esp),%ecx
0x00c39a87: add %esi,%eax
0x00c39a89: adc %ecx,%edx
0x00c39a8b: mov 0x48(%esp),%esi
0x00c39a8f: mov 0x4c(%esp),%ecx
0x00c39a93: and %esi,%eax
0x00c39a95: and %ecx,%edx
0x00c39a97: mov %eax,0x18(%ebx)
0x00c39a9a: mov %edx,0x1c(%ebx) ;*putfield rnd
; - java.util.concurrent.ThreadLocalRandom::next@17 (line 129)
; - java.util.Random::nextDouble@13 (line 438)
; - com.schlimm.java7.concurrency.random.generators.ThreadLocalRandomGenerator::run@8 (line 13)
0x00c39a9d: mov $0x16,%ecx
0x00c39aa2: mov 0x50(%esp),%esi
0x00c39aa6: mov 0x54(%esp),%edi
0x00c39aaa: and $0x3f,%ecx
0x00c39aad: cmp $0x20,%ecx
0x00c39ab0: jl 0x00c39aba
0x00c39ab6: mov %edi,%esi
0x00c39ab8: xor %edi,%edi
0x00c39aba: shrd %cl,%edi,%esi
0x00c39abd: shr %cl,%edi
0x00c39abf: mov %esi,%edi
0x00c39ac1: sar $0x1f,%edi
0x00c39ac4: mov $0x1b,%ecx
0x00c39ac9: and $0x3f,%ecx
0x00c39acc: cmp $0x20,%ecx
0x00c39acf: jl 0x00c39ad9
0x00c39ad5: mov %esi,%edi
0x00c39ad7: xor %esi,%esi
0x00c39ad9: shld %cl,%esi,%edi
0x00c39adc: shl %cl,%esi
0x00c39ade: mov $0x15,%ecx
0x00c39ae3: and $0x3f,%ecx
0x00c39ae6: cmp $0x20,%ecx
0x00c39ae9: jl 0x00c39af3
0x00c39aef: mov %edx,%eax
0x00c39af1: xor %edx,%edx
0x00c39af3: shrd %cl,%edx,%eax
0x00c39af6: shr %cl,%edx
0x00c39af8: mov %eax,%ebx
0x00c39afa: sar $0x1f,%eax
0x00c39afd: add %ebx,%esi
0x00c39aff: adc %eax,%edi
0x00c39b01: mov %esi,(%esp)
0x00c39b04: mov %edi,0x4(%esp)
0x00c39b08: fildll (%esp)
0x00c39b0b: fstpl (%esp)
0x00c39b0e: movsd (%esp),%xmm0
0x00c39b13: divsd 0xc399a0,%xmm0 ; {section_word}
0x00c39b1b: movsd 0x58(%esp),%xmm1
0x00c39b21: addsd %xmm0,%xmm1
0x00c39b25: mov 0x38(%esp),%ecx
0x00c39b29: movsd %xmm1,0x8(%ecx) ;*putfield r
; - com.schlimm.java7.concurrency.random.generators.ThreadLocalRandomGenerator::run@12 (line 13)
0x00c39b2e: add $0x68,%esp
0x00c39b31: pop %ebp
0x00c39b32: test %eax,0x9f0100 ; {poll_return}
0x00c39b38: ret
;; SimpleExceptionStub slow case
0x00c39b39: mov %eax,(%esp)
0x00c39b3c: call 0x00c2a5a0 ; OopMap{[56]=Oop off=401}
;*checkcast
; - java.util.concurrent.ThreadLocalRandom::current@6 (line 113)
; - com.schlimm.java7.concurrency.random.generators.ThreadLocalRandomGenerator::run@5 (line 13)
; {runtime_call}
0x00c39b41: push $0x84117f8 ; {external_word}
0x00c39b46: call 0x00c39b4b
0x00c39b4b: pusha
0x00c39b4c: call 0x08260100 ; {runtime_call}
0x00c39b51: hlt
;; ImplicitNullCheckStub slow case
0x00c39b52: call 0x00c28620 ; OopMap{[56]=Oop ecx=Oop off=423}
;*invokevirtual nextDouble
; - com.schlimm.java7.concurrency.random.generators.ThreadLocalRandomGenerator::run@8 (line 13)
; {runtime_call}
0x00c39b57: push $0x84117f8 ; {external_word}
0x00c39b5c: call 0x00c39b61
0x00c39b61: pusha
0x00c39b62: call 0x08260100 ; {runtime_call}
0x00c39b67: hlt
0x00c39b68: nop
0x00c39b69: nop
;; Unwind handler
0x00c39b6a: mov %fs:0x0,%esi
0x00c39b72: mov 0xfffffff4(%esi),%esi
0x00c39b75: mov 0x198(%esi),%eax
0x00c39b7b: movl $0x0,0x198(%esi)
0x00c39b85: movl $0x0,0x19c(%esi)
0x00c39b8f: add $0x68,%esp
0x00c39b92: pop %ebp
0x00c39b93: jmp 0x00c27e60 ; {runtime_call}
0x00c39b98: hlt
0x00c39b99: hlt
0x00c39b9a: hlt
0x00c39b9b: hlt
0x00c39b9c: hlt
0x00c39b9d: hlt
0x00c39b9e: hlt
0x00c39b9f: hlt
[Stub Code]
0x00c39ba0: nop ; {no_reloc}
0x00c39ba1: nop
0x00c39ba2: mov $0x0,%ebx ; {static_stub}
0x00c39ba7: jmp 0x00c39ba7 ; {runtime_call}
[Exception Handler]
0x00c39bac: mov $0xdead,%ebx
0x00c39bb1: mov $0xdead,%ecx
0x00c39bb6: mov $0xdead,%esi
0x00c39bbb: mov $0xdead,%edi
0x00c39bc0: call 0x00c2a260 ; {runtime_call}
0x00c39bc5: push $0x84117f8 ; {external_word}
0x00c39bca: call 0x00c39bcf
0x00c39bcf: pusha
0x00c39bd0: call 0x08260100 ; {runtime_call}
0x00c39bd5: hlt
[Deopt Handler Code]
0x00c39bd6: push $0xc39bd6 ; {section_word}
0x00c39bdb: jmp 0x00bebac0 ; {runtime_call}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment