RFR: 8241067: Shenandoah: improve ShenandoahNMethod::has_cset_oops arguments

Aditya Mandaleeka adityam at microsoft.com
Tue Mar 24 03:13:26 UTC 2020


RFE:
  https://bugs.openjdk.java.net/browse/JDK-8241067

Webrev:
  https://cr.openjdk.java.net/~adityam/8241067/webrev.00/

This changes the ShenandoahHasCSetOopClosure constructor to take in the ShenandoahHeap* as an
argument, and also changes ShenandoahNMethod::has_cset_oops to actually pass through the
ShenandoahHeap* that it's passed.

The effect of this is that we eliminate an extra call to get the heap. Here's the relevant snippet
of the start of has_cset_oops that shows the diff on an x86-64 release build.

=== BEFORE ===
    push   %rbp
    mov    %rsp,%rbp
    push   %r15
    push   %r14
    push   %r13
    push   %r12
    push   %rbx
    mov    %rdi,%rbx
    sub    $0x8,%rsp
    callq  0x7ffff696ef50 <_ZN14ShenandoahHeap4heapEv>
    mov    %rax,%r13

The call to get the heap involves:
    lea    0x8477d1(%rip),%rax        # 0x7ffff71b6728 <_ZN8Universe14_collectedHeapE>
    push   %rbp
    mov    %rsp,%rbp
    mov    (%rax),%rax
    pop    %rbp
    retq


=== AFTER ===
    push   %rbp
    mov    %rsp,%rbp
    push   %r15
    push   %r14
    push   %r13
    push   %r12
    mov    %rsi,%r13

%rsi is the heap* in the 'after' version. As you can see, it's immediately stored in r13 right after the function
prolog. The rest of the code in the function is pretty identical.

I also checked that the caller to this function (ShenandoahNMethodTableSnapshot::parallel_blobs_do)
is not jumping through extra hoops to retrieve the heap* at the callsite-- it is already available there
as a member.

Thanks,
Aditya


More information about the shenandoah-dev mailing list