changeset 398:77f38b00af98

meth: add @Hidden annotations
author jrose
date Tue, 10 Jul 2012 23:19:06 -0700
parents 0045d0c0a3d2
children e3ce088d7958
files meth-lazy-7023639.patch meth-lazy-7023639.xbmh.patch
diffstat 2 files changed, 119 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/meth-lazy-7023639.patch	Tue Jul 10 13:46:15 2012 +0200
+++ b/meth-lazy-7023639.patch	Tue Jul 10 23:19:06 2012 -0700
@@ -2237,7 +2237,7 @@
 new file mode 100644
 --- /dev/null
 +++ b/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
-@@ -0,0 +1,1098 @@
+@@ -0,0 +1,1107 @@
 +/*
 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -2753,6 +2753,9 @@
 +        // Force inlining of this invoker method.
 +        mv.visitAnnotation("Ljava/lang/invoke/ForceInline;", true);
 +
++        // Suppress this method in backtraces displayed to the user.
++        mv.visitAnnotation("Ljava/lang/invoke/LambdaForm$Hidden;", true);
++
 +        // Mark this method as a compiled LambdaForm
 +        mv.visitAnnotation("Ljava/lang/invoke/LambdaForm$Compiled;", true);
 +
@@ -3230,6 +3233,9 @@
 +        // Prevent inlining of this invoker method.
 +        mv.visitAnnotation("Ljava/lang/invoke/DontInline;", true);
 +
++        // Suppress this method in backtraces displayed to the user.
++        mv.visitAnnotation("Ljava/lang/invoke/LambdaForm$Hidden;", true);
++
 +        // create parameter array
 +        emitIconstInsn(invokerType.parameterCount());
 +        mv.visitTypeInsn(Opcodes.ANEWARRAY, "java/lang/Object");
@@ -3289,6 +3295,9 @@
 +        // Force inlining of this invoker method.
 +        mv.visitAnnotation("Ljava/lang/invoke/ForceInline;", true);
 +
++        // Suppress this method in backtraces displayed to the user.
++        mv.visitAnnotation("Ljava/lang/invoke/LambdaForm$Hidden;", true);
++
 +        // Load receiver
 +        emitAloadInsn(0);
 +
@@ -3694,7 +3703,7 @@
 new file mode 100644
 --- /dev/null
 +++ b/src/share/classes/java/lang/invoke/LambdaForm.java
-@@ -0,0 +1,1481 @@
+@@ -0,0 +1,1506 @@
 +/*
 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -4275,6 +4284,7 @@
 +    private static final int invocationThreshold = 30;
 +    private int invocationCounter = 0;
 +
++    @Hidden
 +    /** Interpretively invoke this form on the given arguments. */
 +    Object interpretWithArguments(Object... argumentValues) throws Throwable {
 +        if (TRACE_INTERPRETER)
@@ -4294,6 +4304,7 @@
 +        return (result < 0) ? null : values[result];
 +    }
 +
