配置VM Options查看Java代码的汇编指令

Posted 魏晓蕾

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了配置VM Options查看Java代码的汇编指令相关的知识,希望对你有一定的参考价值。

  1. 将 hsdis-amd64.dll 和 hsdis-amd64.lib 文件放入 JRE_HOME\\bin\\server 目录下。

  1. 配置需要查看汇编指令的 Java 入口类的运行配置。

在 Run/Debug Configurations 中编辑如下配置:

VM Options:-server -Xcomp -XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly -XX:CompileCommand=compileonly,*VolatileDemo.*

JRE:E:\\Program Files\\Java\\jdk1.8.0_291\\jre
  1. Java入口类 VolatileDemo 如下:
package org.example;

public class VolatileDemo 

    public static boolean stop = false;

    public static void main(String[] args) throws InterruptedException 
        Thread t1 = new Thread(() -> 
            int i = 0;
            while (!stop) 
                i++;
            
        );
        t1.start();
        System.out.println("begin start thread");
        Thread.sleep(1000);
        stop = true;
    

运行代码,汇编指令打印如下:

"E:\\Program Files\\Java\\jdk1.8.0_291\\jre\\bin\\java.exe" -server -Xcomp -XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly "-XX:CompileCommand=compileonly,*VolatileDemo.*" "-javaagent:E:\\Program Files (x86)\\JetBrains\\IntelliJ IDEA 2020.1\\lib\\idea_rt.jar=53076:E:\\Program Files (x86)\\JetBrains\\IntelliJ IDEA 2020.1\\bin" -Dfile.encoding=UTF-8 -classpath "E:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\charsets.jar;E:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\deploy.jar;E:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\ext\\access-bridge-64.jar;E:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\ext\\cldrdata.jar;E:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\ext\\dnsns.jar;E:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\ext\\jaccess.jar;E:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\ext\\jfxrt.jar;E:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\ext\\localedata.jar;E:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\ext\\nashorn.jar;E:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\ext\\sunec.jar;E:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\ext\\sunjce_provider.jar;E:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\ext\\sunmscapi.jar;E:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\ext\\sunpkcs11.jar;E:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\ext\\zipfs.jar;E:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\javaws.jar;E:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\jce.jar;E:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\jfr.jar;E:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\jfxswt.jar;E:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\jsse.jar;E:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\management-agent.jar;E:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\plugin.jar;E:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\resources.jar;E:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\rt.jar;H:\\IDEAWorkspace\\GuPaoStudyThreadVolatile\\target\\classes" org.example.VolatileDemo
Java HotSpot(TM) 64-Bit Server VM warning: PrintAssembly is enabled; turning on DebugNonSafepoints to gain additional output
CompilerOracle: compileonly *VolatileDemo.*
Loaded disassembler from E:\\Program Files\\Java\\jdk1.8.0_291\\jre\\bin\\server\\hsdis-amd64.dll
Decoding compiled method 0x000001aa313b62d0:
Code:
Argument 0 is unknown.RIP: 0x1aa313b6420 Code size: 0x000001b8
[Disassembling for mach='amd64']
[Entry Point]
[Verified Entry Point]
[Constants]
  # method 0x000001aa45452e00 '<clinit>' '()V' in 'org/example/VolatileDemo'
  #           [sp+0x40]  (sp of caller)
  0x000001aa313b6420: mov     dword ptr [rsp+0ffffffffffffa000h],eax
  0x000001aa313b6427: push    rbp
  0x000001aa313b6428: sub     rsp,30h
  0x000001aa313b642c: mov     rsi,1aa45453048h  ;   metadata(method data for method 0x000001aa45452e00 '<clinit>' '()V' in 'org/example/VolatileDemo')
  0x000001aa313b6436: mov     edi,dword ptr [rsi+0dch]
  0x000001aa313b643c: add     edi,8h
  0x000001aa313b643f: mov     dword ptr [rsi+0dch],edi
  0x000001aa313b6445: mov     rsi,1aa45452df8h  ;   metadata(method 0x000001aa45452e00 '<clinit>' '()V' in 'org/example/VolatileDemo')
  0x000001aa313b644f: and     edi,0h
  0x000001aa313b6452: cmp     edi,0h
  0x000001aa313b6455: je      1aa313b647ah      ;*iconst_0
                                                ; - org.example.VolatileDemo::<clinit>@0 (line 10)

  0x000001aa313b645b: nop     dword ptr [rax+rax+0h]
  0x000001aa313b6460: jmp     1aa313b64e8h      ;   no_reloc
  0x000001aa313b6465: add     byte ptr [rax],al
  0x000001aa313b6467: add     byte ptr [rax],al
  0x000001aa313b6469: add     dh,al
  0x000001aa313b646b: push    0ffffffffc4834800h  ;*putstatic stop
                                                ; - org.example.VolatileDemo::<clinit>@1 (line 10)

  0x000001aa313b6471: xor     byte ptr [rbp+0ffffffffffffff85h],bl
                                                ;   poll_return
  0x000001aa313b6474: add     eax,0fdaa9c87h
  0x000001aa313b6479: ret
  0x000001aa313b647a: mov     qword ptr [rsp+8h],rsi
  0x000001aa313b647f: mov     qword ptr [rsp],0ffffffffffffffffh
  0x000001aa313b6487: call    1aa313b4160h      ; OopMapoff=108
                                                ;*synchronization entry
                                                ; - org.example.VolatileDemo::<clinit>@-1 (line 10)
                                                ;   runtime_call
  0x000001aa313b648c: jmp     1aa313b645bh
  0x000001aa313b648e: mov     rsi,0h            ;   oop(NULL)
  0x000001aa313b6498: push    rax
  0x000001aa313b6499: push    rbx
  0x000001aa313b649a: mov     rbx,qword ptr [rsi+48h]
  0x000001aa313b649e: push    rdi
  0x000001aa313b649f: push    rsi
  0x000001aa313b64a0: push    rdx
  0x000001aa313b64a1: push    rcx
  0x000001aa313b64a2: push    r8
  0x000001aa313b64a4: push    r9
  0x000001aa313b64a6: push    r10
  0x000001aa313b64a8: mov     r10,rsp
  0x000001aa313b64ab: and     rsp,0fffffffffffffff0h
  0x000001aa313b64af: push    r10
  0x000001aa313b64b1: push    r11
  0x000001aa313b64b3: mov     ecx,1ch
  0x000001aa313b64b8: mov     r10,7ffc1ce95e40h  ;   runtime_call
  0x000001aa313b64c2: call indirect r10
  0x000001aa313b64c5: pop     r11
  0x000001aa313b64c7: pop     rsp
  0x000001aa313b64c8: pop     r10
  0x000001aa313b64ca: pop     r9
  0x000001aa313b64cc: pop     r8
  0x000001aa313b64ce: pop     rcx
  0x000001aa313b64cf: pop     rdx
  0x000001aa313b64d0: pop     rsi
  0x000001aa313b64d1: pop     rdi
  0x000001aa313b64d2: cmp     rax,qword ptr [rbx+118h]
  0x000001aa313b64d9: pop     rbx
  0x000001aa313b64da: pop     rax
  0x000001aa313b64db: jne     1aa313b64e8h
  0x000001aa313b64e1: jmp     1aa313b646ah
  0x000001aa313b64e3: mov     eax,0a505a00h
  0x000001aa313b64e8: call    1aa313b1c20h      ; OopMapoff=205
                                                ;*putstatic stop
                                                ; - org.example.VolatileDemo::<clinit>@1 (line 10)
                                                ;   runtime_call
  0x000001aa313b64ed: jmp     1aa313b6460h
  0x000001aa313b64f2: nop
  0x000001aa313b64f3: nop
  0x000001aa313b64f4: mov     rax,qword ptr [r15+2b0h]
  0x000001aa313b64fb: mov     r10,0h
  0x000001aa313b6505: mov     qword ptr [r15+2b0h],r10
  0x000001aa313b650c: mov     r10,0h
  0x000001aa313b6516: mov     qword ptr [r15+2b8h],r10
  0x000001aa313b651d: add     rsp,30h
  0x000001aa313b6521: pop     rbp
  0x000001aa313b6522: jmp     1aa31324060h      ;   runtime_call
  0x000001aa313b6527: hlt
  0x000001aa313b6528: hlt
  0x000001aa313b6529: hlt
  0x000001aa313b652a: hlt
  0x000001aa313b652b: hlt
  0x000001aa313b652c: hlt
  0x000001aa313b652d: hlt
  0x000001aa313b652e: hlt
  0x000001aa313b652f: hlt
  0x000001aa313b6530: hlt
  0x000001aa313b6531: hlt
  0x000001aa313b6532: hlt
  0x000001aa313b6533: hlt
  0x000001aa313b6534: hlt
  0x000001aa313b6535: hlt
  0x000001aa313b6536: hlt
  0x000001aa313b6537: hlt
  0x000001aa313b6538: hlt
  0x000001aa313b6539: hlt
  0x000001aa313b653a: hlt
  0x000001aa313b653b: hlt
  0x000001aa313b653c: hlt
  0x000001aa313b653d: hlt
  0x000001aa313b653e: hlt
  0x000001aa313b653f: hlt
