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