mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8139703: [TESTBUG] compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest fails using -Xcomp
Reviewed-by: kvn
This commit is contained in:
parent
d88959ebfb
commit
173e8139c0
1 changed files with 22 additions and 17 deletions
|
@ -33,13 +33,12 @@
|
||||||
* jdk.vm.ci/jdk.vm.ci.hotspot
|
* jdk.vm.ci/jdk.vm.ci.hotspot
|
||||||
* jdk.vm.ci/jdk.vm.ci.code
|
* jdk.vm.ci/jdk.vm.ci.code
|
||||||
* jdk.vm.ci/jdk.vm.ci.meta
|
* jdk.vm.ci/jdk.vm.ci.meta
|
||||||
* @ignore 8139703
|
|
||||||
* @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
|
* @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
|
||||||
* @build compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest
|
* @build compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest
|
||||||
* @build sun.hotspot.WhiteBox
|
* @build sun.hotspot.WhiteBox
|
||||||
* @run main ClassFileInstaller sun.hotspot.WhiteBox
|
* @run main ClassFileInstaller sun.hotspot.WhiteBox
|
||||||
* sun.hotspot.WhiteBox$WhiteBoxPermission
|
* sun.hotspot.WhiteBox$WhiteBoxPermission
|
||||||
* @run main/othervm -Xbootclasspath/a:.
|
* @run main/othervm -Xmixed -Xbootclasspath/a:.
|
||||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
|
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
|
||||||
* -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
|
* -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
|
||||||
* -XX:CompileCommand=exclude,*::check
|
* -XX:CompileCommand=exclude,*::check
|
||||||
|
@ -47,7 +46,7 @@
|
||||||
* -Xbatch
|
* -Xbatch
|
||||||
* -Dcompiler.jvmci.compilerToVM.MaterializeVirtualObjectTest.invalidate=false
|
* -Dcompiler.jvmci.compilerToVM.MaterializeVirtualObjectTest.invalidate=false
|
||||||
* compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest
|
* compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest
|
||||||
* @run main/othervm -Xbootclasspath/a:.
|
* @run main/othervm -Xmixed -Xbootclasspath/a:.
|
||||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
|
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
|
||||||
* -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
|
* -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
|
||||||
* -XX:CompileCommand=exclude,*::check
|
* -XX:CompileCommand=exclude,*::check
|
||||||
|
@ -67,24 +66,27 @@ import jdk.test.lib.Asserts;
|
||||||
|
|
||||||
import compiler.jvmci.common.CTVMUtilities;
|
import compiler.jvmci.common.CTVMUtilities;
|
||||||
import compiler.testlibrary.CompilerUtils;
|
import compiler.testlibrary.CompilerUtils;
|
||||||
|
import compiler.whitebox.CompilerWhiteBoxTest;
|
||||||
|
|
||||||
import sun.hotspot.WhiteBox;
|
import sun.hotspot.WhiteBox;
|
||||||
|
|
||||||
public class MaterializeVirtualObjectTest {
|
public class MaterializeVirtualObjectTest {
|
||||||
private static final WhiteBox WB = WhiteBox.getWhiteBox();
|
private static final WhiteBox WB;
|
||||||
private static final Method METHOD;
|
private static final Method METHOD;
|
||||||
private static final ResolvedJavaMethod RESOLVED_METHOD;
|
private static final ResolvedJavaMethod RESOLVED_METHOD;
|
||||||
private static final boolean INVALIDATE = Boolean.getBoolean(
|
private static final boolean INVALIDATE;
|
||||||
"compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest.invalidate");
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
WB = WhiteBox.getWhiteBox();
|
||||||
try {
|
try {
|
||||||
METHOD = MaterializeVirtualObjectTest.class.getDeclaredMethod(
|
METHOD = MaterializeVirtualObjectTest.class.getDeclaredMethod(
|
||||||
"testFrame", String.class, boolean.class);
|
"testFrame", String.class, int.class);
|
||||||
} catch (NoSuchMethodException e) {
|
} catch (NoSuchMethodException e) {
|
||||||
throw new Error("Can't get executable for test method", e);
|
throw new Error("Can't get executable for test method", e);
|
||||||
}
|
}
|
||||||
RESOLVED_METHOD = CTVMUtilities.getResolvedMethod(METHOD);
|
RESOLVED_METHOD = CTVMUtilities.getResolvedMethod(METHOD);
|
||||||
|
INVALIDATE = Boolean.getBoolean(
|
||||||
|
"compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest.invalidate");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
@ -106,26 +108,29 @@ public class MaterializeVirtualObjectTest {
|
||||||
System.out.println(getName());
|
System.out.println(getName());
|
||||||
Asserts.assertFalse(WB.isMethodCompiled(METHOD), getName()
|
Asserts.assertFalse(WB.isMethodCompiled(METHOD), getName()
|
||||||
+ " : method unexpectedly compiled");
|
+ " : method unexpectedly compiled");
|
||||||
/* need to call testFrame at least once to be able to compile it, so
|
/* need to trigger compilation by multiple method invocations
|
||||||
calling with materialize=false, because testFrame is not compiled */
|
in order to have method profile data to be gathered */
|
||||||
testFrame("someString", /* materialize= */ false);
|
boolean isTiered = WB.getBooleanVMFlag("TieredCompilation");
|
||||||
WB.enqueueMethodForCompilation(METHOD, 4);
|
int COMPILE_THRESHOLD = isTiered ? CompilerWhiteBoxTest.THRESHOLD
|
||||||
|
: CompilerWhiteBoxTest.THRESHOLD * 2;
|
||||||
|
for (int i = 0; i < COMPILE_THRESHOLD; i++) {
|
||||||
|
testFrame("someString", i);
|
||||||
|
}
|
||||||
Asserts.assertTrue(WB.isMethodCompiled(METHOD), getName()
|
Asserts.assertTrue(WB.isMethodCompiled(METHOD), getName()
|
||||||
+ "Method unexpectedly not compiled");
|
+ "Method unexpectedly not compiled");
|
||||||
// calling with materialize=true to materialize compiled testFrame
|
testFrame("someString", CompilerWhiteBoxTest.THRESHOLD);
|
||||||
testFrame("someString", /* materialize= */ true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void testFrame(String str, boolean materialize) {
|
private void testFrame(String str, int iteration) {
|
||||||
Helper helper = new Helper(str);
|
Helper helper = new Helper(str);
|
||||||
check(materialize);
|
check(iteration);
|
||||||
Asserts.assertTrue((helper.string != null) && (this != null)
|
Asserts.assertTrue((helper.string != null) && (this != null)
|
||||||
&& (helper != null), getName() + " : some locals are null");
|
&& (helper != null), getName() + " : some locals are null");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void check(boolean materialize) {
|
private void check(int iteration) {
|
||||||
// Materialize virtual objects on last invocation
|
// Materialize virtual objects on last invocation
|
||||||
if (materialize) {
|
if (iteration == CompilerWhiteBoxTest.THRESHOLD) {
|
||||||
HotSpotStackFrameReference hsFrame = CompilerToVMHelper
|
HotSpotStackFrameReference hsFrame = CompilerToVMHelper
|
||||||
.getNextStackFrame(/* topmost frame */ null,
|
.getNextStackFrame(/* topmost frame */ null,
|
||||||
new ResolvedJavaMethod[]{
|
new ResolvedJavaMethod[]{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue