diff --git a/src/share/classes/java/dyn/MethodHandle.java b/src/share/classes/java/dyn/MethodHandle.java index 613b16a10a79d87b36cf62d0cbbb2f1cbb676c87..b78b40248053f521214048a6b52230b42698a454 100644 --- a/src/share/classes/java/dyn/MethodHandle.java +++ b/src/share/classes/java/dyn/MethodHandle.java @@ -93,7 +93,7 @@ import static sun.dyn.MemberName.newIllegalArgumentException; // utility * and their result can be cast to any return type. * Formally this is accomplished by giving the invoker methods * {@code Object} return types and variable-arity {@code Object} arguments, - * but they have an additional quality called "signature polymorphism" + * but they have an additional quality called signature polymorphism * which connects this freedom of invocation directly to the JVM execution stack. *
* As is usual with virtual methods, source-level calls to {@code invokeExact} @@ -297,7 +297,7 @@ mh.invokeExact(System.out, "Hello, world."); * throwables locally, rethrowing only those which are legal in the context, * and wrapping ones which are illegal. * - *
+ * For the sake of tools (but not as a programming API), the signature polymorphic + * methods are marked with a private yet standard annotation, + * {@code @java.dyn.MethodHandle.PolymorphicSignature}. + * The annotation's retention is {@code RUNTIME}, so that all tools can see it. + * + *
+ * The following methods (and no others) are signature polymorphic: + *
+ * A signature polymorphic method will be declared with the following properties: + *
+ * When a call to a signature polymorphic method is compiled, the associated linkage information for + * its arguments is not array of {@code Object} (as for other similar varargs methods) + * but rather the erasure of the static types of all the arguments. + *
+ * In an argument position of a method invocation on a signature polymorphic method, + * a null literal has type {@code java.lang.Void}, unless cast to a reference type. + * (Note: This typing rule allows the null type to have its own encoding in linkage information + * distinct from other types. + *
+ * The linkage information for the return type is derived from a context-dependent target typing convention. + * The return type for a signature polymorphic method invocation is determined as follows: + *
+ * The linkage information for argument and return types is stored in the descriptor for the + * compiled (bytecode) call site. As for any invocation instruction, the arguments and return value + * will be passed directly on the JVM stack, in accordance with the descriptor, + * and without implicit boxing or unboxing. * *