You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
wrapObjectIterationCallback called in jvmtiIterateOverReachableObjects uses event->type to differentiate reference kind and which callback to use which uses (J9WalkState *) referrer casting for stack type.
Previously GC would report JNI local refs in the first 16 slots as STACK_LOCAL (stored on the NativeCallout frame) and any after that as JNI_LOCAL (frame stored in the jniLocalReferences list). The JVMTI code is required to correct JNI refs reported as STACK_LOCAL before calling user stack ref callback while JNI_LOCAL would be incorrectly sent to user's heap root callback.
@fengxue-IS For 0.48, this issue will need to be resolved by the end of this week. What's the current state of this issue? Based on this issue's impact, do we need it to be fixed in 0.48 or can it be pushed to 0.49?
The issue is a legacy one, so it doesn't need to be fixed in 0.48, but I should be the PR comments addressed today, so we can decide to push to 0.49 or not based on the review result.
Based on discussion from #18394:
wrapObjectIterationCallback
called injvmtiIterateOverReachableObjects
usesevent->type
to differentiate reference kind and which callback to use which uses(J9WalkState *) referrer
casting for stack type.Previously GC would report JNI local refs in the first 16 slots as STACK_LOCAL (stored on the NativeCallout frame) and any after that as JNI_LOCAL (frame stored in the jniLocalReferences list). The JVMTI code is required to correct JNI refs reported as STACK_LOCAL before calling user stack ref callback while JNI_LOCAL would be incorrectly sent to user's heap root callback.
With the code change from #18378 and #18379, all JNI locals should be correctly reported, but since they still map to J9JVMTI_HEAP_EVENT_ROOT, this cause call jni refs to be sent to user's heap root callback which doesn't match the JVMTI spec https://docs.oracle.com/en/java/javase/21/docs/specs/jvmti.html#IterateOverReachableObjects
Changes required:
J9GC_ROOT_TYPE_JNI_LOCAL
toJ9JVMTI_HEAP_EVENT_STACK
wrapObjectIterationCallback
to correctly handle jni refs that doesn't come from stack walkingprocessStackRoot
code to first recognize references kind rather than relying on walkState.I will create a draft PR on the above changes as a starting point for further discussion.
FYI @LinHu2016 @amicic @babsingh @keithc-ca
The text was updated successfully, but these errors were encountered: