8347564: ZGC: Crash in DependencyContext::clean_unloading_dependents

Reviewed-by: eosterlund, stefank, vlivanov
This commit is contained in:
Axel Boldt-Christmas 2025-01-30 08:33:16 +00:00
parent 04c24f18d5
commit 14136f8b11
13 changed files with 25 additions and 160 deletions

View file

@ -138,12 +138,6 @@ abstract sealed class CallSite permits ConstantCallSite, MutableCallSite, Volati
UNSAFE.storeStoreFence(); // barrier between target and isFrozen updates
}
/**
* {@code CallSite} dependency context.
* JVM uses CallSite.context to store nmethod dependencies on the call site target.
*/
private final MethodHandleNatives.CallSiteContext context = MethodHandleNatives.CallSiteContext.make(this);
/**
* Returns the type of this call site's target.
* Although targets may change, any call site's type is permanent, and can never change to an unequal type.

View file

@ -71,31 +71,6 @@ class MethodHandleNatives {
boolean resolve,
Object ifNotAvailable);
/** Represents a context to track nmethod dependencies on CallSite instance target. */
static class CallSiteContext implements Runnable {
//@Injected JVM_nmethodBucket* vmdependencies;
//@Injected jlong last_cleanup;
static CallSiteContext make(CallSite cs) {
final CallSiteContext newContext = new CallSiteContext();
// CallSite instance is tracked by a Cleanable which clears native
// structures allocated for CallSite context. Though the CallSite can
// become unreachable, its Context is retained by the Cleanable instance
// (which is referenced from Cleaner instance which is referenced from
// CleanerFactory class) until cleanup is performed.
CleanerFactory.cleaner().register(cs, newContext);
return newContext;
}
@Override
public void run() {
MethodHandleNatives.clearCallSiteContext(this);
}
}
/** Invalidate all recorded nmethods. */
private static native void clearCallSiteContext(CallSiteContext context);
private static native void registerNatives();
static {
registerNatives();