8139388: [TESTBUG] JVMCI test failed with RuntimeException profiling info wasn't changed after 100 invocations (assert failed: BaseProfilingInfo<> != BaseProfilingInfo<>)
Reviewed-by: twisti
This commit is contained in:
parent
e0d743ff05
commit
163e0435dc
@ -45,18 +45,15 @@ import compiler.jvmci.common.CTVMUtilities;
|
|||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
|
||||||
|
import compiler.whitebox.CompilerWhiteBoxTest;
|
||||||
import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
|
import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
|
||||||
import jdk.vm.ci.hotspot.CompilerToVMHelper;
|
import jdk.vm.ci.hotspot.CompilerToVMHelper;
|
||||||
import jdk.vm.ci.meta.ProfilingInfo;
|
import jdk.vm.ci.meta.ProfilingInfo;
|
||||||
import jdk.test.lib.Asserts;
|
import jdk.test.lib.Asserts;
|
||||||
import jdk.test.lib.Utils;
|
|
||||||
import sun.hotspot.WhiteBox;
|
|
||||||
|
|
||||||
public class ReprofileTest {
|
public class ReprofileTest {
|
||||||
|
|
||||||
private static final WhiteBox WB = WhiteBox.getWhiteBox();
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
List<Method> testCases = createTestCases();
|
List<Method> testCases = createTestCases();
|
||||||
testCases.forEach(ReprofileTest::runSanityTest);
|
testCases.forEach(ReprofileTest::runSanityTest);
|
||||||
@ -67,10 +64,10 @@ public class ReprofileTest {
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
Class<?> aClass = DummyClass.class;
|
Class<?> aClass = DummyClass.class;
|
||||||
testCases.add(aClass.getMethod("withLoop"));
|
testCases.add(aClass.getMethod("dummyInstanceFunction"));
|
||||||
|
|
||||||
aClass = DummyClass.class;
|
aClass = DummyClass.class;
|
||||||
testCases.add(aClass.getDeclaredMethod("dummyFunction"));
|
testCases.add(aClass.getMethod("dummyFunction"));
|
||||||
} catch (NoSuchMethodException e) {
|
} catch (NoSuchMethodException e) {
|
||||||
throw new Error("TEST BUG " + e.getMessage(), e);
|
throw new Error("TEST BUG " + e.getMessage(), e);
|
||||||
}
|
}
|
||||||
@ -78,17 +75,17 @@ public class ReprofileTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void runSanityTest(Method aMethod) {
|
private static void runSanityTest(Method aMethod) {
|
||||||
|
System.out.println(aMethod);
|
||||||
HotSpotResolvedJavaMethod method = CTVMUtilities
|
HotSpotResolvedJavaMethod method = CTVMUtilities
|
||||||
.getResolvedMethod(aMethod);
|
.getResolvedMethod(aMethod);
|
||||||
ProfilingInfo startProfile = method.getProfilingInfo();
|
ProfilingInfo startProfile = method.getProfilingInfo();
|
||||||
Asserts.assertFalse(startProfile.isMature(), aMethod
|
Asserts.assertFalse(startProfile.isMature(), aMethod
|
||||||
+ " : profiling info is mature in the begging");
|
+ " : profiling info is mature in the beginning");
|
||||||
|
|
||||||
long compileThreshold = (Long) WB.getVMFlag("CompileThreshold");
|
|
||||||
// make interpreter to profile this method
|
// make interpreter to profile this method
|
||||||
try {
|
try {
|
||||||
Object obj = aMethod.getDeclaringClass().newInstance();
|
Object obj = aMethod.getDeclaringClass().newInstance();
|
||||||
for (long i = 0; i < compileThreshold; i++) {
|
for (long i = 0; i < CompilerWhiteBoxTest.THRESHOLD; i++) {
|
||||||
aMethod.invoke(obj);
|
aMethod.invoke(obj);
|
||||||
}
|
}
|
||||||
} catch (ReflectiveOperationException e) {
|
} catch (ReflectiveOperationException e) {
|
||||||
@ -99,10 +96,10 @@ public class ReprofileTest {
|
|||||||
Asserts.assertNE(startProfile.toString(), compProfile.toString(),
|
Asserts.assertNE(startProfile.toString(), compProfile.toString(),
|
||||||
String.format("%s : profiling info wasn't changed after "
|
String.format("%s : profiling info wasn't changed after "
|
||||||
+ "%d invocations",
|
+ "%d invocations",
|
||||||
aMethod, compileThreshold));
|
aMethod, CompilerWhiteBoxTest.THRESHOLD));
|
||||||
Asserts.assertTrue(compProfile.isMature(),
|
Asserts.assertTrue(compProfile.isMature(),
|
||||||
String.format("%s is not mature after %d invocations",
|
String.format("%s is not mature after %d invocations",
|
||||||
aMethod, compileThreshold));
|
aMethod, CompilerWhiteBoxTest.THRESHOLD));
|
||||||
|
|
||||||
CompilerToVMHelper.reprofile(method);
|
CompilerToVMHelper.reprofile(method);
|
||||||
ProfilingInfo reprofiledProfile = method.getProfilingInfo();
|
ProfilingInfo reprofiledProfile = method.getProfilingInfo();
|
||||||
|
@ -24,9 +24,7 @@ package compiler.whitebox;
|
|||||||
|
|
||||||
import sun.hotspot.WhiteBox;
|
import sun.hotspot.WhiteBox;
|
||||||
import sun.hotspot.code.NMethod;
|
import sun.hotspot.code.NMethod;
|
||||||
import java.lang.reflect.Constructor;
|
|
||||||
import java.lang.reflect.Executable;
|
import java.lang.reflect.Executable;
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
@ -70,7 +68,7 @@ public abstract class CompilerWhiteBoxTest {
|
|||||||
protected static final boolean IS_VERBOSE
|
protected static final boolean IS_VERBOSE
|
||||||
= System.getProperty("verbose") != null;
|
= System.getProperty("verbose") != null;
|
||||||
/** invocation count to trigger compilation */
|
/** invocation count to trigger compilation */
|
||||||
protected static final int THRESHOLD;
|
public static final int THRESHOLD;
|
||||||
/** invocation count to trigger OSR compilation */
|
/** invocation count to trigger OSR compilation */
|
||||||
protected static final long BACKEDGE_THRESHOLD;
|
protected static final long BACKEDGE_THRESHOLD;
|
||||||
/** Value of {@code java.vm.info} (interpreted|mixed|comp mode) */
|
/** Value of {@code java.vm.info} (interpreted|mixed|comp mode) */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user