[Exception Handler]
[Stub Code]
  0x000001aa313b6540: call    1aa313b3b60h      ;   no_reloc
  0x000001aa313b6545: mov     qword ptr [rsp+0ffffffffffffffd8h],rsp
  0x000001aa313b654a: sub     rsp,80h
  0x000001aa313b6551: mov     qword ptr [rsp+78h],rax
  0x000001aa313b6556: mov     qword ptr [rsp+70h],rcx
  0x000001aa313b655b: mov     qword ptr [rsp+68h],rdx
  0x000001aa313b6560: mov     qword ptr [rsp+60h],rbx
  0x000001aa313b6565: mov     qword ptr [rsp+50h],rbp
  0x000001aa313b656a: mov     qword ptr [rsp+48h],rsi
  0x000001aa313b656f: mov     qword ptr [rsp+40h],rdi
  0x000001aa313b6574: mov     qword ptr [rsp+38h],r8
  0x000001aa313b6579: mov     qword ptr [rsp+30h],r9
  0x000001aa313b657e: mov     qword ptr [rsp+28h],r10
  0x000001aa313b6583: mov     qword ptr [rsp+20h],r11
  0x000001aa313b6588: mov     qword ptr [rsp+18h],r12
  0x000001aa313b658d: mov     qword ptr [rsp+10h],r13
  0x000001aa313b6592: mov     qword ptr [rsp+8h],r14
  0x000001aa313b6597: mov     qword ptr [rsp],r15
  0x000001aa313b659b: mov     rcx,7313f980h     ;   external_word
  0x000001aa313b65a5: mov     rdx,1aa313b6545h  ;   internal_word
  0x000001aa313b65af: mov     r8,rsp
  0x000001aa313b65b2: and     rsp,0fffffffffffffff0h
  0x000001aa313b65b6: mov     r10,72e1d730h     ;   runtime_call
  0x000001aa313b65c0: call indirect r10
  0x000001aa313b65c3: hlt
