jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java
changeset 36435 0408881ad616
parent 35641 da165fd9c886
child 36934 590fc47a0aeb
equal deleted inserted replaced
36434:3fd8dee1b158 36435:0408881ad616
    28 import java.lang.invoke.MethodHandles.Lookup;
    28 import java.lang.invoke.MethodHandles.Lookup;
    29 import java.lang.reflect.Field;
    29 import java.lang.reflect.Field;
    30 import static java.lang.invoke.MethodHandleNatives.Constants.*;
    30 import static java.lang.invoke.MethodHandleNatives.Constants.*;
    31 import static java.lang.invoke.MethodHandleStatics.*;
    31 import static java.lang.invoke.MethodHandleStatics.*;
    32 import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
    32 import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
    33 import jdk.internal.ref.Cleaner;
    33 import jdk.internal.ref.CleanerFactory;
    34 
    34 
    35 /**
    35 /**
    36  * The JVM interface for the method handles package is all here.
    36  * The JVM interface for the method handles package is all here.
    37  * This is an interface internal and private to an implementation of JSR 292.
    37  * This is an interface internal and private to an implementation of JSR 292.
    38  * <em>This class is not part of the JSR 292 standard.</em>
    38  * <em>This class is not part of the JSR 292 standard.</em>
    66     static class CallSiteContext implements Runnable {
    66     static class CallSiteContext implements Runnable {
    67         //@Injected JVM_nmethodBucket* vmdependencies;
    67         //@Injected JVM_nmethodBucket* vmdependencies;
    68 
    68 
    69         static CallSiteContext make(CallSite cs) {
    69         static CallSiteContext make(CallSite cs) {
    70             final CallSiteContext newContext = new CallSiteContext();
    70             final CallSiteContext newContext = new CallSiteContext();
    71             // Cleaner is attached to CallSite instance and it clears native structures allocated for CallSite context.
    71             // CallSite instance is tracked by a Cleanable which clears native
    72             // Though the CallSite can become unreachable, its Context is retained by the Cleaner instance (which is
    72             // structures allocated for CallSite context. Though the CallSite can
    73             // referenced from Cleaner class) until cleanup is performed.
    73             // become unreachable, its Context is retained by the Cleanable instance
    74             Cleaner.create(cs, newContext);
    74             // (which is referenced from Cleaner instance which is referenced from
       
    75             // CleanerFactory class) until cleanup is performed.
       
    76             CleanerFactory.cleaner().register(cs, newContext);
    75             return newContext;
    77             return newContext;
    76         }
    78         }
    77 
    79 
    78         @Override
    80         @Override
    79         public void run() {
    81         public void run() {