jdk/src/share/classes/java/lang/invoke/MethodHandleStatics.java
changeset 13423 17843fff200d
parent 10419 12c063b39232
child 14089 0a41b980d62a
child 14222 58f55d4dde46
--- a/jdk/src/share/classes/java/lang/invoke/MethodHandleStatics.java	Thu Jul 12 00:12:52 2012 -0700
+++ b/jdk/src/share/classes/java/lang/invoke/MethodHandleStatics.java	Tue Jul 24 10:47:44 2012 -0700
@@ -27,6 +27,7 @@
 
 import java.security.AccessController;
 import java.security.PrivilegedAction;
+import sun.misc.Unsafe;
 
 /**
  * This class consists exclusively of static names internal to the
@@ -38,16 +39,30 @@
 
     private MethodHandleStatics() { }  // do not instantiate
 
+    static final Unsafe UNSAFE = Unsafe.getUnsafe();
+
     static final boolean DEBUG_METHOD_HANDLE_NAMES;
+    static final boolean DUMP_CLASS_FILES;
+    static final boolean TRACE_INTERPRETER;
+    static final boolean TRACE_METHOD_LINKAGE;
+    static final Integer COMPILE_THRESHOLD;
     static {
-        final Object[] values = { false };
+        final Object[] values = { false, false, false, false, null };
         AccessController.doPrivileged(new PrivilegedAction<Void>() {
                 public Void run() {
                     values[0] = Boolean.getBoolean("java.lang.invoke.MethodHandle.DEBUG_NAMES");
+                    values[1] = Boolean.getBoolean("java.lang.invoke.MethodHandle.DUMP_CLASS_FILES");
+                    values[2] = Boolean.getBoolean("java.lang.invoke.MethodHandle.TRACE_INTERPRETER");
+                    values[3] = Boolean.getBoolean("java.lang.invoke.MethodHandle.TRACE_METHOD_LINKAGE");
+                    values[4] = Integer.getInteger("java.lang.invoke.MethodHandle.COMPILE_THRESHOLD");
                     return null;
                 }
             });
         DEBUG_METHOD_HANDLE_NAMES = (Boolean) values[0];
+        DUMP_CLASS_FILES          = (Boolean) values[1];
+        TRACE_INTERPRETER         = (Boolean) values[2];
+        TRACE_METHOD_LINKAGE      = (Boolean) values[3];
+        COMPILE_THRESHOLD         = (Integer) values[4];
     }
 
     /*non-public*/ static String getNameString(MethodHandle target, MethodType type) {
@@ -55,7 +70,7 @@
             type = target.type();
         MemberName name = null;
         if (target != null)
-            name = MethodHandleNatives.getMethodName(target);
+            name = target.internalMemberName();
         if (name == null)
             return "invoke" + type;
         return name.getName() + type;
@@ -77,20 +92,6 @@
         return str + target.type();
     }
 
-    static void checkSpreadArgument(Object av, int n) {
-        if (av == null) {
-            if (n == 0)  return;
-        } else if (av instanceof Object[]) {
-            int len = ((Object[])av).length;
-            if (len == n)  return;
-        } else {
-            int len = java.lang.reflect.Array.getLength(av);
-            if (len == n)  return;
-        }
-        // fall through to error:
-        throw newIllegalArgumentException("Array is not of length "+n);
-    }
-
     // handy shared exception makers (they simplify the common case code)
     /*non-public*/ static RuntimeException newIllegalStateException(String message) {
         return new IllegalStateException(message);
@@ -110,6 +111,9 @@
     /*non-public*/ static Error uncaughtException(Exception ex) {
         throw new InternalError("uncaught exception", ex);
     }
+    static Error NYI() {
+        throw new AssertionError("NYI");
+    }
     private static String message(String message, Object obj) {
         if (obj != null)  message = message + ": " + obj;
         return message;