[Deopt Handler Code]
  0x000001aa313b65c4: mov     r10,1aa313b65c4h  ;   section_word
  0x000001aa313b65ce: push    r10
  0x000001aa313b65d0: jmp     1aa312f7600h      ;   runtime_call
  0x000001aa313b65d5: hlt
  0x000001aa313b65d6: hlt
  0x000001aa313b65d7: hlt
Decoding compiled method 0x000001aa313b5f50:
Code:
Argument 0 is unknown.RIP: 0x1aa313b60a0 Code size: 0x00000178
[Entry Point]
[Verified Entry Point]
[Constants]
  # method 0x000001aa45452e00 '<clinit>' '()V' in 'org/example/VolatileDemo'
  #           [sp+0x40]  (sp of caller)
  0x000001aa313b60a0: mov     dword ptr [rsp+0ffffffffffffa000h],eax
  0x000001aa313b60a7: push    rbp
  0x000001aa313b60a8: sub     rsp,30h           ;*iconst_0
                                                ; - org.example.VolatileDemo::<clinit>@0 (line 10)

  0x000001aa313b60ac: nop     dword ptr [rax+0h]
  0x000001aa313b60b0: jmp     1aa313b6124h      ;   no_reloc
  0x000001aa313b60b5: add     byte ptr [rax],al
  0x000001aa313b60b7: add     byte ptr [rax],al
  0x000001aa313b60b9: add     dh,al
  0x000001aa313b60bb: push    0ffffffffc4834800h  ;*putstatic stop
                                                ; - org.example.VolatileDemo::<clinit>@1 (line 10)

  0x000001aa313b60c1: xor     byte ptr [rbp+0ffffffffffffff85h],bl
                                                ;   poll_return
  0x000001aa313b60c4: add     eax,0fdaaa037h
  0x000001aa313b60c9: ret
  0x000001aa313b60ca: mov     rsi,0h            ;   oop(NULL)
  0x000001aa313b60d4: push    rax
  0x000001aa313b60d5: push    rbx
  0x000001aa313b60d6: mov     rbx,qword ptr [rsi+48h]
  0x000001aa313b60da: push    rdi
  0x000001aa313b60db: push    rsi
  0x000001aa313b60dc: push    rdx
  0x000001aa313b60dd: push    rcx
  0x000001aa313b60de: push    r8
  0x000001aa313b60e0: push    r9
  0x000001aa313b60e2: push    r10
  0x000001aa313b60e4: mov     r10,rsp
  0x000001aa313b60e7: and     rsp,0fffffffffffffff0h
  0x000001aa313b60eb: push    r10
  0x000001aa313b60ed: push    r11
  0x000001aa313b60ef: mov     ecx,1ch
  0x000001aa313b60f4: mov     r10,7ffc1ce95e40h  ;   runtime_call
  0x000001aa313b60fe: call indirect r10
  0x000001aa313b6101: pop     r11
  0x000001aa313b6103: pop     rsp
  0x000001aa313b6104: pop     r10
  0x000001aa313b6106: pop     r9
  0x000001aa313b6108: pop     r8
  0x000001aa313b610a: pop     rcx
  0x000001aa313b610b: pop     rdx
  0x000001aa313b610c: pop     rsi
  0x000001aa313b610d: pop     rdi
  0x000001aa313b610e: cmp     rax,qword ptr [rbx+118h]
  0x000001aa313b6115: pop     rbx
  0x000001aa313b6116: pop     rax
  0x000001aa313b6117: jne     1aa313b6124h
  0x000001aa313b611d: jmp     1aa313b60bah
  0x000001aa313b611f: mov     eax,0a505a00h
  0x000001aa313b6124: call    1aa313b1c20h      ; OopMapoff=137
                                                ;*putstatic stop
                                                ; - org.example.VolatileDemo::<clinit>@1 (line 10)
                                                ;   runtime_call
  0x000001aa313b6129: jmp     1aa313b60b0h
  0x000001aa313b612b: nop
  0x000001aa313b612c: nop
  0x000001aa313b612d: nop
  0x000001aa313b612e: nop
  0x000001aa313b612f: nop
  0x000001aa313b6130: mov     rax,qword ptr [r15+2b0h]
  0x000001aa313b6137: mov     r10,0h
  0x000001aa313b6141: mov     qword ptr [r15+2b0h],r10
  0x000001aa313b6148: mov     r10,0h
  0x000001aa313b6152: mov     qword ptr [r15+2b8h],r10
  0x000001aa313b6159: add     rsp,30h
  0x000001aa313b615d: pop     rbp
  0x000001aa313b615e: jmp     1aa31324060h      ;   runtime_call
  0x000001aa313b6163: hlt
  0x000001aa313b6164: hlt
  0x000001aa313b6165: hlt
  0x000001aa313b6166: hlt
  0x000001aa313b6167: hlt
  0x000001aa313b6168: hlt
  0x000001aa313b6169: hlt
  0x000001aa313b616a: hlt
  0x000001aa313b616b: hlt
  0x000001aa313b616c: hlt
  0x000001aa313b616d: hlt
  0x000001aa313b616e: hlt
  0x000001aa313b616f: hlt
  0x000001aa313b6170: hlt
  0x000001aa313b6171: hlt
  0x000001aa313b6172: hlt
  0x000001aa313b6173: hlt
  0x000001aa313b6174: hlt
  0x000001aa313b6175: hlt
  0x000001aa313b6176: hlt
  0x000001aa313b6177: hlt
  0x000001aa313b6178: hlt
  0x000001aa313b6179: hlt
  0x000001aa313b617a: hlt
  0x000001aa313b617b: hlt
  0x000001aa313b617c: hlt
  0x000001aa313b617d: hlt
  0x000001aa313b617e: hlt
  0x000001aa313b617f: hlt
