< prev index next >
test/hotspot/jtreg/compiler/unsafe/UnsafeGetConstantField.java
Print this page
@@ -30,10 +30,13 @@
*
* @modules java.base/jdk.internal.org.objectweb.asm
* java.base/jdk.internal.vm.annotation
* java.base/jdk.internal.misc
*
+ * @library ../jsr292/patches
+ * @build java.base/java.lang.invoke.MethodHandleHelper
+ *
* @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions
* -Xbatch -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileCommand=dontinline,compiler.unsafe.UnsafeGetConstantField::checkGetAddress
* -XX:CompileCommand=dontinline,*::test*
@@ -62,10 +65,13 @@
import jdk.internal.org.objectweb.asm.Type;
import jdk.internal.vm.annotation.Stable;
import jdk.test.lib.Asserts;
import jdk.test.lib.Platform;
+import java.lang.invoke.MethodHandleHelper;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodHandles.Lookup;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
@@ -391,12 +397,13 @@
return cw.toByteArray();
}
Test generate() {
- Class<?> c = U.defineClass(className, classFile, 0, classFile.length, THIS_CLASS.getClassLoader(), null);
try {
+ Lookup lookup = MethodHandleHelper.IMPL_LOOKUP.in(MethodHandles.class);
+ Class<?> c = lookup.defineClass(classFile);
return (Test) c.newInstance();
} catch(Exception e) {
throw new Error(e);
}
}
< prev index next >