< prev index next >

src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java

Print this page

        

@@ -28,11 +28,11 @@
 import java.lang.invoke.MethodHandles.Lookup;
 import java.lang.reflect.Field;
 import static java.lang.invoke.MethodHandleNatives.Constants.*;
 import static java.lang.invoke.MethodHandleStatics.*;
 import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
-import jdk.internal.ref.Cleaner;
+import jdk.internal.ref.CleanerFactory;
 
 /**
  * The JVM interface for the method handles package is all here.
  * This is an interface internal and private to an implementation of JSR 292.
  * <em>This class is not part of the JSR 292 standard.</em>

@@ -66,14 +66,16 @@
     static class CallSiteContext implements Runnable {
         //@Injected JVM_nmethodBucket* vmdependencies;
 
         static CallSiteContext make(CallSite cs) {
             final CallSiteContext newContext = new CallSiteContext();
-            // Cleaner is attached to CallSite instance and it clears native structures allocated for CallSite context.
-            // Though the CallSite can become unreachable, its Context is retained by the Cleaner instance (which is
-            // referenced from Cleaner class) until cleanup is performed.
-            Cleaner.create(cs, newContext);
+            // 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() {
< prev index next >