[sh/8u] Root processing related backports

Aleksey Shipilev shade at redhat.com
Fri May 15 11:56:47 UTC 2020


On 5/13/20 9:10 PM, Zhengyu Gu wrote:
>> JDK-8189360 is not backported. Look in JNIHandleBlock::weak_oops_do:
>>
>>    /*
>>     * JVMTI data structures may also contain weak oops.  The iteration of them
>>     * is placed here so that we don't need to add it to each of the collectors.
>>     */
>>    JvmtiExport::weak_oops_do(is_alive, f);
> 
> Looked at wrong place. Okay, recovered to original form and added comments:
> 
>    // When we're done marking everything, we process weak references.
>    // It is not obvious, but reference processing actually calls
>    // JNIHandle::weak_oops_do() to cleanup JNI and JVMTI weak oops.
>    if (_heap->process_references()) {
>      weak_refs_work(full_gc);
>    } else {
>      weak_roots_work();
>    }
> 
> Updated: 
> http://cr.openjdk.java.net/~zgu/shenandoah/sh-8u-root-processing/webrev.03/

Okay, this looks good.

To follow-through the 8u insanity for double-checking, let's look at ShenandoahRootEvacuator. It does:
  ShenandoahSerialRoots           _serial_roots;
  ShenandoahWeakRoots             _weak_roots;

ShenadoahSerialRoots does:
  _jni_handle_roots(&JNIHandles::oops_do, ShenandoahPhaseTimings::JNIRoots),
  _jvmti_roots(&JvmtiExport::oops_do, ShenandoahPhaseTimings::JVMTIRoots),

...and neither JNIHandles::oops_do nor JvmtiExport::oops_do visits JvmtiExport::weak_oops_do, or do
something similar to it, e.g. JvmtiTagMap::weak_oops_do.

ShenandoahWeakRoots does:
  _jni_weak_roots(&JNIHandles::weak_oops_do)

...which eventually enters JNIHandleBlock::weak_oops_do, which then does JvmtiExport::weak_oops_do.

-- 
Thanks,
-Aleksey



More information about the shenandoah-dev mailing list