OpenJDK / jdk / jdk
changeset 53764:8bf7e0823202
8218758: [TESTBUG] compiler/cha/StrengthReduceInterfaceCall.java misses recompilation event
Reviewed-by: iignatyev
author | vlivanov |
---|---|
date | Thu, 14 Feb 2019 15:27:12 -0800 |
parents | 93b42eb5f3fc |
children | e002408eb0c0 |
files | test/hotspot/jtreg/compiler/cha/StrengthReduceInterfaceCall.java |
diffstat | 1 files changed, 24 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/test/hotspot/jtreg/compiler/cha/StrengthReduceInterfaceCall.java Thu Feb 14 15:27:12 2019 -0800 +++ b/test/hotspot/jtreg/compiler/cha/StrengthReduceInterfaceCall.java Thu Feb 14 15:27:12 2019 -0800 @@ -53,6 +53,7 @@ import jdk.internal.org.objectweb.asm.MethodVisitor; import jdk.internal.vm.annotation.DontInline; import sun.hotspot.WhiteBox; +import sun.hotspot.code.NMethod; import java.io.IOException; import java.lang.annotation.Retention; @@ -695,10 +696,6 @@ public static final Unsafe U = Unsafe.getUnsafe(); interface Test<T> { - boolean isCompiled(); - void assertNotCompiled(); - void assertCompiled(); - void call(T o); T receiver(int id); @@ -733,14 +730,6 @@ }; } - default void compile(Runnable r) { - assertNotCompiled(); - while(!isCompiled()) { - r.run(); - } - assertCompiled(); - } - default void initialize(Class<?>... cs) { for (Class<?> c : cs) { U.ensureClassInitialized(c); @@ -789,14 +778,31 @@ })); } - @Override - public boolean isCompiled() { return WB.isMethodCompiled(TEST); } + + public void compile(Runnable r) { + while (!WB.isMethodCompiled(TEST)) { + for (int i = 0; i < 100; i++) { + r.run(); + } + } + assertCompiled(); // record nmethod info + } + + private NMethod prevNM = null; - @Override - public void assertNotCompiled() { assertFalse(isCompiled()); } + public void assertNotCompiled() { + NMethod curNM = NMethod.get(TEST, false); + assertTrue(prevNM != null); // was previously compiled + assertTrue(curNM == null || prevNM.compile_id != curNM.compile_id); // either no nmethod present or recompiled + prevNM = curNM; // update nmethod info + } - @Override - public void assertCompiled() { assertTrue(isCompiled()); } + public void assertCompiled() { + NMethod curNM = NMethod.get(TEST, false); + assertTrue(curNM != null); // nmethod is present + assertTrue(prevNM == null || prevNM.compile_id == curNM.compile_id); // no recompilations if nmethod present + prevNM = curNM; // update nmethod info + } @Override public void call(T i) {