8006562: findOwnMH in nashorn "objects" package should be cleaned up
authorsundar
Fri, 18 Jan 2013 17:55:04 +0530
changeset 16181 f6a125580f62
parent 16180 374e36bd1357
child 16182 06e8c712f6a3
8006562: findOwnMH in nashorn "objects" package should be cleaned up Reviewed-by: jlaskey, lagergren
nashorn/make/project.properties
nashorn/src/jdk/nashorn/internal/objects/Global.java
nashorn/src/jdk/nashorn/internal/objects/NativeArguments.java
nashorn/src/jdk/nashorn/internal/objects/NativeBoolean.java
nashorn/src/jdk/nashorn/internal/objects/NativeError.java
nashorn/src/jdk/nashorn/internal/objects/NativeJSAdapter.java
nashorn/src/jdk/nashorn/internal/objects/NativeNumber.java
nashorn/src/jdk/nashorn/internal/objects/NativeStrictArguments.java
nashorn/src/jdk/nashorn/internal/objects/NativeString.java
nashorn/src/jdk/nashorn/internal/objects/PrototypeObject.java
nashorn/src/jdk/nashorn/internal/objects/ScriptFunctionImpl.java
--- a/nashorn/make/project.properties	Fri Jan 18 08:45:06 2013 +0530
+++ b/nashorn/make/project.properties	Fri Jan 18 17:55:04 2013 +0530
@@ -209,11 +209,14 @@
 src.dir=src
 test.src.dir=test/src
 
+run.test.xmx=3G
+run.test.xms=2G
+
 #  -XX:+PrintCompilation -XX:+UnlockDiagnosticVMOptions -XX:+PrintNMethods
 # add '-Dtest.js.outofprocess' to run each test in a new sub-process
-run.test.jvmargs=-server -Xmx3G -XX:-TieredCompilation -esa -ea -Dnashorn.debug=true -Dfile.encoding=UTF-8 
+run.test.jvmargs=-server -Xmx${run.test.xmx} -XX:-TieredCompilation -esa -ea -Dnashorn.debug=true -Dfile.encoding=UTF-8 
 #-XX:+HeapDumpOnOutOfMemoryError -XX:-UseCompressedKlassPointers -XX:+PrintHeapAtGC -XX:ClassMetaspaceSize=300M  
-run.test.jvmargs.octane=-Xms2G -Xmx2G ${run.test.jvmargs}
+run.test.jvmargs.octane=-Xms${run.test.xms} -${run.test.jvmargs}
 
 run.test.jvmsecurityargs=-Xverify:all -Djava.security.manager -Djava.security.policy=${basedir}/build/nashorn.policy
 
--- a/nashorn/src/jdk/nashorn/internal/objects/Global.java	Fri Jan 18 08:45:06 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/objects/Global.java	Fri Jan 18 17:55:04 2013 +0530
@@ -1658,6 +1658,6 @@
 
 
     private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) {
-        return MH.findStatic(MethodHandles.lookup(), Global.class, name, MH.type(rtype, types));
+        return MH.findStatic(MethodHandles.publicLookup(), Global.class, name, MH.type(rtype, types));
     }
 }
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeArguments.java	Fri Jan 18 08:45:06 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeArguments.java	Fri Jan 18 17:55:04 2013 +0530
@@ -619,7 +619,7 @@
     }
 
     private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) {
-        return MH.findStatic(MethodHandles.lookup(), NativeArguments.class, name, MH.type(rtype, types));
+        return MH.findStatic(MethodHandles.publicLookup(), NativeArguments.class, name, MH.type(rtype, types));
     }
 
 }
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeBoolean.java	Fri Jan 18 08:45:06 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeBoolean.java	Fri Jan 18 17:55:04 2013 +0530
@@ -37,6 +37,7 @@
 import jdk.nashorn.internal.runtime.JSType;
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
+import jdk.nashorn.internal.runtime.linker.MethodHandleFactory;
 import jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor;
 import jdk.nashorn.internal.runtime.linker.PrimitiveLookup;
 import org.dynalang.dynalink.linker.GuardedInvocation;
@@ -175,7 +176,7 @@
         try {
             return MethodHandles.lookup().findStatic(NativeBoolean.class, "wrapFilter", MH.type(NativeBoolean.class, Object.class));
         } catch (NoSuchMethodException | IllegalAccessException e) {
-            throw new AssertionError(e);
+            throw new MethodHandleFactory.LookupException(e);
         }
     }
 }
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeError.java	Fri Jan 18 08:45:06 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeError.java	Fri Jan 18 17:55:04 2013 +0530
@@ -320,6 +320,6 @@
     }
 
     private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) {
-        return MH.findStatic(MethodHandles.lookup(), NativeError.class, name, MH.type(rtype, types));
+        return MH.findStatic(MethodHandles.publicLookup(), NativeError.class, name, MH.type(rtype, types));
     }
 }
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeJSAdapter.java	Fri Jan 18 08:45:06 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeJSAdapter.java	Fri Jan 18 17:55:04 2013 +0530
@@ -44,6 +44,7 @@
 import jdk.nashorn.internal.runtime.ScriptRuntime;
 import jdk.nashorn.internal.runtime.arrays.ArrayLikeIterator;
 import jdk.nashorn.internal.runtime.linker.Lookup;
