< prev index next >

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

Print this page




 349 
 350     /** The JVM is requesting pull-mode bootstrap when it provides
 351      *  a tuple of the form int[]{ argc, vmindex }.
 352      *  The BSM is expected to call back to the JVM using the caller
 353      *  class and vmindex to resolve the static arguments.
 354      */
 355     static boolean staticArgumentsPulled(Object staticArguments) {
 356         return staticArguments instanceof int[];
 357     }
 358 
 359     /** A BSM runs in pull-mode if and only if its sole arguments
 360      * are (Lookup, BootstrapCallInfo), or can be converted pairwise
 361      * to those types, and it is not of variable arity.
 362      * Excluding error cases, we can just test that the arity is a constant 2.
 363      *
 364      * NOTE: This method currently returns false, since pulling is not currently
 365      * exposed to a BSM. When pull mode is supported the method block will be
 366      * replaced with currently commented out code.
 367      */
 368     static boolean isPullModeBSM(MethodHandle bsm) {
 369         return false;
 370 //        return bsm.type().parameterCount() == 2 && !bsm.isVarargsCollector();
 371     }
 372 
 373     /**
 374      * The JVM wants a pointer to a MethodType.  Oblige it by finding or creating one.
 375      */
 376     static MethodType findMethodHandleType(Class<?> rtype, Class<?>[] ptypes) {
 377         return MethodType.makeImpl(rtype, ptypes, true);
 378     }
 379 
 380     /**
 381      * The JVM wants to link a call site that requires a dynamic type check.
 382      * Name is a type-checking invoker, invokeExact or invoke.
 383      * Return a JVM method (MemberName) to handle the invoking.
 384      * The method assumes the following arguments on the stack:
 385      * 0: the method handle being invoked
 386      * 1-N: the arguments to the method handle invocation
 387      * N+1: an optional, implicitly added argument (typically the given MethodType)
 388      * <p>
 389      * The nominal method at such a call site is an instance of
 390      * a signature-polymorphic method (see @PolymorphicSignature).




 349 
 350     /** The JVM is requesting pull-mode bootstrap when it provides
 351      *  a tuple of the form int[]{ argc, vmindex }.
 352      *  The BSM is expected to call back to the JVM using the caller
 353      *  class and vmindex to resolve the static arguments.
 354      */
 355     static boolean staticArgumentsPulled(Object staticArguments) {
 356         return staticArguments instanceof int[];
 357     }
 358 
 359     /** A BSM runs in pull-mode if and only if its sole arguments
 360      * are (Lookup, BootstrapCallInfo), or can be converted pairwise
 361      * to those types, and it is not of variable arity.
 362      * Excluding error cases, we can just test that the arity is a constant 2.
 363      *
 364      * NOTE: This method currently returns false, since pulling is not currently
 365      * exposed to a BSM. When pull mode is supported the method block will be
 366      * replaced with currently commented out code.
 367      */
 368     static boolean isPullModeBSM(MethodHandle bsm) {
 369         return bsm.type().parameterCount() == 2 && !bsm.isVarargsCollector()
 370                && BootstrapCallInfo.class.isAssignableFrom(bsm.type().parameterType(1));
 371     }
 372 
 373     /**
 374      * The JVM wants a pointer to a MethodType.  Oblige it by finding or creating one.
 375      */
 376     static MethodType findMethodHandleType(Class<?> rtype, Class<?>[] ptypes) {
 377         return MethodType.makeImpl(rtype, ptypes, true);
 378     }
 379 
 380     /**
 381      * The JVM wants to link a call site that requires a dynamic type check.
 382      * Name is a type-checking invoker, invokeExact or invoke.
 383      * Return a JVM method (MemberName) to handle the invoking.
 384      * The method assumes the following arguments on the stack:
 385      * 0: the method handle being invoked
 386      * 1-N: the arguments to the method handle invocation
 387      * N+1: an optional, implicitly added argument (typically the given MethodType)
 388      * <p>
 389      * The nominal method at such a call site is an instance of
 390      * a signature-polymorphic method (see @PolymorphicSignature).


< prev index next >