< prev index next >

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

Print this page
rev 49420 : 8200238: Reduce number of exceptions created when calling MemberName$Factory::resolveOrNull
Reviewed-by: lfoltan, acorn


  32 import java.lang.reflect.Field;
  33 
  34 import static java.lang.invoke.MethodHandleNatives.Constants.*;
  35 import static java.lang.invoke.MethodHandleStatics.TRACE_METHOD_LINKAGE;
  36 import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
  37 
  38 /**
  39  * The JVM interface for the method handles package is all here.
  40  * This is an interface internal and private to an implementation of JSR 292.
  41  * <em>This class is not part of the JSR 292 standard.</em>
  42  * @author jrose
  43  */
  44 class MethodHandleNatives {
  45 
  46     private MethodHandleNatives() { } // static only
  47 
  48     /// MemberName support
  49 
  50     static native void init(MemberName self, Object ref);
  51     static native void expand(MemberName self);
  52     static native MemberName resolve(MemberName self, Class<?> caller) throws LinkageError, ClassNotFoundException;

  53     static native int getMembers(Class<?> defc, String matchName, String matchSig,
  54             int matchFlags, Class<?> caller, int skip, MemberName[] results);
  55 
  56     /// Field layout queries parallel to jdk.internal.misc.Unsafe:
  57     static native long objectFieldOffset(MemberName self);  // e.g., returns vmindex
  58     static native long staticFieldOffset(MemberName self);  // e.g., returns vmindex
  59     static native Object staticFieldBase(MemberName self);  // e.g., returns clazz
  60     static native Object getMemberVMInfo(MemberName self);  // returns {vmindex,vmtarget}
  61 
  62     /// CallSite support
  63 
  64     /** Tell the JVM that we need to change the target of a CallSite. */
  65     static native void setCallSiteTargetNormal(CallSite site, MethodHandle target);
  66     static native void setCallSiteTargetVolatile(CallSite site, MethodHandle target);
  67 
  68     static native void copyOutBootstrapArguments(Class<?> caller, int[] indexInfo,
  69                                                  int start, int end,
  70                                                  Object[] buf, int pos,
  71                                                  boolean resolve,
  72                                                  Object ifNotAvailable);




  32 import java.lang.reflect.Field;
  33 
  34 import static java.lang.invoke.MethodHandleNatives.Constants.*;
  35 import static java.lang.invoke.MethodHandleStatics.TRACE_METHOD_LINKAGE;
  36 import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
  37 
  38 /**
  39  * The JVM interface for the method handles package is all here.
  40  * This is an interface internal and private to an implementation of JSR 292.
  41  * <em>This class is not part of the JSR 292 standard.</em>
  42  * @author jrose
  43  */
  44 class MethodHandleNatives {
  45 
  46     private MethodHandleNatives() { } // static only
  47 
  48     /// MemberName support
  49 
  50     static native void init(MemberName self, Object ref);
  51     static native void expand(MemberName self);
  52     static native MemberName resolve(MemberName self, Class<?> caller,
  53             boolean speculativeResolve) throws LinkageError, ClassNotFoundException;
  54     static native int getMembers(Class<?> defc, String matchName, String matchSig,
  55             int matchFlags, Class<?> caller, int skip, MemberName[] results);
  56 
  57     /// Field layout queries parallel to jdk.internal.misc.Unsafe:
  58     static native long objectFieldOffset(MemberName self);  // e.g., returns vmindex
  59     static native long staticFieldOffset(MemberName self);  // e.g., returns vmindex
  60     static native Object staticFieldBase(MemberName self);  // e.g., returns clazz
  61     static native Object getMemberVMInfo(MemberName self);  // returns {vmindex,vmtarget}
  62 
  63     /// CallSite support
  64 
  65     /** Tell the JVM that we need to change the target of a CallSite. */
  66     static native void setCallSiteTargetNormal(CallSite site, MethodHandle target);
  67     static native void setCallSiteTargetVolatile(CallSite site, MethodHandle target);
  68 
  69     static native void copyOutBootstrapArguments(Class<?> caller, int[] indexInfo,
  70                                                  int start, int end,
  71                                                  Object[] buf, int pos,
  72                                                  boolean resolve,
  73                                                  Object ifNotAvailable);


< prev index next >