+import jdk.nashorn.internal.runtime.linker.MethodHandleFactory;
 import org.dynalang.dynalink.CallSiteDescriptor;
 import org.dynalang.dynalink.linker.GuardedInvocation;
 
@@ -737,7 +738,7 @@
         try {
             return MethodHandles.lookup().findStatic(NativeJSAdapter.class, name, MH.type(rtype, types));
         } catch (final NoSuchMethodException | IllegalAccessException e) {
-            throw new AssertionError(e);
+            throw new MethodHandleFactory.LookupException(e);
         }
     }
 }
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeNumber.java	Fri Jan 18 08:45:06 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeNumber.java	Fri Jan 18 17:55:04 2013 +0530
@@ -45,6 +45,7 @@
 import jdk.nashorn.internal.runtime.JSType;
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
+import jdk.nashorn.internal.runtime.linker.MethodHandleFactory;
 import jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor;
 import jdk.nashorn.internal.runtime.linker.PrimitiveLookup;
 import org.dynalang.dynalink.linker.GuardedInvocation;
@@ -382,7 +383,7 @@
         try {
             return MethodHandles.lookup().findStatic(NativeNumber.class, "wrapFilter", MH.type(NativeNumber.class, Object.class));
         } catch (final NoSuchMethodException | IllegalAccessException e) {
-            throw new AssertionError(e);
+            throw new MethodHandleFactory.LookupException(e);
         }
     }
 }
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeStrictArguments.java	Fri Jan 18 08:45:06 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeStrictArguments.java	Fri Jan 18 17:55:04 2013 +0530
@@ -142,6 +142,6 @@
     }
 
     private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) {
-        return MH.findStatic(MethodHandles.lookup(), NativeStrictArguments.class, name, MH.type(rtype, types));
+        return MH.findStatic(MethodHandles.publicLookup(), NativeStrictArguments.class, name, MH.type(rtype, types));
     }
 }
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeString.java	Fri Jan 18 08:45:06 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeString.java	Fri Jan 18 17:55:04 2013 +0530
@@ -53,6 +53,7 @@
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
 import jdk.nashorn.internal.runtime.arrays.ArrayIndex;
+import jdk.nashorn.internal.runtime.linker.MethodHandleFactory;
 import jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor;
 import jdk.nashorn.internal.runtime.linker.NashornGuards;
 import jdk.nashorn.internal.runtime.linker.PrimitiveLookup;
@@ -931,7 +932,7 @@
         try {
             return MethodHandles.lookup().findStatic(NativeString.class, "wrapFilter", MH.type(NativeString.class, Object.class));
         } catch (final NoSuchMethodException | IllegalAccessException e) {
-            throw new AssertionError(e);
+            throw new MethodHandleFactory.LookupException(e);
         }
     }
 }
--- a/nashorn/src/jdk/nashorn/internal/objects/PrototypeObject.java	Fri Jan 18 08:45:06 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/objects/PrototypeObject.java	Fri Jan 18 17:55:04 2013 +0530
@@ -106,6 +106,6 @@
     }
 
     private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) {
-        return MH.findStatic(MethodHandles.lookup(), PrototypeObject.class, name, MH.type(rtype, types));
+        return MH.findStatic(MethodHandles.publicLookup(), PrototypeObject.class, name, MH.type(rtype, types));
     }
 }
--- a/nashorn/src/jdk/nashorn/internal/objects/ScriptFunctionImpl.java	Fri Jan 18 08:45:06 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/objects/ScriptFunctionImpl.java	Fri Jan 18 17:55:04 2013 +0530
@@ -39,6 +39,7 @@
 import jdk.nashorn.internal.runtime.ScriptRuntime;
 import jdk.nashorn.internal.runtime.Source;
 import jdk.nashorn.internal.runtime.linker.Lookup;
+import jdk.nashorn.internal.runtime.linker.MethodHandleFactory;
 
 /**
  * Concrete implementation of ScriptFunction. This sets correct map for the
@@ -340,6 +341,10 @@
     }
 
     private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) {
-        return MH.findStatic(MethodHandles.lookup(), ScriptFunctionImpl.class, name, MH.type(rtype, types));
+        try {
+            return MethodHandles.lookup().findStatic(ScriptFunctionImpl.class, name, MH.type(rtype, types));
+        } catch (final NoSuchMethodException | IllegalAccessException e) {
+            throw new MethodHandleFactory.LookupException(e);
+        }
     }
 }