< prev index next >

test/hotspot/jtreg/compiler/unsafe/UnsafeGetConstantField.java

Print this page

        

*** 30,39 **** --- 30,42 ---- * * @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,71 **** --- 65,77 ---- 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,402 **** return cw.toByteArray(); } Test generate() { - Class<?> c = U.defineClass(className, classFile, 0, classFile.length, THIS_CLASS.getClassLoader(), null); try { return (Test) c.newInstance(); } catch(Exception e) { throw new Error(e); } } --- 397,409 ---- return cw.toByteArray(); } Test generate() { 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 >