changeset 5641:b27c16f81b65

Merge
author lana
date Tue, 15 Jan 2013 19:50:26 -0800
parents c9fb7c0e371f e012aace9050
children 56d7b34dc9af
files .hgtags
diffstat 5 files changed, 25 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Wed Jan 16 04:34:29 2013 +0400
+++ b/.hgtags	Tue Jan 15 19:50:26 2013 -0800
@@ -241,3 +241,5 @@
 fdd0d43ba0f9c3f58959e2de7d1958f771d84565 jdk7u12-b05
 b5449e3dcf1f317002840dc5c2093be47c60fe8c jdk7u12-b06
 cb81ee79a72d84f99b8e7d73b5ae73124b661fe7 jdk7u12-b07
+b5e180ef18a0c823675bcd32edfbf2f5122d9722 jdk7u12-b08
+2e7fe0208e9c928f2f539fecb6dc8a1401ecba9e jdk7u12-b09
--- a/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java	Wed Jan 16 04:34:29 2013 +0400
+++ b/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java	Tue Jan 15 19:50:26 2013 -0800
@@ -295,9 +295,6 @@
 
         String invokerDesc = invokerType.toMethodDescriptorString();
         mv = cw.visitMethod(Opcodes.ACC_STATIC, invokerName, invokerDesc, null, null);
-
-        // Force inlining of this invoker method.
-        mv.visitAnnotation("Ljava/lang/invoke/ForceInline;", true);
     }
 
     /**
@@ -524,6 +521,9 @@
         // Mark this method as a compiled LambdaForm
         mv.visitAnnotation("Ljava/lang/invoke/LambdaForm$Compiled;", true);
 
+        // Force inlining of this invoker method.
+        mv.visitAnnotation("Ljava/lang/invoke/ForceInline;", true);
+
         // iterate over the form's names, generating bytecode instructions for each
         // start iterating at the first name following the arguments
         for (int i = lambdaForm.arity; i < lambdaForm.names.length; i++) {
@@ -943,6 +943,9 @@
         // Suppress this method in backtraces displayed to the user.
         mv.visitAnnotation("Ljava/lang/invoke/LambdaForm$Hidden;", true);
 
+        // Don't inline the interpreter entry.
+        mv.visitAnnotation("Ljava/lang/invoke/DontInline;", true);
+
         // create parameter array
         emitIconstInsn(invokerType.parameterCount());
         mv.visitTypeInsn(Opcodes.ANEWARRAY, "java/lang/Object");
@@ -1005,6 +1008,9 @@
         // Suppress this method in backtraces displayed to the user.
         mv.visitAnnotation("Ljava/lang/invoke/LambdaForm$Hidden;", true);
 
+        // Force inlining of this invoker method.
+        mv.visitAnnotation("Ljava/lang/invoke/ForceInline;", true);
+
         // Load receiver
         emitAloadInsn(0);
 
--- a/src/share/classes/java/lang/invoke/LambdaForm.java	Wed Jan 16 04:34:29 2013 +0400
+++ b/src/share/classes/java/lang/invoke/LambdaForm.java	Tue Jan 15 19:50:26 2013 -0800
@@ -592,6 +592,7 @@
     private int invocationCounter = 0;
 
     @Hidden
+    @DontInline
     /** Interpretively invoke this form on the given arguments. */
     Object interpretWithArguments(Object... argumentValues) throws Throwable {
         if (TRACE_INTERPRETER)
@@ -606,6 +607,7 @@
     }
 
     @Hidden
+    @DontInline
     /** Evaluate a single Name within this form, applying its function to its arguments. */
     Object interpretName(Name name, Object[] values) throws Throwable {
         if (TRACE_INTERPRETER)
--- a/src/share/classes/java/lang/invoke/MethodHandleImpl.java	Wed Jan 16 04:34:29 2013 +0400
+++ b/src/share/classes/java/lang/invoke/MethodHandleImpl.java	Tue Jan 15 19:50:26 2013 -0800
@@ -311,9 +311,9 @@
     }
 
     static class AsVarargsCollector extends MethodHandle {
-        MethodHandle target;
-        final Class<?> arrayType;
-        MethodHandle cache;
+        private final MethodHandle target;
+        private final Class<?> arrayType;
+        private MethodHandle cache;
 
         AsVarargsCollector(MethodHandle target, MethodType type, Class<?> arrayType) {
             super(type, reinvokerForm(type));
--- a/src/share/classes/sun/invoke/util/ValueConversions.java	Wed Jan 16 04:34:29 2013 +0400
+++ b/src/share/classes/sun/invoke/util/ValueConversions.java	Tue Jan 15 19:50:26 2013 -0800
@@ -449,8 +449,16 @@
      * @param x an arbitrary reference value
      * @return the same value x
      */
+    @SuppressWarnings("unchecked")
     static <T,U> T castReference(Class<? extends T> t, U x) {
-        return t.cast(x);
+        // inlined Class.cast because we can't ForceInline it
+        if (x != null && !t.isInstance(x))
+            throw newClassCastException(t, x);
+        return (T) x;
+    }
+
+    private static ClassCastException newClassCastException(Class<?> t, Object obj) {
+        return new ClassCastException("Cannot cast " + obj.getClass().getName() + " to " + t.getName());
     }
 
     private static final MethodHandle IDENTITY, CAST_REFERENCE, ZERO_OBJECT, IGNORE, EMPTY,