8204267 - Generate comments in -XX:+PrintInterpreter to link to source code
Ioi Lam
ioi.lam at oracle.com
Mon Jun 4 07:12:48 UTC 2018
Hi Folks,
I've found it very hard to understand the assembler code printed by
-XX:+PrintInterpreter. Since the C++ source code that generates the
interpreter is fairly well documented, it might be a good idea to print
out the source code along with the assembler code.
I've done a quick proof-of-concept by hacking the "__" macro that's used
throughout the CPU-dependent sources.
Please let me know if you think this is worth doing. If so, I will try
to finish it up and post a real RFR.
Thanks
- Ioi
https://bugs.openjdk.java.net/browse/JDK-8204267
http://cr.openjdk.java.net/~iklam/misc/8204267-print-interpreter-comments.v00
http://cr.openjdk.java.net/~iklam/misc/8204267-print-interpreter-comments.v00/hs_interp.S
Here are some examples (if the mailer screws up the long lines, please
click the above link):
ifeq 153 ifeq [0x00007f830cc93da0, 0x00007f830cc941c0] 1056 bytes
mov (%rsp),%eax
add $0x8,%rsp
test %eax,%eax ;; 2353: __ testl(rax, rax);
jne 0x00007f830cc94177 ;; 2354: __ jcc(j_not(cc), not_taken);
mov -0x18(%rbp),%rcx ;; 2120: __ get_method(rcx); // rcx holds
method
mov -0x28(%rbp),%rax ;; 2121: __ profile_taken_branch(rax, rbx);
// rax holds updated MDP, rbx
test %rax,%rax
je 0x00007f830cc93dd8
mov 0x8(%rax),%rbx
add $0x1,%rbx
sbb $0x0,%rbx
mov %rbx,0x8(%rax)
add 0x10(%rax),%rax
mov %rax,-0x28(%rbp)
movswl 0x1(%r13),%edx ;; 2133: __ load_signed_short(rdx,
at_bcp(1));
bswap %edx ;; 2135: __ bswapl(rdx);
sar $0x10,%edx ;; 2138: __ sarl(rdx, 16);
movslq %edx,%rdx ;; 2140: LP64_ONLY(__ movl2ptr(rdx, rdx));
add %rdx,%r13 ;; 2164: __ addptr(rbcp, rdx);
test %edx,%edx ;; 2179: __ testl(rdx, rdx);
// check if forward or backward branch
jns 0x00007f830cc93eec ;; 2180: __ jcc(Assembler::positive,
dispatch); // count only if backward branch
mov 0x18(%rcx),%rax ;; 2184: __ movptr(rax, Address(rcx,
Method::method_counters_offset()));
test %rax,%rax ;; 2185: __ testptr(rax, rax);
jne 0x00007f830cc93ead ;; 2186: __ jcc(Assembler::notZero,
has_counters);
push %rdx ;; 2187: __ push(rdx);
push %rcx ;; 2188: __ push(rcx);
callq 0x00007f830cc93e09 ;; 2189: __ call_VM(noreg,
CAST_FROM_FN_PTR(address, InterpreterRuntime::build_method_counters),
More information about the hotspot-dev
mailing list