33 import sun.misc.Cleaner;
34
35 /**
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.
38 * <em>This class is not part of the JSR 292 standard.</em>
39 * @author jrose
40 */
41 class MethodHandleNatives {
42
43 private MethodHandleNatives() { } // static only
44
45 /// MemberName support
46
47 static native void init(MemberName self, Object ref);
48 static native void expand(MemberName self);
49 static native MemberName resolve(MemberName self, Class<?> caller) throws LinkageError;
50 static native int getMembers(Class<?> defc, String matchName, String matchSig,
51 int matchFlags, Class<?> caller, int skip, MemberName[] results);
52
53 /// Field layout queries parallel to sun.misc.Unsafe:
54 static native long objectFieldOffset(MemberName self); // e.g., returns vmindex
55 static native long staticFieldOffset(MemberName self); // e.g., returns vmindex
56 static native Object staticFieldBase(MemberName self); // e.g., returns clazz
57 static native Object getMemberVMInfo(MemberName self); // returns {vmindex,vmtarget}
58
59 /// CallSite support
60
61 /** Tell the JVM that we need to change the target of a CallSite. */
62 static native void setCallSiteTargetNormal(CallSite site, MethodHandle target);
63 static native void setCallSiteTargetVolatile(CallSite site, MethodHandle target);
64
65 /** Represents a context to track nmethod dependencies on CallSite instance target. */
66 static class CallSiteContext implements Runnable {
67 //@Injected JVM_nmethodBucket* vmdependencies;
68
69 static CallSiteContext make(CallSite cs) {
70 final CallSiteContext newContext = new CallSiteContext();
71 // Cleaner is attached to CallSite instance and it clears native structures allocated for CallSite context.
72 // Though the CallSite can become unreachable, its Context is retained by the Cleaner instance (which is
73 // referenced from Cleaner class) until cleanup is performed.
|
33 import sun.misc.Cleaner;
34
35 /**
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.
38 * <em>This class is not part of the JSR 292 standard.</em>
39 * @author jrose
40 */
41 class MethodHandleNatives {
42
43 private MethodHandleNatives() { } // static only
44
45 /// MemberName support
46
47 static native void init(MemberName self, Object ref);
48 static native void expand(MemberName self);
49 static native MemberName resolve(MemberName self, Class<?> caller) throws LinkageError;
50 static native int getMembers(Class<?> defc, String matchName, String matchSig,
51 int matchFlags, Class<?> caller, int skip, MemberName[] results);
52
53 /// Field layout queries parallel to jdk.internal.misc.Unsafe:
54 static native long objectFieldOffset(MemberName self); // e.g., returns vmindex
55 static native long staticFieldOffset(MemberName self); // e.g., returns vmindex
56 static native Object staticFieldBase(MemberName self); // e.g., returns clazz
57 static native Object getMemberVMInfo(MemberName self); // returns {vmindex,vmtarget}
58
59 /// CallSite support
60
61 /** Tell the JVM that we need to change the target of a CallSite. */
62 static native void setCallSiteTargetNormal(CallSite site, MethodHandle target);
63 static native void setCallSiteTargetVolatile(CallSite site, MethodHandle target);
64
65 /** Represents a context to track nmethod dependencies on CallSite instance target. */
66 static class CallSiteContext implements Runnable {
67 //@Injected JVM_nmethodBucket* vmdependencies;
68
69 static CallSiteContext make(CallSite cs) {
70 final CallSiteContext newContext = new CallSiteContext();
71 // Cleaner is attached to CallSite instance and it clears native structures allocated for CallSite context.
72 // Though the CallSite can become unreachable, its Context is retained by the Cleaner instance (which is
73 // referenced from Cleaner class) until cleanup is performed.
|