[Exception Handler]
[Stub Code]
  0x000001aa313b6180: call    1aa313b3b60h      ;   no_reloc
  0x000001aa313b6185: mov     qword ptr [rsp+0ffffffffffffffd8h],rsp
  0x000001aa313b618a: sub     rsp,80h
  0x000001aa313b6191: mov     qword ptr [rsp+78h],rax
  0x000001aa313b6196: mov     qword ptr [rsp+70h],rcx
  0x000001aa313b619b: mov     qword ptr [rsp+68h],rdx
  0x000001aa313b61a0: mov     qword ptr [rsp+60h],rbx
  0x000001aa313b61a5: mov     qword ptr [rsp+50h],rbp
  0x000001aa313b61aa: mov     qword ptr [rsp+48h],rsi
  0x000001aa313b61af: mov     qword ptr [rsp+40h],rdi
  0x000001aa313b61b4: mov     qword ptr [rsp+38h],r8
  0x000001aa313b61b9: mov     qword ptr [rsp+30h],r9
  0x000001aa313b61be: mov     qword ptr [rsp+28h],r10
  0x000001aa313b61c3: mov     qword ptr [rsp+20h],r11
  0x000001aa313b61c8: mov     qword ptr [rsp+18h],r12
  0x000001aa313b61cd: mov     qword ptr [rsp+10h],r13
  0x000001aa313b61d2: mov     qword ptr [rsp+8h],r14
  0x000001aa313b61d7: mov     qword ptr [rsp],r15
  0x000001aa313b61db: mov     rcx,7313f980h     ;   external_word
  0x000001aa313b61e5: mov     rdx,1aa313b6185h  ;   internal_word
  0x000001aa313b61ef: mov     r8,rsp
  0x000001aa313b61f2: and     rsp,0fffffffffffffff0h
  0x000001aa313b61f6: mov     r10,72e1d730h     ;   runtime_call
  0x000001aa313b6200: call indirect r10
  0x000001aa313b6203: hlt
