Skip to content

Instantly share code, notes, and snippets.

@cypok cypok/Inverter.java Secret
Last active Mar 13, 2018

Embed
What would you like to do?
public class Inverter {
public static boolean invert(boolean x) {
return !x;
}
public static void main(String[] args) {
invert(false);
}
}
$ java -version
java version "1.8.0_40"
Java(TM) SE Runtime Environment (build 1.8.0_40-b25)
Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)
$ java -Xcomp -Xbatch -XX:-TieredCompilation -XX:CompileCommand=print,Inverter.invert Inverter
CompilerOracle: print Inverter.invert
Java HotSpot(TM) 64-Bit Server VM warning: printing of assembly code is enabled; turning on DebugNonSafepoints to gain additional output
Compiled method (c2) 1122 490 Inverter::invert (10 bytes)
total in heap [0x0000000004af4950,0x0000000004af4b20] = 464
relocation [0x0000000004af4a70,0x0000000004af4a78] = 8
main code [0x0000000004af4a80,0x0000000004af4aa0] = 32
stub code [0x0000000004af4aa0,0x0000000004af4ab8] = 24
oops [0x0000000004af4ab8,0x0000000004af4ac0] = 8
metadata [0x0000000004af4ac0,0x0000000004af4ac8] = 8
scopes data [0x0000000004af4ac8,0x0000000004af4ad8] = 16
scopes pcs [0x0000000004af4ad8,0x0000000004af4b18] = 64
dependencies [0x0000000004af4b18,0x0000000004af4b20] = 8
Loaded disassembler from hsdis-amd64.dll
Decoding compiled method 0x0000000004af4950:
Code:
[Disassembling for mach='i386:x86-64']
[Entry Point]
[Verified Entry Point]
[Constants]
# {method} {0x00000000119f0248} 'invert' '(Z)Z' in 'Inverter'
# parm0: rdx = boolean
# [sp+0x20] (sp of caller)
0x0000000004af4a80: sub $0x18,%rsp
0x0000000004af4a87: mov %rbp,0x10(%rsp) ;*synchronization entry
; - Inverter::invert@-1 (line 3)
0x0000000004af4a8c: mov %edx,%eax
0x0000000004af4a8e: xor $0x1,%eax ;*ireturn
; - Inverter::invert@9 (line 3)
0x0000000004af4a91: add $0x10,%rsp
0x0000000004af4a95: pop %rbp
0x0000000004af4a96: test %eax,-0x2494a9c(%rip) # 0x0000000002660000
; {poll_return}
0x0000000004af4a9c: retq
0x0000000004af4a9d: hlt
0x0000000004af4a9e: hlt
0x0000000004af4a9f: hlt
[Exception Handler]
[Stub Code]
0x0000000004af4aa0: jmpq 0x0000000004a2c7e0 ; {no_reloc}
[Deopt Handler Code]
0x0000000004af4aa5: callq 0x0000000004af4aaa
0x0000000004af4aaa: subq $0x5,(%rsp)
0x0000000004af4aaf: jmpq 0x0000000004a07200 ; {runtime_call}
0x0000000004af4ab4: hlt
0x0000000004af4ab5: hlt
0x0000000004af4ab6: hlt
0x0000000004af4ab7: hlt
OopMapSet contains 0 OopMaps
$ java -version
java version "9"
Java(TM) SE Runtime Environment (build 9+181)
Java HotSpot(TM) 64-Bit Server VM (build 9+181, mixed mode)
$ java -Xcomp -Xbatch -XX:-TieredCompilation -XX:CompileCommand=print,Inverter.invert Inverter
CompileCommand: print Inverter.invert
Java HotSpot(TM) 64-Bit Server VM warning: printing of assembly code is enabled; turning on DebugNonSafepoints to gain additional output
Compiled method (c2) 4639 1431 Inverter::invert (10 bytes)
total in heap [0x000001d92cc9ef10,0x000001d92cc9f160] = 592
relocation [0x000001d92cc9f080,0x000001d92cc9f088] = 8
main code [0x000001d92cc9f0a0,0x000001d92cc9f0e0] = 64
stub code [0x000001d92cc9f0e0,0x000001d92cc9f0f8] = 24
oops [0x000001d92cc9f0f8,0x000001d92cc9f100] = 8
metadata [0x000001d92cc9f100,0x000001d92cc9f108] = 8
scopes data [0x000001d92cc9f108,0x000001d92cc9f118] = 16
scopes pcs [0x000001d92cc9f118,0x000001d92cc9f158] = 64
dependencies [0x000001d92cc9f158,0x000001d92cc9f160] = 8
Loaded disassembler from hsdis-amd64.dll
----------------------------------------------------------------------
Inverter.invert(Z)Z [0x000001d92cc9f0a0, 0x000001d92cc9f0f8] 88 bytes
[Disassembling for mach='i386:x86-64']
[Entry Point]
[Verified Entry Point]
[Constants]
# {method} {0x000001d93cd81248} 'invert' '(Z)Z' in 'Inverter'
# parm0: rdx = boolean
# [sp+0x20] (sp of caller)
0x000001d92cc9f0a0: sub $0x18,%rsp
0x000001d92cc9f0a7: mov %rbp,0x10(%rsp) ;*synchronization entry
; - Inverter::invert@-1 (line 3)
0x000001d92cc9f0ac: test %edx,%edx
0x000001d92cc9f0ae: setne %al
0x000001d92cc9f0b1: movzbl %al,%eax
0x000001d92cc9f0b4: xor $0x1,%eax ;*ireturn {reexecute=0 rethrow=0 return_oop=0}
; - Inverter::invert@9 (line 3)
0x000001d92cc9f0b7: add $0x10,%rsp
0x000001d92cc9f0bb: pop %rbp
0x000001d92cc9f0bc: test %eax,-0xc7bf0c2(%rip) # 0x000001d9204e0000
; {poll_return}
0x000001d92cc9f0c2: retq
0x000001d92cc9f0c3: hlt
0x000001d92cc9f0c4: hlt
0x000001d92cc9f0c5: hlt
0x000001d92cc9f0c6: hlt
0x000001d92cc9f0c7: hlt
0x000001d92cc9f0c8: hlt
0x000001d92cc9f0c9: hlt
0x000001d92cc9f0ca: hlt
0x000001d92cc9f0cb: hlt
0x000001d92cc9f0cc: hlt
0x000001d92cc9f0cd: hlt
0x000001d92cc9f0ce: hlt
0x000001d92cc9f0cf: hlt
0x000001d92cc9f0d0: hlt
0x000001d92cc9f0d1: hlt
0x000001d92cc9f0d2: hlt
0x000001d92cc9f0d3: hlt
0x000001d92cc9f0d4: hlt
0x000001d92cc9f0d5: hlt
0x000001d92cc9f0d6: hlt
0x000001d92cc9f0d7: hlt
0x000001d92cc9f0d8: hlt
0x000001d92cc9f0d9: hlt
0x000001d92cc9f0da: hlt
0x000001d92cc9f0db: hlt
0x000001d92cc9f0dc: hlt
0x000001d92cc9f0dd: hlt
0x000001d92cc9f0de: hlt
0x000001d92cc9f0df: hlt
[Exception Handler]
[Stub Code]
0x000001d92cc9f0e0: jmpq 0x000001d92ca03680 ; {no_reloc}
[Deopt Handler Code]
0x000001d92cc9f0e5: callq 0x000001d92cc9f0ea
0x000001d92cc9f0ea: subq $0x5,(%rsp)
0x000001d92cc9f0ef: jmpq 0x000001d92c9cd5a0 ; {runtime_call DeoptimizationBlob}
0x000001d92cc9f0f4: hlt
0x000001d92cc9f0f5: hlt
0x000001d92cc9f0f6: hlt
0x000001d92cc9f0f7: hlt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.