(gdb) x/30i 0x7fffe10176ab
0x7fffe10176ab: mov -0x18(%rbp),%rcx ## __ get_method(rcx); // rcx holds method , rbp-0x18 就是方法地址
0x7fffe10176af: mov -0x28(%rbp),%rax ## __ profile_taken_branch(rax, rbx); // rax holds updated MDP, rbx 一直到 0x7fffe10176d0都是profile_taken_branch
0x7fffe10176b3: test %rax,%rax
0x7fffe10176b6: je 0x7fffe10176d4
0x7fffe10176bc: mov 0x8(%rax),%rbx
0x7fffe10176c0: add $0x1,%rbx
0x7fffe10176c4: sbb $0x0,%rbx
0x7fffe10176c8: mov %rbx,0x8(%rax)
0x7fffe10176cc: add 0x10(%rax),%rax
0x7fffe10176d0: mov %rax,-0x28(%rbp)
0x7fffe10176d4: movswl 0x1(%r13),%edx ## __ movl(rdx, at_bcp(1)); r13指向当前要取的字节码指令的地址
0x7fffe10176d9: bswap %edx ##__ bswapl(rdx);
0x7fffe10176db: sar $0x10,%edx ## __ sarl(rdx, 16);
0x7fffe10176de: movslq %edx,%rdx ## LP64_ONLY(__ movl2ptr(rdx, rdx));
0x7fffe10176e1: add %rdx,%r13 ## __ addptr(rbcp, rdx); // Adjust the bcp in r13 by the displacement in rdx
0x7fffe10176e4: test %edx,%edx ## 判断是不是 0 ,是0 就ZF=1 ,SF
0x7fffe10176e6: jns 0x7fffe10176ec ## 大于等于0 , 跳转到0x7fffe10176ec
0x7fffe10176ec: mov 0x20(%rcx),%rax
0x7fffe10176ec: mov 0x20(%rcx),%rax ## __ movptr(rax, Address(rcx, Method::method_counters_offset()));
0x7fffe10176f0: test %rax,%rax ## __ testptr(rax, rax);
0x7fffe10176f3: jne 0x7fffe10176f9 ## ZF!=0 跳转, 也就是rax >0 跳转 __ jcc(Assembler::notZero, has_counters);
0x7fffe10176f9: push %rdx ## __ push(rdx);
0x7fffe10176fa: push %rcx ## __ push(rcx);
0x7fffe10176fb: call 0x7fffe1017705 ## begin , __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::build_method_counters),
rcx); 一直到0x7fffe1017828
0x7fffe1017700: jmp 0x7fffe1017829
0x7fffe1017705: mov %rcx,%rsi
0x7fffe1017708: lea 0x8(%rsp),%rax
0x7fffe101770d: mov %r13,-0x40(%rbp)
0x7fffe1017711: cmpq $0x0,-0x10(%rbp)
0x7fffe1017719: je 0x7fffe1017733
0x7fffe101771f: movabs $0x7ffff71becc8,%rdi
0x7fffe1017729: and $0xfffffffffffffff0,%rsp
0x7fffe101772d:
call 0x7ffff694f3c0 <_ZN14MacroAssembler7debug64EPclPl>
0x7fffe1017732: hlt
0x7fffe1017733: push %r10
0x7fffe1017735:
cmp 0x16aef7c4(%rip),%r12 # 0x7ffff7b06f00 <_ZN14CompressedOops11_narrow_oopE>
0x7fffe101773c: je 0x7fffe1017756
0x7fffe1017742: movabs $0x7ffff7311c28,%rdi
0x7fffe101774c: and $0xfffffffffffffff0,%rsp
0x7fffe1017750:
call 0x7ffff694f3c0 <_ZN14MacroAssembler7debug64EPclPl>
0x7fffe1017755: hlt
0x7fffe1017756: pop %r10
0x7fffe1017758: mov %r15,%rdi
0x7fffe101775b: vzeroupper
0x7fffe101775e: mov %rbp,0x2d0(%r15)
0x7fffe1017765: mov %rax,0x2c0(%r15)
0x7fffe101776c: test $0xf,%esp
0x7fffe1017772: je 0x7fffe101778a
0x7fffe1017778: sub $0x8,%rsp
0x7fffe101777c:
call 0x7ffff65d4a46 <_ZN18InterpreterRuntime21build_method_countersEP10JavaThreadP6Method>
0x7fffe1017781: add $0x8,%rsp
0x7fffe1017785: jmp 0x7fffe101778f
0x7fffe101778a:
call 0x7ffff65d4a46 <_ZN18InterpreterRuntime21build_method_countersEP10JavaThreadP6Method>
0x7fffe101778f: push %rax
0x7fffe1017790: push %rdi
0x7fffe1017791: push %rsi
0x7fffe1017792: push %rdx
0x7fffe1017793: push %rcx
0x7fffe1017794: push %r8
0x7fffe1017796: push %r9
0x7fffe1017798: push %r10
0x7fffe101779a: push %r11
0x7fffe101779c: test $0xf,%esp
0x7fffe10177a2: je 0x7fffe10177ba
0x7fffe10177a8: sub $0x8,%rsp
0x7fffe10177ac: call 0x7ffff5d1c04e <_ZN6Thread7currentEv>
0x7fffe10177b1: add $0x8,%rsp
0x7fffe10177b5: jmp 0x7fffe10177bf
0x7fffe10177ba: call 0x7ffff5d1c04e <_ZN6Thread7currentEv>
0x7fffe10177bf: pop %r11
0x7fffe10177c1: pop %r10
0x7fffe10177c3: pop %r9
0x7fffe10177c5: pop %r8
0x7fffe10177c7: pop %rcx
0x7fffe10177c8: pop %rdx
0x7fffe10177c9: pop %rsi
0x7fffe10177ca: pop %rdi
0x7fffe10177cb: cmp %rax,%r15
0x7fffe10177ce: je 0x7fffe10177e8
0x7fffe10177d4: movabs $0x7ffff7311da0,%rdi
0x7fffe10177de: and $0xfffffffffffffff0,%rsp
0x7fffe10177e2:
call 0x7ffff694f3c0 <_ZN14MacroAssembler7debug64EPclPl>
0x7fffe10177e7: hlt
0x7fffe10177e8: pop %rax
0x7fffe10177e9: movq $0x0,0x2c0(%r15)
0x7fffe10177f4: movq $0x0,0x2d0(%r15)
0x7fffe10177ff: movq $0x0,0x2c8(%r15)
0x7fffe101780a: vzeroupper
0x7fffe101780d: cmpq $0x0,0x8(%r15)
0x7fffe1017815: je 0x7fffe1017820
0x7fffe101781b: jmp 0x7fffe1000c20
0x7fffe1017820: mov -0x40(%rbp),%r13
0x7fffe1017824: mov -0x38(%rbp),%r14
0x7fffe1017828: ret ### end __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::build_method_counters),
rcx);
0x7fffe1017829: pop %rcx ### __ pop(rcx);
0x7fffe101782a: pop %rdx ## __ pop(rdx);
0x7fffe101782b: mov 0x20(%rcx),%rax ## __ movptr(rax, Address(rcx, Method::method_counters_offset()));
0x7fffe101782f: test %rax,%rax ## __ testptr(rax, rax);
0x7fffe1017832: je 0x7fffe1017838 ## __ jcc(Assembler::zero, dispatch);
0x7fffe1017838: mov 0x18(%rcx),%rbx ## __ movptr(rbx, Address(rcx, in_bytes(Method::method_data_offset()))); // Are we profiling?
0x7fffe101783c: test %rbx,%rbx ## __ testptr(rbx, rbx);
0x7fffe101783f: je 0x7fffe1017841 ## __ jccb(Assembler::zero, no_mdo);
0x7fffe1017841: mov 0x130(%rbx),%eax ## 一直到0x7fffe1017856 都是 __ increment_mask_and_jump(mdo_backedge_counter, increment, mask, rax, false, Assembler::zero,
UseOnStackReplacement ? &backedge_counter_overflow : NULL);
0x7fffe1017847: add $0x2,%eax
0x7fffe101784a: mov %eax,0x130(%rbx)
0x7fffe1017850: and 0x144(%rbx),%eax
0x7fffe1017856: je 0x7fffe101785c
0x7fffe101785c: jmp 0x7fffe1017861 ## __ jmp(dispatch);
0x7fffe1017861: mov 0x20(%rcx),%rcx ## __ movptr(rcx, Address(rcx, Method::method_counters_offset()));
0x7fffe1017865: mov 0x10(%rcx),%eax ### __ increment_mask_and_jump(Address(rcx, be_offset), increment, mask,rax, false, Assembler::zero, UseOnStackReplacement ? &backedge_counter_overflow : NULL);
0x7fffe1017868: add $0x2,%eax
0x7fffe101786b: mov %eax,0x10(%rcx)
0x7fffe101786e: and 0x2c(%rcx),%eax
0x7fffe1017871: je 0x7fffe1017877
0x7fffe1017877: movzbl 0x0(%r13),%ebx ### // Pre-load the next target bytecode into rbx __ load_unsigned_byte(rbx, Address(rbcp, 0));
0x7fffe101787c: testb $0x1,0x388(%r15) ### // continue with the bytecode @ target
### // rax: return bci for jsr's, unused otherwise
###// rbx: target bytecode
###// r13: target bcp
### // __ dispatch_only(vtos, true); 从0x7fffe101787c 到 0x7fffe101789c
0x7fffe1017884: je 0x7fffe1017892
0x7fffe1017886: movabs $0x7ffff7bd68a0,%r10
0x7fffe1017890: jmp 0x7fffe101789c
0x7fffe1017892: movabs $0x7ffff7bcc8a0,%r10
0x7fffe101789c: jmp *(%r10,%rbx,8)
0x7fffe10178a0: neg %rdx ## __ negptr(rdx);
0x7fffe10178a3: add %r13,%rdx ## __ addptr(rdx, rbcp); // branch bcp
0x7fffe10178a6: call 0x7fffe10178b0 ## 从 0x7fffe10178a6 到0x7fffe10179d3 都是call_VM
## __ call_VM(noreg,
## CAST_FROM_FN_PTR(address,
## InterpreterRuntime::frequency_counter_overflow),
## rdx);
0x7fffe10178ab: jmp 0x7fffe10179d4
0x7fffe10178b0: mov %rdx,%rsi
0x7fffe10178b3: lea 0x8(%rsp),%rax
0x7fffe10178b8: mov %r13,-0x40(%rbp)
0x7fffe10178bc: cmpq $0x0,-0x10(%rbp)
0x7fffe10178c4: je 0x7fffe10178de
0x7fffe10178ca: movabs $0x7ffff71becc8,%rdi
0x7fffe10178d4: and $0xfffffffffffffff0,%rsp
0x7fffe10178d8: call 0x7ffff694f3c0 <_ZN14MacroAssembler7debug64EPclPl>
0x7fffe10178dd: hlt
0x7fffe10178de: push %r10
0x7fffe10178e0: cmp 0x16aef619(%rip),%r12 # 0x7ffff7b06f00 <_ZN14CompressedOops11_narrow_oopE>
0x7fffe10178e7: je 0x7fffe1017901
0x7fffe10178ed: movabs $0x7ffff7311c28,%rdi
0x7fffe10178f7: and $0xfffffffffffffff0,%rsp
0x7fffe10178fb: call 0x7ffff694f3c0 <_ZN14MacroAssembler7debug64EPclPl>
0x7fffe1017900: hlt
0x7fffe1017901: pop %r10
0x7fffe1017903: mov %r15,%rdi
0x7fffe1017906: vzeroupper
0x7fffe1017909: mov %rbp,0x2d0(%r15)
0x7fffe1017910: mov %rax,0x2c0(%r15)
0x7fffe1017917: test $0xf,%esp
0x7fffe101791d: je 0x7fffe1017935
0x7fffe1017923: sub $0x8,%rsp
0x7fffe1017927: call 0x7ffff65d3eb4 <_ZN18InterpreterRuntime26frequency_counter_overflowEP10JavaThreadPh>
0x7fffe101792c: add $0x8,%rsp
0x7fffe1017930: jmp 0x7fffe101793a
0x7fffe1017935: call 0x7ffff65d3eb4 <_ZN18InterpreterRuntime26frequency_counter_overflowEP10JavaThreadPh>
0x7fffe101793a: push %rax
0x7fffe101793b: push %rdi
0x7fffe101793c: push %rsi
0x7fffe101793d: push %rdx
0x7fffe101793e: push %rcx
0x7fffe101793f: push %r8
0x7fffe1017941: push %r9
0x7fffe1017943: push %r10
0x7fffe1017945: push %r11
0x7fffe1017947: test $0xf,%esp
0x7fffe101794d: je 0x7fffe1017965
0x7fffe1017953: sub $0x8,%rsp
0x7fffe1017957: call 0x7ffff5d1c04e <_ZN6Thread7currentEv>
0x7fffe101795c: add $0x8,%rsp
0x7fffe1017960: jmp 0x7fffe101796a
0x7fffe1017965: call 0x7ffff5d1c04e <_ZN6Thread7currentEv>
0x7fffe101796a: pop %r11
0x7fffe101796c: pop %r10
0x7fffe101796e: pop %r9
0x7fffe1017970: pop %r8
0x7fffe1017972: pop %rcx
0x7fffe1017973: pop %rdx
0x7fffe1017974: pop %rsi
0x7fffe1017975: pop %rdi
0x7fffe1017976: cmp %rax,%r15
0x7fffe1017979: je 0x7fffe1017993
0x7fffe101797f: movabs $0x7ffff7311da0,%rdi
0x7fffe1017989: and $0xfffffffffffffff0,%rsp
0x7fffe101798d: call 0x7ffff694f3c0 <_ZN14MacroAssembler7debug64EPclPl>
0x7fffe1017992: hlt
0x7fffe1017993: pop %rax
0x7fffe1017994: movq $0x0,0x2c0(%r15)
0x7fffe101799f: movq $0x0,0x2d0(%r15)
0x7fffe10179aa: movq $0x0,0x2c8(%r15)
0x7fffe10179b5: vzeroupper
0x7fffe10179b8: cmpq $0x0,0x8(%r15)
0x7fffe10179c0: je 0x7fffe10179cb
0x7fffe10179c6: jmp 0x7fffe1000c20
0x7fffe10179cb: mov -0x40(%rbp),%r13
0x7fffe10179cf: mov -0x38(%rbp),%r14
0x7fffe10179d3: ret
## // rax: osr nmethod (osr ok) or NULL (osr not possible)
## // rdx: scratch
## // r14: locals pointer
## // r13: bcp
0x7fffe10179d4: test %rax,%rax ## __ testptr(rax, rax); // test result
0x7fffe10179d7: je 0x7fffe1017877 ## __ jcc(Assembler::zero, dispatch); // no osr if null
0x7fffe10179dd: cmpb $0x0,0x14b(%rax) ## // nmethod may have been invalidated (VM may block upon call_VM return) __ cmpb(Address(rax, nmethod::state_offset()), nmethod::in_use);
0x7fffe10179e4: jne 0x7fffe1017877 ## __ jcc(Assembler::notEqual, dispatch);
### // We have the address of an on stack replacement routine in rax.
### // In preparation of invoking it, first we must migrate the locals
### // and monitors from off the interpreter frame on the stack.
### // Ensure to save the osr nmethod over the migration call,
### // it will be preserved in rbx.
0x7fffe10179ea: mov %rax,%rbx ### __ mov(rbx, rax);
0x7fffe10179ed: call 0x7fffe10179f7 ### 从 0x7fffe10179ed 0x7fffe1017b17 都是 call_VM(noreg, CAST_FROM_FN_PTR(address, SharedRuntime::OSR_migration_begin));
0x7fffe10179f2: jmp 0x7fffe1017b18
0x7fffe10179f7: lea 0x8(%rsp),%rax
0x7fffe10179fc: mov %r13,-0x40(%rbp)
0x7fffe1017a00: cmpq $0x0,-0x10(%rbp)
0x7fffe1017a08: je 0x7fffe1017a22
0x7fffe1017a0e: movabs $0x7ffff71becc8,%rdi
0x7fffe1017a18: and $0xfffffffffffffff0,%rsp
0x7fffe1017a1c: call 0x7ffff694f3c0 <_ZN14MacroAssembler7debug64EPclPl>
0x7fffe1017a21: hlt
0x7fffe1017a22: push %r10
0x7fffe1017a24: cmp 0x16aef4d5(%rip),%r12 # 0x7ffff7b06f00 <_ZN14CompressedOops11_narrow_oopE>
0x7fffe1017a2b: je 0x7fffe1017a45
0x7fffe1017a31: movabs $0x7ffff7311c28,%rdi
0x7fffe1017a3b: and $0xfffffffffffffff0,%rsp
0x7fffe1017a3f: call 0x7ffff694f3c0 <_ZN14MacroAssembler7debug64EPclPl>
0x7fffe1017a44: hlt
0x7fffe1017a45: pop %r10
0x7fffe1017a47: mov %r15,%rdi
0x7fffe1017a4a: vzeroupper
0x7fffe1017a4d: mov %rbp,0x2d0(%r15)
0x7fffe1017a54: mov %rax,0x2c0(%r15)
0x7fffe1017a5b: test $0xf,%esp
0x7fffe1017a61: je 0x7fffe1017a79
0x7fffe1017a67: sub $0x8,%rsp
0x7fffe1017a6b: call 0x7ffff6bcdb22 <_ZN13SharedRuntime19OSR_migration_beginEP10JavaThread>
0x7fffe1017a70: add $0x8,%rsp
0x7fffe1017a74: jmp 0x7fffe1017a7e
0x7fffe1017a79: call 0x7ffff6bcdb22 <_ZN13SharedRuntime19OSR_migration_beginEP10JavaThread>
0x7fffe1017a7e: push %rax
0x7fffe1017a7f: push %rdi
0x7fffe1017a80: push %rsi
0x7fffe1017a81: push %rdx
0x7fffe1017a82: push %rcx
0x7fffe1017a83: push %r8
0x7fffe1017a85: push %r9
0x7fffe1017a87: push %r10
0x7fffe1017a89: push %r11
0x7fffe1017a8b: test $0xf,%esp
0x7fffe1017a91: je 0x7fffe1017aa9
0x7fffe1017a97: sub $0x8,%rsp
0x7fffe1017a9b: call 0x7ffff5d1c04e <_ZN6Thread7currentEv>
0x7fffe1017aa0: add $0x8,%rsp
0x7fffe1017aa4: jmp 0x7fffe1017aae
0x7fffe1017aa9: call 0x7ffff5d1c04e <_ZN6Thread7currentEv>
0x7fffe1017aae: pop %r11
0x7fffe1017ab0: pop %r10
0x7fffe1017ab2: pop %r9
0x7fffe1017ab4: pop %r8
0x7fffe1017ab6: pop %rcx
0x7fffe1017ab7: pop %rdx
0x7fffe1017ab8: pop %rsi
0x7fffe1017ab9: pop %rdi
0x7fffe1017aba: cmp %rax,%r15
0x7fffe1017abd: je 0x7fffe1017ad7
0x7fffe1017ac3: movabs $0x7ffff7311da0,%rdi
0x7fffe1017acd: and $0xfffffffffffffff0,%rsp
0x7fffe1017ad1: call 0x7ffff694f3c0 <_ZN14MacroAssembler7debug64EPclPl>
0x7fffe1017ad6: hlt
0x7fffe1017ad7: pop %rax
0x7fffe1017ad8: movq $0x0,0x2c0(%r15)
0x7fffe1017ae3: movq $0x0,0x2d0(%r15)
0x7fffe1017aee: movq $0x0,0x2c8(%r15)
0x7fffe1017af9: vzeroupper
0x7fffe1017afc: cmpq $0x0,0x8(%r15)
0x7fffe1017b04: je 0x7fffe1017b0f
0x7fffe1017b0a: jmp 0x7fffe1000c20
0x7fffe1017b0f: mov -0x40(%rbp),%r13
0x7fffe1017b13: mov -0x38(%rbp),%r14
0x7fffe1017b17: ret
0x7fffe1017b18: mov %rax,%rsi ## LP64_ONLY(__ mov(j_rarg0, rax));
0x7fffe1017b1b: mov -0x8(%rbp),%rdx ## __ movptr(sender_sp, Address(rbp, frame::interpreter_frame_sender_sp_offset * wordSize)); // get sender sp
0x7fffe1017b1f: leave ## __ leave(); // remove frame anchor
0x7fffe1017b20: pop %rcx ## __ pop(retaddr); // get return address
0x7fffe1017b21: mov %rdx,%rsp ## __ mov(rsp, sender_sp); // set sp to sender sp
0x7fffe1017b24: and $0xfffffffffffffff0,%rsp ## // Ensure compiled code always sees stack at proper alignment __ andptr(rsp, -(StackAlignmentInBytes));
0x7fffe1017b28: push %rcx ## // push the return address __ push(retaddr);
0x7fffe1017b29: jmp *0xf8(%rbx) ## __ jmp(Address(rbx, nmethod::osr_entry_point_offset()));