[Deopt Handler Code]
  0x000001aa313b6204: mov     r10,1aa313b6204h  ;   section_word
  0x000001aa313b620e: push    r10
  0x000001aa313b6210: jmp     1aa312f7600h      ;   runtime_call
  0x000001aa313b6215: hlt
  0x000001aa313b6216: hlt
  0x000001aa313b6217: hlt
Decoding compiled method 0x000001aa313b98d0:
Code:
Argument 0 is unknown.RIP: 0x1aa313b9a80 Code size: 0x00000510
[Entry Point]
[Verified Entry Point]
[Constants]
  # method 0x000001aa45452ca0 'main' '([Ljava/lang/String;)V' in 'org/example/VolatileDemo'
  # parm0:    rdx:rdx   = '[Ljava/lang/String;'
  #           [sp+0x40]  (sp of caller)
  0x000001aa313b9a80: mov     dword ptr [rsp+0ffffffffffffa000h],eax
  0x000001aa313b9a87: push    rbp
  0x000001aa313b9a88: sub     rsp,30h
  0x000001aa313b9a8c: mov     rsi,1aa45453180h  ;   metadata(method data for method 0x000001aa45452ca0 'main' '([Ljava/lang/String;)V' in 'org/example/VolatileDemo')
  0x000001aa313b9a96: mov     edi,dword ptr [rsi+0dch]
  0x000001aa313b9a9c: add     edi,8h
  0x000001aa313b9a9f: mov     dword ptr [rsi+0dch],edi
  0x000001aa313b9aa5: mov     rsi,1aa45452c98h  ;   metadata(method 0x000001aa45452ca0 'main' '([Ljava/lang/String;)V' in 'org/example/VolatileDemo')
  0x000001aa313b9aaf: and     edi,0h
  0x000001aa313b9ab2: cmp     edi,0h
  0x000001aa313b9ab5: je      1aa313b9d86h
  0x000001aa313b9abb: nop     dword ptr [rax+rax+0h]
  0x000001aa313b9ac0: jmp     1aa313b9dach      ;   no_reloc
  0x000001aa313b9ac5: add     byte ptr [rax],al
  0x000001aa313b9ac7: add     byte ptr [rax],al
  0x000001aa313b9ac9: add     byte ptr [rcx+0ffffffffffffff8bh],cl
  0x000001aa313b9acc: Fatal error: Disassembling failed with error code: 15Decoding compiled method 0x000001aa313b7d50:
Code:
Argument 0 is unknown.RIP: 0x1aa313b7e80 Code size: 0x00000038
[Entry Point]
[Verified Entry Point]
[Constants]
  # method 0x000001aa45452ca0 'main' '([Ljava/lang/String;)V' in 'org/example/VolatileDemo'
  # parm0:    rdx:rdx   = '[Ljava/lang/String;'
  #           [sp+0x20]  (sp of caller)
  0x000001aa313b7e80: mov     dword ptr [rsp+0ffffffffffffa000h],eax
  0x000001aa313b7e87: push    rbp
  0x000001aa313b7e88: sub     rsp,10h           ;*synchronization entry
                                                ; - org.example.VolatileDemo::main@-1 (line 13)

  0x000001aa313b7e8c: mov     edx,2h
  0x000001aa313b7e91: nop
  0x000001aa313b7e93: call    1aa312f57a0h      ; OopMapoff=24
                                                ;*new  ; - org.example.VolatileDemo::main@0 (line 13)
                                                ;   runtime_call
  0x000001aa313b7e98: int3                      ;*new  ; - org.example.VolatileDemo::main@0 (line 13)

  0x000001aa313b7e99: hlt
  0x000001aa313b7e9a: hlt
  0x000001aa313b7e9b: hlt
  0x000001aa313b7e9c: hlt
  0x000001aa313b7e9d: hlt
  0x000001aa313b7e9e: hlt
  0x000001aa313b7e9f: hlt
[Exception Handler]
[Stub Code]
  0x000001aa313b7ea0: jmp     1aa313213a0h      ;   no_reloc
[Deopt Handler Code]
  0x000001aa313b7ea5: call    1aa313b7eaah
  0x000001aa313b7eaa: sub     qword ptr [rsp],5h
  0x000001aa313b7eaf: jmp     1aa312f7600h      ;   runtime_call
  0x000001aa313b7eb4: hlt
  0x000001aa313b7eb5: hlt
  0x000001aa313b7eb6: hlt
  0x000001aa313b7eb7: hlt
