< prev index next >
test/hotspot/jtreg/compiler/jsr292/NonInlinedCall/RedefineTest.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -46,11 +46,10 @@
* compiler.jsr292.NonInlinedCall.RedefineTest
*/
package compiler.jsr292.NonInlinedCall;
-import jdk.internal.misc.Unsafe;
import jdk.internal.org.objectweb.asm.ClassWriter;
import jdk.internal.org.objectweb.asm.MethodVisitor;
import jdk.internal.vm.annotation.DontInline;
import sun.hotspot.WhiteBox;
@@ -66,17 +65,19 @@
import static jdk.internal.org.objectweb.asm.Opcodes.ACC_SUPER;
import static jdk.internal.org.objectweb.asm.Opcodes.IRETURN;
public class RedefineTest {
static final MethodHandles.Lookup LOOKUP = MethodHandleHelper.IMPL_LOOKUP;
- static final Unsafe UNSAFE = Unsafe.getUnsafe();
-
static final String NAME = "compiler/jsr292/NonInlinedCall/RedefineTest$T";
static Class<?> getClass(int r) {
byte[] classFile = getClassFile(r);
- return UNSAFE.defineClass(NAME, classFile, 0, classFile.length, null, null);
+ try {
+ return MethodHandles.lookup().defineClass(classFile);
+ } catch (IllegalAccessException e) {
+ throw new Error(e);
+ }
}
/**
* Generates a class of the following shape:
* static class T {
< prev index next >