Skip to content

Commit 0985288

Browse files
zhengxiaolinXshipilev
authored andcommitted
8304681: compiler/sharedstubs/SharedStubToInterpTest.java fails after JDK-8304387
Reviewed-by: eastigeevich, kvn, shade
1 parent ff368d5 commit 0985288

File tree

3 files changed

+12
-56
lines changed

3 files changed

+12
-56
lines changed

test/hotspot/jtreg/ProblemList.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ compiler/codecache/jmx/PoolsIndependenceTest.java 8264632 macosx-all
6969

7070
compiler/vectorapi/VectorLogicalOpIdentityTest.java 8302459 linux-x64,windows-x64
7171

72-
compiler/sharedstubs/SharedStubToInterpTest.java 8304681 generic-all
73-
7472
#############################################################################
7573

7674
# :hotspot_gc

test/hotspot/jtreg/compiler/sharedstubs/SharedStubToInterpTest.java

Lines changed: 10 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,16 @@
2929
* @library /test/lib
3030
*
3131
* @requires os.arch=="amd64" | os.arch=="x86_64" | os.arch=="i386" | os.arch=="x86" | os.arch=="aarch64" | os.arch=="riscv64"
32+
* @requires vm.debug
3233
*
3334
* @run driver compiler.sharedstubs.SharedStubToInterpTest
3435
*/
3536

3637
package compiler.sharedstubs;
3738

3839
import java.util.ArrayList;
39-
import java.util.Iterator;
4040
import java.util.List;
41+
import java.util.regex.Pattern;
4142
import jdk.test.lib.process.OutputAnalyzer;
4243
import jdk.test.lib.process.ProcessTools;
4344

@@ -50,6 +51,7 @@ private static void runTest(String compiler, String test) throws Exception {
5051
command.add(compiler);
5152
command.add("-XX:+UnlockDiagnosticVMOptions");
5253
command.add("-Xbatch");
54+
command.add("-XX:+PrintRelocations");
5355
command.add("-XX:CompileCommand=compileonly," + testClassName + "::" + "test");
5456
command.add("-XX:CompileCommand=dontinline," + testClassName + "::" + "test");
5557
command.add("-XX:CompileCommand=print," + testClassName + "::" + "test");
@@ -82,48 +84,14 @@ public static void main(String[] args) throws Exception {
8284
}
8385
}
8486

85-
private static String skipTo(Iterator<String> iter, String substring) {
86-
while (iter.hasNext()) {
87-
String nextLine = iter.next();
88-
if (nextLine.contains(substring)) {
89-
return nextLine;
90-
}
91-
}
92-
return null;
93-
}
94-
9587
private static void checkOutput(OutputAnalyzer output) {
96-
Iterator<String> iter = output.asLines().listIterator();
97-
98-
String match = skipTo(iter, "Compiled method");
99-
while (match != null && !match.contains("Test::test")) {
100-
match = skipTo(iter, "Compiled method");
101-
}
102-
if (match == null) {
103-
throw new RuntimeException("Missing compiler output for the method 'test'");
104-
}
105-
106-
while (iter.hasNext()) {
107-
String nextLine = iter.next();
108-
if (nextLine.contains("{static_stub}")) {
109-
// Static stubs must be created at the end of the Stub section.
110-
throw new RuntimeException("Found {static_stub} before Deopt Handler Code");
111-
} else if (nextLine.contains("{runtime_call DeoptimizationBlob}")) {
112-
// Shared static stubs are put after Deopt Handler Code.
113-
break;
114-
}
115-
}
116-
117-
int foundStaticStubs = 0;
118-
while (iter.hasNext()) {
119-
if (iter.next().contains("{static_stub}")) {
120-
foundStaticStubs += 1;
121-
}
122-
}
123-
124-
final int expectedStaticStubs = 2;
125-
if (foundStaticStubs != expectedStaticStubs) {
126-
throw new RuntimeException("Found static stubs: " + foundStaticStubs + "; Expected static stubs: " + expectedStaticStubs);
88+
List<String> addrs = Pattern.compile("\\(static_stub\\) addr=(\\w+) .*\\[static_call=")
89+
.matcher(output.getStdout())
90+
.results()
91+
.map(m -> m.group(1))
92+
.toList();
93+
if (addrs.stream().distinct().count() >= addrs.size()) {
94+
throw new RuntimeException("No static stubs reused: distinct " + addrs.stream().distinct().count() + ", in total " + addrs.size());
12795
}
12896
}
12997

test/hotspot/jtreg/compiler/sharedstubs/SharedTrampolineTest.java

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -81,24 +81,14 @@ public static void main(String[] args) throws Exception {
8181
}
8282
}
8383

84-
private static String skipTo(Iterator<String> iter, String substring) {
85-
while (iter.hasNext()) {
86-
String nextLine = iter.next();
87-
if (nextLine.contains(substring)) {
88-
return nextLine;
89-
}
90-
}
91-
return null;
92-
}
93-
9484
private static void checkOutput(OutputAnalyzer output) {
9585
List<String> addrs = Pattern.compile("\\(trampoline_stub\\) addr=(\\w+) .*\\[trampoline owner")
9686
.matcher(output.getStdout())
9787
.results()
9888
.map(m -> m.group(1))
99-
.collect(Collectors.toList());
89+
.toList();
10090
if (addrs.stream().distinct().count() >= addrs.size()) {
101-
throw new RuntimeException("No stubs reused");
91+
throw new RuntimeException("No runtime trampoline stubs reused: distinct " + addrs.stream().distinct().count() + ", in total " + addrs.size());
10292
}
10393
}
10494

0 commit comments

Comments
 (0)