Decoding compiled method 0x000001aa313b7290:
Code:
Argument 0 is unknown.RIP: 0x1aa313b73c0 Code size: 0x00000020
[Entry Point]
[Verified Entry Point]
  # method 0x000001aa4534de90 'linkToStatic' '(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/invoke/MemberName;)Ljava/lang/Object;' in 'java/lang/invoke/MethodHandle'
  # parm0:    rdx:rdx   = 'java/lang/Object'
  # parm1:    r8:r8     = 'java/lang/Object'
  # parm2:    r9:r9     = 'java/lang/Object'
  # parm3:    rdi:rdi   = 'java/lang/Object'
  # parm4:    rsi:rsi   = 'java/lang/Object'
  # parm5:    rcx:rcx   = 'java/lang/Object'
  # parm6:    [sp+0x0]   = 'java/lang/invoke/MemberName'  (sp of caller)
  0x000001aa313b73c0: mov     rbx,qword ptr [rsp+8h]
  0x000001aa313b73c5: mov     rbx,qword ptr [rbx+18h]
  0x000001aa313b73c9: test    rbx,rbx
  0x000001aa313b73cc: je      1aa313b73d5h
  0x000001aa313b73d2: jmp indirect qword ptr [rbx+40h]
  0x000001aa313b73d5: jmp     1aa312b52a0h      ;   runtime_call
  0x000001aa313b73da: hlt
  0x000001aa313b73db: hlt
  0x000001aa313b73dc: hlt
  0x000001aa313b73dd: hlt
  0x000001aa313b73de: hlt
  0x000001aa313b73df: hlt
Decoding compiled method 0x000001aa313b5b90:
Code:
Argument 0 is unknown.RIP: 0x1aa313b5cc0 Code size: 0x00000018
[Entry Point]
[Verified Entry Point]
  # method 0x000001aa453643f8 'linkToStatic' '(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/invoke/MemberName;)Ljava/lang/Object;' in 'java/lang/invoke/MethodHandle'
  # parm0:    rdx:rdx   = 'java/lang/Object'
  # parm1:    r8:r8     = 'java/lang/Object'
  # parm2:    r9:r9     = 'java/lang/Object'
  # parm3:    rdi:rdi   = 'java/lang/invoke/MemberName'
  #           [sp+0x0]  (sp of caller)
  0x000001aa313b5cc0: mov     rbx,qword ptr [rdi+18h]
  0x000001aa313b5cc4: test    rbx,rbx
  0x000001aa313b5cc7: je      1aa313b5cd0h
  0x000001aa313b5ccd: jmp indirect qword ptr [rbx+40h]
  0x000001aa313b5cd0: jmp     1aa312b52a0h      ;   runtime_call
  0x000001aa313b5cd5: hlt
  0x000001aa313b5cd6: hlt
  0x000001aa313b5cd7: hlt
Decoding compiled method 0x000001aa313c3310:
Code:
Argument 0 is unknown.RIP: 0x1aa313c3440 Code size: 0x00000018
[Entry Point]
[Verified Entry Point]
  # method 0x000001aa45366070 'linkToStatic' '(Ljava/lang/Object;Ljava/lang/invoke/MemberName;)Ljava/lang/Object;' in 'java/lang/invoke/MethodHandle'
  # parm0:    rdx:rdx   = 'java/lang/Object'
  # parm1:    r8:r8     = 'java/lang/invoke/MemberName'
  #           [sp+0x0]  (sp of caller)
  0x000001aa313c3440: mov     rbx,qword ptr [r8+18h]
  0x000001aa313c3444: test    rbx,rbx
  0x000001aa313c3447: je      1aa313c3450h
  0x000001aa313c344d: jmp indirect qword ptr [rbx+40h]
  0x000001aa313c3450: jmp     1aa312b52a0h      ;   runtime_call
  0x000001aa313c3455: hlt
  0x000001aa313c3456: hlt
  0x000001aa313c3457: hlt
Decoding compiled method 0x000001aa313c24d0:
Code:
Argument 0 is unknown.RIP: 0x1aa313c2600 Code size: 0x00000018
[Entry Point]
[Verified Entry Point]
  # method 0x000001aa45392598 'linkToStatic' '(Ljava/lang/Object;Ljava/lang/invoke/MemberName;)V' in 'java/lang/invoke/MethodHandle'
  # parm0:    rdx:rdx   = 'java/lang/Object'
  # parm1:    r8:r8     = 'java/lang/invoke/MemberName'
  #           [sp+0x0]  (sp of caller)
  0x000001aa313c2600: mov     rbx,qword ptr [r8+18h]
  0x000001aa313c2604: test    rbx,rbx
  0x000001aa313c2607: je      1aa313c2610h
  0x000001aa313c260d: jmp indirect qword ptr [rbx+40h]
  0x000001aa313c2610: jmp     1aa312b52a0h      ;   runtime_call
  0x000001aa313c2615: hlt
  0x000001aa313c2616: hlt
  0x000001aa313c2617: hlt