++    @Hidden
 +    /** Evaluate a single Name within this form, applying its function to its arguments. */
 +    Object interpretName(Name name, Object[] values) throws Throwable {
 +        if (TRACE_INTERPRETER)
@@ -4625,57 +4636,69 @@
 +        // The following are predefined NamedFunction invokers.  The system must build
 +        // a separate invoker for each distinct signature.
 +        /** void return type invokers. */
++        @Hidden
 +        static Object invoke__V(MethodHandle mh, Object[] a) throws Throwable {
 +            assert(a.length == 0);
 +            mh.invokeBasic();
 +            return null;
 +        }
++        @Hidden
 +        static Object invoke_L_V(MethodHandle mh, Object[] a) throws Throwable {
 +            assert(a.length == 1);
 +            mh.invokeBasic(a[0]);
 +            return null;
 +        }
++        @Hidden
 +        static Object invoke_LL_V(MethodHandle mh, Object[] a) throws Throwable {
 +            assert(a.length == 2);
 +            mh.invokeBasic(a[0], a[1]);
 +            return null;
 +        }
++        @Hidden
 +        static Object invoke_LLL_V(MethodHandle mh, Object[] a) throws Throwable {
 +            assert(a.length == 3);
 +            mh.invokeBasic(a[0], a[1], a[2]);
 +            return null;
 +        }
++        @Hidden
 +        static Object invoke_LLLL_V(MethodHandle mh, Object[] a) throws Throwable {
 +            assert(a.length == 4);
 +            mh.invokeBasic(a[0], a[1], a[2], a[3]);
 +            return null;
 +        }
++        @Hidden
 +        static Object invoke_LLLLL_V(MethodHandle mh, Object[] a) throws Throwable {
 +            assert(a.length == 5);
 +            mh.invokeBasic(a[0], a[1], a[2], a[3], a[4]);
 +            return null;
 +        }
 +        /** Object return type invokers. */
++        @Hidden
 +        static Object invoke__L(MethodHandle mh, Object[] a) throws Throwable {
 +            assert(a.length == 0);
 +            return mh.invokeBasic();
 +        }
++        @Hidden
 +        static Object invoke_L_L(MethodHandle mh, Object[] a) throws Throwable {
 +            assert(a.length == 1);
 +            return mh.invokeBasic(a[0]);
 +        }
++        @Hidden
 +        static Object invoke_LL_L(MethodHandle mh, Object[] a) throws Throwable {
 +            assert(a.length == 2);
 +            return mh.invokeBasic(a[0], a[1]);
 +        }
++        @Hidden
 +        static Object invoke_LLL_L(MethodHandle mh, Object[] a) throws Throwable {
 +            assert(a.length == 3);
 +            return mh.invokeBasic(a[0], a[1], a[2]);
 +        }
++        @Hidden
 +        static Object invoke_LLLL_L(MethodHandle mh, Object[] a) throws Throwable {
 +            assert(a.length == 4);
 +            return mh.invokeBasic(a[0], a[1], a[2], a[3]);
 +        }
++        @Hidden
 +        static Object invoke_LLLLL_L(MethodHandle mh, Object[] a) throws Throwable {
 +            assert(a.length == 5);
 +            return mh.invokeBasic(a[0], a[1], a[2], a[3], a[4]);
@@ -4696,6 +4719,7 @@
 +            return typeForm.namedFunctionInvoker = mh;
 +        }
 +
++        @Hidden
 +        Object invokeWithArguments(Object... arguments) throws Throwable {
 +            // If we have a cached invoker, call it right away.
 +            // NOTE: The invoker always returns a reference value.
@@ -4704,6 +4728,7 @@
 +            return invoker().invokeBasic(resolvedHandle(), arguments);
 +        }
 +
++        @Hidden
 +        Object invokeWithArgumentsTracing(Object[] arguments) throws Throwable {
 +            Object rval;
 +            try {
@@ -5143,6 +5168,15 @@
 +    @interface Compiled {
 +    }
 +
++    /**
++     * Internal marker for LambdaForm interpreter frames.
++     */
++    /*non-public*/
++    @Target(ElementType.METHOD)
++    @Retention(RetentionPolicy.RUNTIME)
++    @interface Hidden {
++    }
++
 +
 +/*
 +    // Smoke-test for the invokers used in this file.
@@ -7847,7 +7881,7 @@
      }
  
      static
-@@ -738,47 +1154,41 @@
+@@ -738,47 +1154,42 @@
      MethodHandle makeGuardWithTest(MethodHandle test,
                                     MethodHandle target,
                                     MethodHandle fallback) {
@@ -7917,10 +7951,83 @@
 -        String debugString() {
 -            return addTypeString(target, this);
 -        }
++        @LambdaForm.Hidden
          private Object invoke_V(Object... av) throws Throwable {
              try {
                  return target.invokeExact(av);
-@@ -860,7 +1270,7 @@
+@@ -787,6 +1198,7 @@
+                 return catcher.invokeExact(t, av);
+             }
+         }
++        @LambdaForm.Hidden
+         private Object invoke_L0() throws Throwable {
+             try {
+                 return target.invokeExact();
+@@ -795,6 +1207,7 @@
+                 return catcher.invokeExact(t);
+             }
+         }
++        @LambdaForm.Hidden
+         private Object invoke_L1(Object a0) throws Throwable {
+             try {
+                 return target.invokeExact(a0);
+@@ -803,6 +1216,7 @@
+                 return catcher.invokeExact(t, a0);
+             }
+         }
++        @LambdaForm.Hidden
+         private Object invoke_L2(Object a0, Object a1) throws Throwable {
+             try {
+                 return target.invokeExact(a0, a1);
+@@ -811,6 +1225,7 @@
+                 return catcher.invokeExact(t, a0, a1);
+             }
+         }
++        @LambdaForm.Hidden
+         private Object invoke_L3(Object a0, Object a1, Object a2) throws Throwable {
+             try {
+                 return target.invokeExact(a0, a1, a2);
+@@ -819,6 +1234,7 @@
+                 return catcher.invokeExact(t, a0, a1, a2);
+             }
+         }
++        @LambdaForm.Hidden
+         private Object invoke_L4(Object a0, Object a1, Object a2, Object a3) throws Throwable {
+             try {
+                 return target.invokeExact(a0, a1, a2, a3);
+@@ -827,6 +1243,7 @@
+                 return catcher.invokeExact(t, a0, a1, a2, a3);
+             }
+         }
++        @LambdaForm.Hidden
+         private Object invoke_L5(Object a0, Object a1, Object a2, Object a3, Object a4) throws Throwable {
+             try {
+                 return target.invokeExact(a0, a1, a2, a3, a4);
+@@ -835,6 +1252,7 @@
+                 return catcher.invokeExact(t, a0, a1, a2, a3, a4);
+             }
+         }
++        @LambdaForm.Hidden
+         private Object invoke_L6(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) throws Throwable {
+             try {
+                 return target.invokeExact(a0, a1, a2, a3, a4, a5);
+@@ -843,6 +1261,7 @@
+                 return catcher.invokeExact(t, a0, a1, a2, a3, a4, a5);
+             }
+         }
++        @LambdaForm.Hidden
+         private Object invoke_L7(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) throws Throwable {
+             try {
+                 return target.invokeExact(a0, a1, a2, a3, a4, a5, a6);
+@@ -851,6 +1270,7 @@
+                 return catcher.invokeExact(t, a0, a1, a2, a3, a4, a5, a6);
+             }
+         }
++        @LambdaForm.Hidden
+         private Object invoke_L8(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) throws Throwable {
+             try {
+                 return target.invokeExact(a0, a1, a2, a3, a4, a5, a6, a7);
+@@ -860,7 +1280,7 @@
              }
          }
          static MethodHandle[] makeInvokes() {
@@ -7929,7 +8036,7 @@
              MethodHandles.Lookup lookup = IMPL_LOOKUP;
              for (;;) {
                  int nargs = invokes.size();
-@@ -903,37 +1313,60 @@
+@@ -903,37 +1323,60 @@
              // Note: convertArguments(...2) avoids interface casts present in convertArguments(...0)
              MethodHandle gtarget = convertArguments(target, gtype, type, 2);
              MethodHandle gcatcher = convertArguments(catcher, gcatchType, ctype, 2);
--- a/meth-lazy-7023639.xbmh.patch	Tue Jul 10 13:46:15 2012 +0200
+++ b/meth-lazy-7023639.xbmh.patch	Tue Jul 10 23:19:06 2012 -0700
@@ -1361,8 +1361,8 @@
 -        // Force inlining of this invoker method.
 -        mv.visitAnnotation("Ljava/lang/invoke/ForceInline;", true);
 -
-         // Mark this method as a compiled LambdaForm
-         mv.visitAnnotation("Ljava/lang/invoke/LambdaForm$Compiled;", true);
+         // Suppress this method in backtraces displayed to the user.
+         mv.visitAnnotation("Ljava/lang/invoke/LambdaForm$Hidden;", true);
  
 @@ -527,8 +531,6 @@
                  // FIXME: make sure this idiom is really present!
@@ -1559,9 +1559,9 @@
 -        // Prevent inlining of this invoker method.
 -        mv.visitAnnotation("Ljava/lang/invoke/DontInline;", true);
 -
-         // create parameter array
-         emitIconstInsn(invokerType.parameterCount());
-         mv.visitTypeInsn(Opcodes.ANEWARRAY, "java/lang/Object");
+         // Suppress this method in backtraces displayed to the user.
+         mv.visitAnnotation("Ljava/lang/invoke/LambdaForm$Hidden;", true);
+ 
 @@ -1022,9 +1026,10 @@
          emitReturnInsn(rtype);
  
@@ -1587,8 +1587,8 @@
 -        // Force inlining of this invoker method.
 -        mv.visitAnnotation("Ljava/lang/invoke/ForceInline;", true);
 -
-         // Load receiver
-         emitAloadInsn(0);
+         // Suppress this method in backtraces displayed to the user.
+         mv.visitAnnotation("Ljava/lang/invoke/LambdaForm$Hidden;", true);
  
 @@ -1090,9 +1094,27 @@
          emitReturnInsn(Object.class);  // NOTE: NamedFunction invokers always return a reference value.