Decoding compiled method 0x000001aa313c2350:
Code:
Argument 0 is unknown.RIP: 0x1aa313c2480 Code size: 0x00000018
[Entry Point]
[Verified Entry Point]
  # method 0x000001aa453926f0 'linkToStatic' '(Ljava/lang/Object;Ljava/lang/invoke/MemberName;)J' in 'java/lang/invoke/MethodHandle'
  # parm0:    rdx:rdx   = 'java/lang/Object'
  # parm1:    r8:r8     = 'java/lang/invoke/MemberName'
  #           [sp+0x0]  (sp of caller)
  0x000001aa313c2480: mov     rbx,qword ptr [r8+18h]
  0x000001aa313c2484: test    rbx,rbx
  0x000001aa313c2487: je      1aa313c2490h
  0x000001aa313c248d: jmp indirect qword ptr [rbx+40h]
  0x000001aa313c2490: jmp     1aa312b52a0h      ;   runtime_call
  0x000001aa313c2495: hlt
  0x000001aa313c2496: hlt
  0x000001aa313c2497: hlt
Decoding compiled method 0x000001aa313c21d0:
Code:
Argument 0 is unknown.RIP: 0x1aa313c2300 Code size: 0x00000018
[Entry Point]
[Verified Entry Point]
  # method 0x000001aa45392808 'linkToStatic' '(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/invoke/MemberName;)Ljava/lang/Object;' in 'java/lang/invoke/MethodHandle'
  # parm0:    rdx:rdx   = 'java/lang/Object'
  # parm1:    r8:r8     = 'java/lang/Object'
  # parm2:    r9:r9     = 'java/lang/invoke/MemberName'
  #           [sp+0x0]  (sp of caller)
  0x000001aa313c2300: mov     rbx,qword ptr [r9+18h]
  0x000001aa313c2304: test    rbx,rbx
  0x000001aa313c2307: je      1aa313c2310h
  0x000001aa313c230d: jmp indirect qword ptr [rbx+40h]
  0x000001aa313c2310: jmp     1aa312b52a0h      ;   runtime_call
  0x000001aa313c2315: hlt
  0x000001aa313c2316: hlt
  0x000001aa313c2317: hlt
Decoding compiled method 0x000001aa313c2050:
Code:
Argument 0 is unknown.RIP: 0x1aa313c2180 Code size: 0x00000028
[Entry Point]
[Verified Entry Point]
  # method 0x000001aa45392920 'linkToVirtual' '(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/invoke/MemberName;)Ljava/lang/Object;' in 'java/lang/invoke/MethodHandle'
  # parm0:    rdx:rdx   = 'java/lang/Object'
  # parm1:    r8:r8     = 'java/lang/Object'
  # parm2:    r9:r9     = 'java/lang/invoke/MemberName'
  #           [sp+0x0]  (sp of caller)
  0x000001aa313c2180: mov     r10d,dword ptr [rdx+8h]
  0x000001aa313c2184: shl     r10,3h
  0x000001aa313c2188: mov     r11,qword ptr [r9+10h]
  0x000001aa313c218c: mov     rbx,qword ptr [r10+r11*8+1b8h]
  0x000001aa313c2194: test    rbx,rbx
  0x000001aa313c2197: je      1aa313c21a0h
  0x000001aa313c219d: jmp indirect qword ptr [rbx+40h]
  0x000001aa313c21a0: jmp     1aa312b52a0h      ;   runtime_call
  0x000001aa313c21a5: hlt
  0x000001aa313c21a6: hlt
  0x000001aa313c21a7: hlt
Decoding compiled method 0x000001aa313c3890:
Code:
Argument 0 is unknown.RIP: 0x1aa313c3a00 Code size: 0x000001f8
[Entry Point]
[Verified Entry Point]
[Constants]
  # method 0x000001aa45452d50 'lambda$main$0' '()V' in 'org/example/VolatileDemo'
  #           [sp+0x40]  (sp of caller)
  0x000001aa313c3a00: mov     dword ptr [rsp+0ffffffffffffa000h],eax
  0x000001aa313c3a07: push    rbp
  0x000001aa313c3a08: sub     rsp,30h
  0x000001aa313c3a0c: mov     rsi,1aa45453388h  ;   metadata(method data for method 0x000001aa45452d50 'lambda$main$0' '()V' in 'org/example/VolatileDemo')
  0x000001aa313c3a16: mov     edi,dword ptr [rsi+0dch]
  0x000001aa313c3a1c: add     edi,8h
  0x000001aa313c3a1f: mov     dword ptr [rsi+0dch],edi
  0x000001aa313c3a25: mov     rsi,1aa45452d48h  ;   metadata(method 0x000001aa45452d50 'lambda$main$0' '()V' in 'org/example/VolatileDemo')
  0x000001aa313c3a2f: and     edi,0h
  0x000001aa313c3a32: cmp     edi,0h
  0x000001aa313c3a35: je      1aa313c3ae5h      ;*iconst_0
                                                ; - org.example.VolatileDemo::lambda$main$0@0 (line 14)

  0x000001aa313c3a3b: mov     esi,0h
  0x000001aa313c3a40: jmp     1aa313c3a92h      ;*getstatic stop
                                                ; - org.example.VolatileDemo::lambda$main$0@2 (line 15)

  0x000001aa313c3a45: nop
  0x000001aa313c3a48: inc     esi
  0x000001aa313c3a4a: mov     rdi,1aa45453388h  ;   metadata(method data for method 0x000001aa45452d50 'lambda$main$0' '()V' in 'org/example/VolatileDemo')
  0x000001aa313c3a54: mov     ebx,dword ptr [rdi+0e0h]
  0x000001aa313c3a5a: add     ebx,8h
  0x000001aa313c3a5d: mov     dword ptr [rdi+0e0h],ebx
  0x000001aa313c3a63: mov     rdi,1aa45452d48h  ;   metadata(method 0x000001aa45452d50 'lambda$main$0' '()V' in 'org/example/VolatileDemo')
  0x000001aa313c3a6d: and     ebx,0fff8h
  0x000001aa313c3a73: cmp     ebx,0h
  0x000001aa313c3a76: je      1aa313c3afch      ; OopMapoff=124
                                                ;*goto
                                                ; - org.example.VolatileDemo::lambda$main$0@11 (line 16)

  0x000001aa313c3a7c: test    dword ptr [1aa2ee60100h],eax
                                                ;   poll
  0x000001aa313c3a82: mov     rdi,1aa45453388h  ;   metadata(method data for method 0x000001aa45452d50 'lambda$main$0' '()V' in 'org/example/VolatileDemo')
  0x000001aa313c3a8c: inc     dword ptr [rdi+128h]  ;*goto
                                                ; - org.example.VolatileDemo::lambda$main$0@11 (line 16)

  0x000001aa313c3a92: mov     rdi,0d60037e0h    ;   oop(a 'java/lang/Class' = 'org/example/VolatileDemo')
  0x000001aa313c3a9c: movsx   edi,byte ptr [rdi+68h]  ;*getstatic stop
                                                ; - org.example.VolatileDemo::lambda$main$0@2 (line 15)

  0x000001aa313c3aa0: cmp     edi,0h
  0x000001aa313c3aa3: mov     rdi,1aa45453388h  ;   metadata(method data for method 0x000001aa45452d50 'lambda$main$0' '()V' in 'org/example/VolatileDemo')
  0x000001aa313c3aad: mov     rbx,108h
  0x000001aa313c3ab7: jne     1aa313c3ac7h
  0x000001aa313c3abd: mov     rbx,118h
  0x000001aa313c3ac7: mov     rax,qword ptr [rdi+rbx]
  0x000001aa313c3acb: lea     rax,[rax+1h]
  0x000001aa313c3acf: mov     qword ptr [rdi+rbx],rax
  0x000001aa313c3ad3: je      1aa313c3a48h      ;*ifne
                                                ; - org.example.VolatileDemo::lambda$main$0@5 (line 15)

  0x000001aa313c3ad9: add     rsp,30h
  0x000001aa313c3add: pop     rbp
  0x000001aa313c3ade: test    dword ptr [1aa2ee60100h],eax
                                                ;   poll_return
  0x000001aa313c3ae4: ret
  0x000001aa313c3ae5: mov     qword ptr [rsp+8h],rsi
  0x000001aa313c3aea: mov     qword ptr [rsp],0ffffffffffffffffh
  0x000001aa313c3af2: call    1aa313b4160h      ; OopMapoff=247
                                                ;*synchronization entry
                                                ; - org.example.VolatileDemo::lambda$main$0@-1 (line 14)
                                                配置VM Options查看Java代码的汇编指令

配置VM Options查看Java代码的汇编指令

查看Java代码对应的汇编指令又一利器,JITWatch 转

多线程&高并发查看Java代码对应的汇编指令教程

java查看运行代码的汇编指令(含hsdis-arm64.dll文件)

汇编设计实验1