From 59b7fb1a91c594f98f06b28cb95310a38565397d Mon Sep 17 00:00:00 2001 From: Christian Hagedorn Date: Thu, 2 Feb 2023 14:39:28 +0000 Subject: [PATCH] 8300273: [IR framework] Handle message instead of bailing out Reviewed-by: thartmann, kvn --- src/hotspot/share/compiler/compileTask.cpp | 1 + .../lib/ir_framework/TestFramework.java | 10 +- .../driver/irmatching/IRMatcher.java | 26 +-- .../irmatching/parser/AbstractLine.java | 88 --------- .../irmatching/parser/BlockOutputReader.java | 73 -------- .../parser/HotSpotPidFileParser.java | 169 ------------------ .../irmatching/parser/IREncodingParser.java | 15 +- .../irmatching/parser/IRMethodBuilder.java | 70 ++++++++ .../driver/irmatching/parser/Line.java | 71 -------- ...lationParser.java => TestClassParser.java} | 35 +++- .../driver/irmatching/parser/TestMethod.java | 68 ++----- ...rruptedException.java => TestMethods.java} | 37 +++- .../parser/hotspot/CompilePhaseBlock.java | 134 ++++++++++++++ .../parser/hotspot/CompileQueueMessages.java | 111 ++++++++++++ .../parser/hotspot/HotSpotPidFileParser.java | 64 +++++++ .../parser/hotspot/LoggedMethod.java | 92 ++++++++++ .../parser/hotspot/LoggedMethods.java | 55 ++++++ .../irmatching/parser/hotspot/State.java | 95 ++++++++++ .../{Block.java => hotspot/WriterThread.java} | 32 ++-- .../WriterThreads.java} | 30 ++-- .../ir_framework/tests/TestCheckedTests.java | 6 +- .../ir_framework/tests/TestIRMatching.java | 6 +- .../tests/TestPhaseIRMatching.java | 10 +- .../ir_framework/tests/TestRunTests.java | 4 +- .../tests/TestSafepointWhilePrinting.java | 143 +++++++++++++++ .../ir_framework/tests/TestScenarios.java | 10 +- .../ir_framework/tests/Utils.java | 43 ----- .../safepoint_while_printing_hotspot_pid.log | 163 +++++++++++++++++ 28 files changed, 1076 insertions(+), 585 deletions(-) delete mode 100644 test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/AbstractLine.java delete mode 100644 test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/BlockOutputReader.java delete mode 100644 test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/HotSpotPidFileParser.java create mode 100644 test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/IRMethodBuilder.java delete mode 100644 test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/Line.java rename test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/{MethodCompilationParser.java => TestClassParser.java} (58%) rename test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/{FileCorruptedException.java => TestMethods.java} (50%) create mode 100644 test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/hotspot/CompilePhaseBlock.java create mode 100644 test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/hotspot/CompileQueueMessages.java create mode 100644 test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/hotspot/HotSpotPidFileParser.java create mode 100644 test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/hotspot/LoggedMethod.java create mode 100644 test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/hotspot/LoggedMethods.java create mode 100644 test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/hotspot/State.java rename test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/{Block.java => hotspot/WriterThread.java} (51%) rename test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/{BlockLine.java => hotspot/WriterThreads.java} (53%) create mode 100644 test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestSafepointWhilePrinting.java delete mode 100644 test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/Utils.java create mode 100644 test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/safepoint_while_printing_hotspot_pid.log diff --git a/src/hotspot/share/compiler/compileTask.cpp b/src/hotspot/share/compiler/compileTask.cpp index 1133c798497..649f24fc0d4 100644 --- a/src/hotspot/share/compiler/compileTask.cpp +++ b/src/hotspot/share/compiler/compileTask.cpp @@ -338,6 +338,7 @@ void CompileTask::log_task(xmlStream* log) { void CompileTask::log_task_queued() { ttyLocker ttyl; ResourceMark rm; + NoSafepointVerifier nsv; xtty->begin_elem("task_queued"); log_task(xtty); diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/TestFramework.java b/test/hotspot/jtreg/compiler/lib/ir_framework/TestFramework.java index c67d765a2e4..84ce6c81859 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/TestFramework.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/TestFramework.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,7 +29,7 @@ import compiler.lib.ir_framework.driver.TestVMProcess; import compiler.lib.ir_framework.driver.irmatching.IRMatcher; import compiler.lib.ir_framework.driver.irmatching.IRViolationException; import compiler.lib.ir_framework.driver.irmatching.Matchable; -import compiler.lib.ir_framework.driver.irmatching.parser.MethodCompilationParser; +import compiler.lib.ir_framework.driver.irmatching.parser.TestClassParser; import compiler.lib.ir_framework.shared.*; import compiler.lib.ir_framework.test.TestVM; import jdk.test.lib.Platform; @@ -747,9 +747,9 @@ public class TestFramework { TestVMProcess testVMProcess = new TestVMProcess(additionalFlags, testClass, helperClasses, defaultWarmup); if (shouldVerifyIR) { try { - MethodCompilationParser methodCompilationParser = new MethodCompilationParser(testClass); - Matchable testClassMatchable = methodCompilationParser.parse(testVMProcess.getHotspotPidFileName(), - testVMProcess.getIrEncoding()); + TestClassParser testClassParser = new TestClassParser(testClass); + Matchable testClassMatchable = testClassParser.parse(testVMProcess.getHotspotPidFileName(), + testVMProcess.getIrEncoding()); IRMatcher matcher = new IRMatcher(testClassMatchable); matcher.match(); } catch (IRViolationException e) { diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/IRMatcher.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/IRMatcher.java index a16242b6088..e62f3b88e4b 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/IRMatcher.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/IRMatcher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,18 +23,17 @@ package compiler.lib.ir_framework.driver.irmatching; -import compiler.lib.ir_framework.driver.irmatching.parser.MethodCompilationParser; +import compiler.lib.ir_framework.driver.irmatching.parser.TestClassParser; import compiler.lib.ir_framework.driver.irmatching.report.CompilationOutputBuilder; import compiler.lib.ir_framework.driver.irmatching.report.FailureMessageBuilder; /** - * This class performs IR matching on the prepared {@link TestClass} object parsed by {@link MethodCompilationParser}. + * This class performs IR matching on the prepared {@link TestClass} object parsed by {@link TestClassParser}. * All applicable @IR rules are matched with all their defined compilation phases. If there are any IR matching failures, * an {@link IRViolationException} is reported which provides a formatted failure message and the compilation outputs * of the failed compilation phases. */ public class IRMatcher { - public static final String SAFEPOINT_WHILE_PRINTING_MESSAGE = ""; private final Matchable testClass; public IRMatcher(Matchable testClass) { @@ -42,7 +41,7 @@ public class IRMatcher { } /** - * Do an IR matching of all methods with applicable @IR rules prepared with by the {@link MethodCompilationParser}. + * Do an IR matching of all methods with applicable @IR rules prepared with by the {@link TestClassParser}. */ public void match() { MatchResult result = testClass.match(); @@ -58,20 +57,7 @@ public class IRMatcher { */ private void reportFailures(MatchResult result) { String failureMsg = new FailureMessageBuilder(result).build(); - String compilationOutput = new CompilationOutputBuilder(result).build(); - throwIfNoSafepointWhilePrinting(failureMsg, compilationOutput); - } - - /** - * In some very rare cases, the hotspot_pid* file to IR match on contains "" - * (emitted by ttyLocker::break_tty_for_safepoint) which might be the reason for a matching error. - * Do not throw an exception in this case (i.e. bailout). - */ - private void throwIfNoSafepointWhilePrinting(String failures, String compilations) { - if (!compilations.contains(SAFEPOINT_WHILE_PRINTING_MESSAGE)) { - throw new IRViolationException(failures, compilations); - } else { - System.out.println("Found " + SAFEPOINT_WHILE_PRINTING_MESSAGE + ", bail out of IR matching"); - } + String compilationOutput = new CompilationOutputBuilder(result).build(); + throw new IRViolationException(failureMsg, compilationOutput); } } diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/AbstractLine.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/AbstractLine.java deleted file mode 100644 index 4ef0cf72d42..00000000000 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/AbstractLine.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package compiler.lib.ir_framework.driver.irmatching.parser; - -import java.io.BufferedReader; -import java.io.IOException; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * Base class of a read line from the hotspot_pid* file. - */ -abstract class AbstractLine { - private final BufferedReader reader; - protected String line; - private final Pattern compileIdPatternForTestClass; - - public AbstractLine(BufferedReader reader, Pattern compileIdPatternForTestClass) { - this.reader = reader; - this.compileIdPatternForTestClass = compileIdPatternForTestClass; - } - - public String getLine() { - return line; - } - - /** - * Read next line and return it. If we've reached the end of the file, return NULL instead. - */ - public boolean readLine() throws IOException { - line = reader.readLine(); - return line != null; - } - - /** - * Is this line a start of a method in the test class? We only care about test class entries. There might be non-class - * entries as well if the user specified additional compile commands. Ignore these. - */ - public boolean isTestClassCompilation() { - if (isCompilation()) { - Matcher matcher = compileIdPatternForTestClass.matcher(line); - return matcher.find(); - } - return false; - } - - /** - * Is this header a C2 non-OSR compilation header entry? - */ - public boolean isCompilation() { - return line.startsWith(" testClassCompilations = new ArrayList<>(); - while (line.readLine() && !line.isBlockEnd()) { - if (line.isTestClassCompilation()) { - // Could have safepointed while writing the block (see IRMatcher.SAFEPOINT_WHILE_PRINTING_MESSAGE) - // and enqueuing the next test class method for compilation during the interruption. Record this - // method to ensure that we read the PrintIdeal/PrintOptoAssembly blocks for that method later. - testClassCompilations.add(line.getLine()); - } - builder.append(escapeXML(line.getLine())).append(System.lineSeparator()); - } - return new Block(builder.toString(), testClassCompilations); - } - - /** - * Need to escape XML special characters. - */ - private static String escapeXML(String line) { - if (line.contains("&")) { - line = line.replace("<", "<"); - line = line.replace(">", ">"); - line = line.replace(""", "\""); - line = line.replace("'", "'"); - line = line.replace("&", "&"); - } - return line; - } -} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/HotSpotPidFileParser.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/HotSpotPidFileParser.java deleted file mode 100644 index ece4a1afffa..00000000000 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/HotSpotPidFileParser.java +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package compiler.lib.ir_framework.driver.irmatching.parser; - -import compiler.lib.ir_framework.TestFramework; -import compiler.lib.ir_framework.driver.irmatching.TestClass; -import compiler.lib.ir_framework.driver.irmatching.irmethod.IRMethod; -import compiler.lib.ir_framework.driver.irmatching.irmethod.IRMethodMatchable; -import compiler.lib.ir_framework.shared.TestFormat; -import compiler.lib.ir_framework.shared.TestFrameworkException; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.HashMap; -import java.util.Map; -import java.util.SortedSet; -import java.util.TreeSet; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.stream.Collectors; - -/** - * Class to parse the ideal compile phases and PrintOptoAssembly outputs of the test class from the hotspot_pid* file - * of all methods collected by {@link IREncodingParser}. - * - * @see IRMethod - * @see IREncodingParser - */ -class HotSpotPidFileParser { - private static final Pattern COMPILE_ID_PATTERN = Pattern.compile("compile_id='(\\d+)'"); - - private final Pattern compileIdPatternForTestClass; - /** - * "Method name" -> TestMethod map created by {@link IREncodingParser} which contains an entry for each method that - * needs to be IR matched on. - */ - private final Map testMethodMap; - - public HotSpotPidFileParser(String testClass, Map testMethodMap) { - this.compileIdPatternForTestClass = Pattern.compile("compile_id='(\\d+)'.*" + Pattern.quote(testClass) + " (\\S+)"); - this.testMethodMap = testMethodMap; - } - - /** - * Parse the hotspot_pid*.log file from the test VM. Read the ideal compile phase and PrintOptoAssembly outputs for - * all methods defined by the IR encoding. - */ - public TestClass parse(String hotspotPidFileName) { - try { - parseHotSpotFile(hotspotPidFileName); - SortedSet irMethods = testMethodMap.values().stream() - .map(TestMethod::createIRMethod) - .collect(Collectors.toCollection(TreeSet::new)); - TestFormat.throwIfAnyFailures(); - return new TestClass(irMethods); - } catch (IOException e) { - throw new TestFrameworkException("Error while reading " + hotspotPidFileName, e); - } catch (FileCorruptedException e) { - throw new TestFrameworkException("Unexpected format of " + hotspotPidFileName, e); - } - } - - private void parseHotSpotFile(String hotspotPidFileName) throws IOException { - Map compileIdMap = new HashMap<>(); - try (var reader = Files.newBufferedReader(Paths.get(hotspotPidFileName))) { - Line line = new Line(reader, compileIdPatternForTestClass); - BlockOutputReader blockOutputReader = new BlockOutputReader(reader, compileIdPatternForTestClass); - while (line.readLine()) { - if (line.isTestClassCompilation()) { - parseTestMethodCompileId(compileIdMap, line.getLine()); - } else if (isTestMethodBlockStart(line, compileIdMap)) { - processMethodBlock(compileIdMap, line, blockOutputReader); - } - } - } - } - - private void processMethodBlock(Map compileIdMap, Line line, BlockOutputReader blockOutputReader) - throws IOException { - Block block = blockOutputReader.readBlock(); - if (block.containsTestClassCompilations()) { - // Register all test method compilations that could have been emitted during a rare safepoint while - // dumping the ideal compile phase/PrintOptoAssembly output. - block.getTestClassCompilations().forEach(l -> parseTestMethodCompileId(compileIdMap, l)); - } - setIRMethodOutput(block.getOutput(), line, compileIdMap); - } - - private void parseTestMethodCompileId(Map compileIdMap, String line) { - String methodName = parseMethodName(line); - if (isTestAnnotatedMethod(methodName)) { - compileIdMap.put(getCompileId(line), getTestMethod(methodName)); - } - } - - private String parseMethodName(String line) { - Matcher matcher = compileIdPatternForTestClass.matcher(line); - TestFramework.check(matcher.find(), "must find match"); - return matcher.group(2); - } - - /** - * Is this a @Test method? - */ - private boolean isTestAnnotatedMethod(String testMethodName) { - return testMethodMap.containsKey(testMethodName); - } - - private TestMethod getTestMethod(String testMethodName) { - TestMethod testMethod = testMethodMap.get(testMethodName); - testMethod.clearOutput(); - testMethod.setCompiled(); - return testMethod; - } - - private int getCompileId(String line) { - Matcher matcher = COMPILE_ID_PATTERN.matcher(line); - if (!matcher.find()) { - throw new FileCorruptedException("Unexpected format found on this line: " + line); - } - return Integer.parseInt(matcher.group(1)); - } - - /** - * Is this line the start of a PrintIdeal/PrintOptoAssembly output block of a @Test method? - */ - private boolean isTestMethodBlockStart(Line line, Map compileIdMap) { - return line.isBlockStart() && isTestClassMethodBlock(line, compileIdMap); - } - - private boolean isTestClassMethodBlock(Line line, Map compileIdMap) { - return compileIdMap.containsKey(getCompileId(line.getLine())); - } - - private void setIRMethodOutput(String blockOutput, Line blockStartLine, Map compileIdMap) { - TestMethod testMethod = compileIdMap.get(getCompileId(blockStartLine.getLine())); - setIRMethodOutput(blockOutput, blockStartLine, testMethod); - } - - private void setIRMethodOutput(String blockOutput, Line blockStartLine, TestMethod testMethod) { - if (blockStartLine.isPrintIdealStart()) { - testMethod.setIdealOutput(blockOutput, blockStartLine.getCompilePhase()); - } else { - testMethod.setOptoAssemblyOutput(blockOutput); - } - } -} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/IREncodingParser.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/IREncodingParser.java index a67d1caab18..cc82d90179f 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/IREncodingParser.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/IREncodingParser.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ package compiler.lib.ir_framework.driver.irmatching.parser; import compiler.lib.ir_framework.IR; import compiler.lib.ir_framework.TestFramework; +import compiler.lib.ir_framework.driver.irmatching.parser.hotspot.HotSpotPidFileParser; import compiler.lib.ir_framework.shared.TestFormat; import compiler.lib.ir_framework.shared.TestFrameworkException; import compiler.lib.ir_framework.test.IREncodingPrinter; @@ -40,25 +41,25 @@ import java.util.regex.Pattern; * * @see TestMethod */ -class IREncodingParser { +public class IREncodingParser { private static final boolean PRINT_IR_ENCODING = Boolean.parseBoolean(System.getProperty("PrintIREncoding", "false")); private static final Pattern IR_ENCODING_PATTERN = Pattern.compile("(?<=" + IREncodingPrinter.START + "\r?\n).*\\R([\\s\\S]*)(?=" + IREncodingPrinter.END + ")"); - private final Map testMethodMap; + private final Map testMethods; private final Class testClass; public IREncodingParser(Class testClass) { this.testClass = testClass; - this.testMethodMap = new HashMap<>(); + this.testMethods = new HashMap<>(); } /** * Parse the IR encoding passed as parameter and return a "test name" -> TestMethod map that contains an entry * for each method that needs to be IR matched on. */ - public Map parse(String irEncoding) { + public TestMethods parse(String irEncoding) { if (TestFramework.VERBOSE || PRINT_IR_ENCODING) { System.out.println("Read IR encoding from test VM:"); System.out.println(irEncoding); @@ -66,7 +67,7 @@ class IREncodingParser { createTestMethodMap(irEncoding, testClass); // We could have found format errors in @IR annotations. Report them now with an exception. TestFormat.throwIfAnyFailures(); - return testMethodMap; + return new TestMethods(testMethods); } /** @@ -134,7 +135,7 @@ class IREncodingParser { int[] irRuleIds = irRulesMap.get(m.getName()); validateIRRuleIds(m, irAnnos, irRuleIds); if (hasAnyApplicableIRRules(irRuleIds)) { - testMethodMap.put(m.getName(), new TestMethod(m, irRuleIds)); + testMethods.put(m.getName(), new TestMethod(m, irAnnos, irRuleIds)); } } } diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/IRMethodBuilder.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/IRMethodBuilder.java new file mode 100644 index 00000000000..fb7db3e3a3b --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/IRMethodBuilder.java @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package compiler.lib.ir_framework.driver.irmatching.parser; + +import compiler.lib.ir_framework.driver.irmatching.Compilation; +import compiler.lib.ir_framework.driver.irmatching.irmethod.IRMethod; +import compiler.lib.ir_framework.driver.irmatching.irmethod.IRMethodMatchable; +import compiler.lib.ir_framework.driver.irmatching.irmethod.NotCompiledIRMethod; +import compiler.lib.ir_framework.driver.irmatching.parser.hotspot.HotSpotPidFileParser; +import compiler.lib.ir_framework.driver.irmatching.parser.hotspot.LoggedMethod; +import compiler.lib.ir_framework.driver.irmatching.parser.hotspot.LoggedMethods; + +import java.util.Map; +import java.util.SortedSet; +import java.util.TreeSet; + +/** + * Class to create {@link IRMethod} instances by combining the elements of {@link TestMethods} and {@link LoggedMethods}. + */ +class IRMethodBuilder { + private final Map loggedMethods; + private final TestMethods testMethods; + + public IRMethodBuilder(TestMethods testMethods, LoggedMethods loggedMethods) { + this.testMethods = testMethods; + this.loggedMethods = loggedMethods.loggedMethods(); + } + + /** + * Create IR methods for all test methods identified by {@link IREncodingParser} by combining them with the parsed + * compilation output from {@link HotSpotPidFileParser}. + */ + public SortedSet build() { + SortedSet irMethods = new TreeSet<>(); + testMethods.testMethods().forEach( + (methodName, testMethod) -> irMethods.add(createIRMethod(methodName, testMethod))); + return irMethods; + } + + private IRMethodMatchable createIRMethod(String methodName, TestMethod testMethod) { + LoggedMethod loggedMethod = loggedMethods.get(methodName); + if (loggedMethod != null) { + return new IRMethod(testMethod.method(), testMethod.irRuleIds(), testMethod.irAnnos(), + new Compilation(loggedMethod.compilationOutput())); + } else { + return new NotCompiledIRMethod(testMethod.method(), testMethod.irRuleIds().length); + } + } +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/Line.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/Line.java deleted file mode 100644 index face83d09a5..00000000000 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/Line.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package compiler.lib.ir_framework.driver.irmatching.parser; - -import compiler.lib.ir_framework.CompilePhase; -import compiler.lib.ir_framework.TestFramework; - -import java.io.BufferedReader; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * Class representing a normal line read from the hotspot_pid* file. - */ -class Line extends AbstractLine { - private static final Pattern IDEAL_COMPILE_PHASE_PATTERN = Pattern.compile(""); - public Line(BufferedReader reader, Pattern compileIdPatternForTestClass) { - super(reader, compileIdPatternForTestClass); - } - - /** - * Is this line a start of a PrintIdeal or PrintOptoAssembly output block? - */ - public boolean isBlockStart() { - return isPrintIdealStart() || isPrintOptoAssemblyStart(); - } - - /** - * Is this line a start of a PrintIdeal output block? - */ - public boolean isPrintIdealStart() { - // Ignore OSR compilations which have compile_kind set. - return line.startsWith(" testClass; - public MethodCompilationParser(Class testClass) { + public TestClassParser(Class testClass) { this.testClass = testClass; } @@ -48,11 +53,25 @@ public class MethodCompilationParser { */ public Matchable parse(String hotspotPidFileName, String irEncoding) { IREncodingParser irEncodingParser = new IREncodingParser(testClass); - Map testMethodMap = irEncodingParser.parse(irEncoding); - if (!testMethodMap.isEmpty()) { - HotSpotPidFileParser hotSpotPidFileParser = new HotSpotPidFileParser(testClass.getName(), testMethodMap); - return hotSpotPidFileParser.parse(hotspotPidFileName); + TestMethods testMethods = irEncodingParser.parse(irEncoding); + if (testMethods.hasTestMethods()) { + HotSpotPidFileParser hotSpotPidFileParser = new HotSpotPidFileParser(testClass.getName(), testMethods); + LoggedMethods loggedMethods = hotSpotPidFileParser.parse(hotspotPidFileName); + return createTestClass(testMethods, loggedMethods); } return new NonIRTestClass(); } + + /** + * Create test class with IR methods for all test methods identified by {@link IREncodingParser} by combining them + * with the parsed compilation output from {@link HotSpotPidFileParser}. + */ + private Matchable createTestClass(TestMethods testMethods, LoggedMethods loggedMethods) { + IRMethodBuilder irMethodBuilder = new IRMethodBuilder(testMethods, loggedMethods); + SortedSet irMethods = irMethodBuilder.build(); + TestFormat.throwIfAnyFailures(); + return new TestClass(irMethods); + } + } + diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/TestMethod.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/TestMethod.java index b2168f854fe..8491b8d61eb 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/TestMethod.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/TestMethod.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,80 +23,40 @@ package compiler.lib.ir_framework.driver.irmatching.parser; -import compiler.lib.ir_framework.CompilePhase; import compiler.lib.ir_framework.IR; -import compiler.lib.ir_framework.TestFramework; -import compiler.lib.ir_framework.driver.irmatching.Compilation; import compiler.lib.ir_framework.driver.irmatching.irmethod.IRMethod; -import compiler.lib.ir_framework.driver.irmatching.irmethod.IRMethodMatchable; -import compiler.lib.ir_framework.driver.irmatching.irmethod.NotCompiledIRMethod; +import compiler.lib.ir_framework.driver.irmatching.parser.hotspot.LoggedMethod; import java.lang.reflect.Method; -import java.util.LinkedHashMap; -import java.util.Map; /** - * This class represents a test method that is incrementally updated with new information parsed by {@link IREncodingParser} - * and {@link HotSpotPidFileParser}. Once the parsers are finished, an {@link IRMethod} object can be fetched from the - * collected data with {@link TestMethod#createIRMethod()}. + * This class represents a test method parsed by {@link IREncodingParser}. In combination with the associated + * {@link LoggedMethod}, a new {@link IRMethod} is created to IR match on later. * * @see IREncodingParser - * @see HotSpotPidFileParser + * @see LoggedMethod * @see IRMethod */ public class TestMethod { private final Method method; + private final IR[] irAnnos; private final int[] irRuleIds; - private final Map compilationOutputMap; - private boolean compiled; // Was this method compiled (i.e. found in hotspot_pid* file?) - public TestMethod(Method m, int[] irRuleIds) { + public TestMethod(Method m, IR[] irAnnos, int[] irRuleIds) { this.method = m; + this.irAnnos = irAnnos; this.irRuleIds = irRuleIds; - this.compilationOutputMap = new LinkedHashMap<>(); // Keep order of insertion - this.compiled = false; } - public void setCompiled() { - this.compiled = true; + public Method method() { + return method; } - public IRMethodMatchable createIRMethod() { - IR[] irAnnos = method.getAnnotationsByType(IR.class); - TestFramework.check(irAnnos.length > 0, "must have at least one IR rule"); - TestFramework.check(irRuleIds.length > 0, "must have at least one IR rule"); - if (compiled) { - return new IRMethod(method, irRuleIds, irAnnos, new Compilation(compilationOutputMap)); - } else { - return new NotCompiledIRMethod(method, irRuleIds.length); - } + public IR[] irAnnos() { + return irAnnos; } - /** - * Clear the collected ideal and opto assembly output of all phases. This is necessary when having multiple - * compilations of the same method. We only want to keep the very last compilation which is the one requested by - * the framework. - */ - public void clearOutput() { - compilationOutputMap.clear(); - } - - /** - * We might parse multiple C2 compilations of this method. Only keep the very last one by overriding the outputMap. - */ - public void setIdealOutput(String idealOutput, CompilePhase compilePhase) { - String idealOutputWithHeader = "> Phase \"" + compilePhase.getName()+ "\":" + System.lineSeparator() - + idealOutput; - if (!compilationOutputMap.containsKey(compilePhase) || compilePhase.overrideRepeatedPhase()) { - compilationOutputMap.put(compilePhase, idealOutputWithHeader); - } - } - - /** - * We might parse multiple C2 compilations of this method. Only keep the very last one by overriding the outputMap. - */ - public void setOptoAssemblyOutput(String optoAssemblyOutput) { - optoAssemblyOutput = "> Phase \"PrintOptoAssembly\":" + System.lineSeparator() + optoAssemblyOutput; - compilationOutputMap.put(CompilePhase.PRINT_OPTO_ASSEMBLY, optoAssemblyOutput); + public int[] irRuleIds() { + return irRuleIds; } } diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/FileCorruptedException.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/TestMethods.java similarity index 50% rename from test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/FileCorruptedException.java rename to test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/TestMethods.java index 5681eb662ee..ecc8fb4e0b9 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/FileCorruptedException.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/TestMethods.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,11 +23,38 @@ package compiler.lib.ir_framework.driver.irmatching.parser; +import compiler.lib.ir_framework.driver.irmatching.irmethod.IRMethod; +import compiler.lib.ir_framework.driver.irmatching.parser.hotspot.HotSpotPidFileParser; + +import java.util.Map; + /** - * Exception thrown when facing an unexpected format during parsing of the hotspot-pid* file + * This class stores all test methods that need to be IR matched as identified by {@link IREncodingParser}. + * + * @see IREncodingParser + * @see HotSpotPidFileParser + * @see IRMethod */ -class FileCorruptedException extends RuntimeException { - public FileCorruptedException(String s) { - super(s); +public class TestMethods { + /** + * "Method name" -> TestMethod map created by {@link IREncodingParser} which contains an entry for each method that + * needs to be IR matched on. + */ + private final Map testMethods; + + public TestMethods(Map testMethods) { + this.testMethods = testMethods; + } + + public Map testMethods() { + return testMethods; + } + + public boolean isTestMethod(String method) { + return testMethods.containsKey(method); + } + + public boolean hasTestMethods() { + return !testMethods.isEmpty(); } } diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/hotspot/CompilePhaseBlock.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/hotspot/CompilePhaseBlock.java new file mode 100644 index 00000000000..16cc62f9c57 --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/hotspot/CompilePhaseBlock.java @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package compiler.lib.ir_framework.driver.irmatching.parser.hotspot; + +import compiler.lib.ir_framework.CompilePhase; + +/** + * This class represents a single compile phase block of a {@link LoggedMethod}. + */ +class CompilePhaseBlock { + public static final String SAFEPOINT_WHILE_PRINTING_MESSAGE = ""; + + /** + * Dummy object for a block that we do not need to parse. + */ + public static final CompilePhaseBlock DONT_CARE = new CompilePhaseBlock(CompilePhase.DEFAULT); + + private final CompilePhase compilePhase; + private final StringBuilder builder; + /** + * Stores an incomplete line that was interrupted by a safepoint. + * Needs to be merged with the immediately following line. + */ + private String incompleteLine = ""; + + public CompilePhaseBlock(CompilePhase compilePhase) { + this.compilePhase = compilePhase; + String blockHeader = "> Phase \"" + compilePhase.getName() + "\":" + System.lineSeparator(); + this.builder = new StringBuilder(blockHeader); + } + + public CompilePhase compilePhase() { + return compilePhase; + } + + /** + * Is this line a start of an ideal or opto assembly output block? + */ + public static boolean isBlockStartLine(String line) { + return (isPrintIdealStart(line) || isPrintOptoAssemblyStart(line)) && notOSRCompilation(line); + } + + /** + * Is this line a start of an ideal output block? + */ + public static boolean isPrintIdealStart(String line) { + // Ignore OSR compilations which have compile_kind set. + return line.startsWith(" compileIdToMethodName = new HashMap<>(); + + public CompileQueueMessages(String testClassName, TestMethods testMethods) { + this.compileIdTestMethodPattern = Pattern.compile("compile_id='(\\d+)'.*" + Pattern.quote(testClassName) + " (\\S+)"); + this.testMethodPattern = Pattern.compile(Pattern.quote(testClassName) + " (\\S+)"); + this.testMethods = testMethods; + } + + public boolean isTestMethodQueuedLine(String line) { + return isCompilation(line) && isTestMethod(line); + } + + /** + * Is this header a C2 non-OSR compilation header entry? + */ + private boolean isCompilation(String line) { + return line.startsWith(""); + + private final Map compilationOutput = new LinkedHashMap<>(); + private CompilePhaseBlock compilePhaseBlock; + + public LoggedMethod() { + this.compilePhaseBlock = CompilePhaseBlock.DONT_CARE; + } + + public Map compilationOutput() { + return compilationOutput; + } + + public boolean hasActiveBlock() { + return compilePhaseBlock != CompilePhaseBlock.DONT_CARE; + } + + public void addLine(String line) { + if (hasActiveBlock()) { + compilePhaseBlock.addLine(line); + } + } + + public void beginPrintIdealBlock(String line) { + Matcher matcher = IDEAL_COMPILE_PHASE_PATTERN.matcher(line); + TestFramework.check(matcher.find(), "must always find \"compile_phase\" in ideal entry in " + line); + CompilePhase compilePhase = CompilePhase.forName(matcher.group(1)); + beginBlock(compilePhase); + } + + public void beginPrintOptoAssemblyBlock() { + beginBlock(CompilePhase.PRINT_OPTO_ASSEMBLY); + } + + private void beginBlock(CompilePhase compilePhase) { + if (compilationOutput.containsKey(compilePhase) && !compilePhase.overrideRepeatedPhase()) { + // We only want to keep the first compilation output for this phase. + compilePhaseBlock = CompilePhaseBlock.DONT_CARE; + } else { + compilePhaseBlock = new CompilePhaseBlock(compilePhase); + } + } + + public void terminateBlock() { + if (hasActiveBlock()) { + compilationOutput.put(compilePhaseBlock.compilePhase(), compilePhaseBlock.content()); + compilePhaseBlock = CompilePhaseBlock.DONT_CARE; + } + } +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/hotspot/LoggedMethods.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/hotspot/LoggedMethods.java new file mode 100644 index 00000000000..a462c635a3f --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/hotspot/LoggedMethods.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package compiler.lib.ir_framework.driver.irmatching.parser.hotspot; + +import compiler.lib.ir_framework.TestFramework; + +import java.util.HashMap; +import java.util.Map; + +/** + * This class keeps track of all {@link LoggedMethod} instances. + */ +public class LoggedMethods { + private final Map loggedMethods = new HashMap<>(); + + public Map loggedMethods() { + return loggedMethods; + } + + public LoggedMethod loggedMethod(String methodName) { + LoggedMethod loggedMethod = loggedMethods.get(methodName); + TestFramework.check(loggedMethod != null, "must exist"); + return loggedMethod; + } + + /** + * Always creates a new LoggedMethod to drop the already collected ideal and opto assembly outputs of the same method. + * We only want to keep the very last compilation of a method which is the one requested by the framework. + */ + public void registerMethod(String methodName) { + loggedMethods.put(methodName, new LoggedMethod()); + } + +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/hotspot/State.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/hotspot/State.java new file mode 100644 index 00000000000..75d6b060cb2 --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/hotspot/State.java @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package compiler.lib.ir_framework.driver.irmatching.parser.hotspot; + +import compiler.lib.ir_framework.driver.irmatching.parser.TestMethods; + +/** + * This class holds the current state of the parsing of the hotspot_pid* file. + */ +class State { + private final WriterThreads writerThreads; + private WriterThread writerThread; + private final CompileQueueMessages compileQueueMessages; + private final LoggedMethods loggedMethods; + private LoggedMethod loggedMethod = LoggedMethod.DONT_CARE; + + public State(String testClassName, TestMethods testMethods) { + this.compileQueueMessages = new CompileQueueMessages(testClassName, testMethods); + this.loggedMethods = new LoggedMethods(); + this.writerThreads = new WriterThreads(); + } + + public LoggedMethods loggedMethods() { + return loggedMethods; + } + + public void update(String line) { + if (WriterThread.isWriterThreadLine(line)) { + processWriterThreadLine(line); + } else if (compileQueueMessages.isTestMethodQueuedLine(line)) { + processCompileQueueLine(line); + } else if (CompilePhaseBlock.isBlockStartLine(line)) { + processBlockStartLine(line); + } else if (CompilePhaseBlock.isBlockEndLine(line)) { + processBlockEndLine(); + } else { + processNormalLine(line); + } + } + + private void processWriterThreadLine(String line) { + if (loggedMethod.hasActiveBlock()) { + // The current compile phase block was interrupted due to a safepoint. Save and restore later. + writerThread.saveLoggedMethod(loggedMethod); + } + writerThread = writerThreads.parse(line); + loggedMethod = writerThread.restoreLoggedMethod(); + } + + private void processCompileQueueLine(String line) { + String methodName = compileQueueMessages.parse(line); + loggedMethods.registerMethod(methodName); + } + + private void processBlockStartLine(String line) { + String methodName = compileQueueMessages.findTestMethodName(line); + if (!methodName.isEmpty()) { + loggedMethod = loggedMethods.loggedMethod(methodName); + if (CompilePhaseBlock.isPrintIdealStart(line)) { + loggedMethod.beginPrintIdealBlock(line); + } else { + loggedMethod.beginPrintOptoAssemblyBlock(); + } + } + } + + private void processBlockEndLine() { + loggedMethod.terminateBlock(); + } + + private void processNormalLine(String line) { + loggedMethod.addLine(line); + } +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/Block.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/hotspot/WriterThread.java similarity index 51% rename from test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/Block.java rename to test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/hotspot/WriterThread.java index 8bc80e107f5..302bd203277 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/Block.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/hotspot/WriterThread.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,23 +21,31 @@ * questions. */ -package compiler.lib.ir_framework.driver.irmatching.parser; - -import java.util.List; +package compiler.lib.ir_framework.driver.irmatching.parser.hotspot; /** - * Class representing a PrintIdeal or PrintOptoAssembly output block read from the hotspot_pid* file. + * This class represents a writer thread that emits log messages with LogCompilation. It saves and restores a currently + * parsed {@link LoggedMethod} if a {@link CompilePhaseBlock} was interrupted before reaching the block end tag. + * + * @see LoggedMethod + * @see CompilePhaseBlock */ -record Block(String output, List testClassCompilations) { - public String getOutput() { - return output; +class WriterThread { + private LoggedMethod loggedMethod = LoggedMethod.DONT_CARE; + + public static boolean isWriterThreadLine(String line) { + return line.startsWith(" getTestClassCompilations() { - return testClassCompilations; + public LoggedMethod restoreLoggedMethod() { + LoggedMethod restoredLoggedMethod = loggedMethod; + if (restoredLoggedMethod != LoggedMethod.DONT_CARE) { + loggedMethod = LoggedMethod.DONT_CARE; + } + return restoredLoggedMethod; } } diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/BlockLine.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/hotspot/WriterThreads.java similarity index 53% rename from test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/BlockLine.java rename to test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/hotspot/WriterThreads.java index dcef79a0da3..76b096a3f3d 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/BlockLine.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/hotspot/WriterThreads.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,24 +21,30 @@ * questions. */ -package compiler.lib.ir_framework.driver.irmatching.parser; +package compiler.lib.ir_framework.driver.irmatching.parser.hotspot; -import java.io.BufferedReader; +import compiler.lib.ir_framework.TestFramework; + +import java.util.HashMap; +import java.util.Map; +import java.util.regex.Matcher; import java.util.regex.Pattern; /** - * Class representing a block line inside a PrintIdeal or PrintOptoAssembly output block read from the hotspot_pid* file. + * This class keeps track of all {@link WriterThread} instances. */ -class BlockLine extends AbstractLine { +class WriterThreads { + private final Map mapIdToThread = new HashMap<>(); - public BlockLine(BufferedReader reader, Pattern compileIdPatternForTestClass) { - super(reader, compileIdPatternForTestClass); + WriterThread parse(String line) { + int writerThreadId = parseWriterThreadId(line); + return mapIdToThread.computeIfAbsent(writerThreadId, c -> new WriterThread()); } - /** - * Is this line an end of a PrintIdeal or PrintOptoAssembly output block? - */ - public boolean isBlockEnd() { - return line.startsWith(" testVMFlags = flagVMProcess.getTestVMFlags(); TestVMProcess testVMProcess = new TestVMProcess(testVMFlags, testClass, null, -1); - MethodCompilationParser methodCompilationParser = new MethodCompilationParser(testClass); - Matchable testClassMatchable = methodCompilationParser.parse(testVMProcess.getHotspotPidFileName(), - testVMProcess.getIrEncoding()); + TestClassParser testClassParser = new TestClassParser(testClass); + Matchable testClassMatchable = testClassParser.parse(testVMProcess.getHotspotPidFileName(), + testVMProcess.getIrEncoding()); MatchResult result = testClassMatchable.match(); List expectedFails = new ExpectedFailsBuilder().build(testClass); List foundFailures = new FailureBuilder().build(result); diff --git a/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestRunTests.java b/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestRunTests.java index d2c83edde7e..f8d64944ff4 100644 --- a/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestRunTests.java +++ b/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestRunTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -51,7 +51,7 @@ public class TestRunTests { TestFramework.run(); try { TestFramework.run(BadStandalone.class); - Utils.shouldHaveThrownException(baos.toString()); + Asserts.fail("Should have thrown exception"); } catch (IRViolationException e) { System.setOut(oldOut); String[] matches = { "test(int)", "test2(int)", "Failed IR Rules (2)"}; diff --git a/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestSafepointWhilePrinting.java b/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestSafepointWhilePrinting.java new file mode 100644 index 00000000000..ee5ee38e331 --- /dev/null +++ b/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestSafepointWhilePrinting.java @@ -0,0 +1,143 @@ +/* + * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package compiler.testlibrary_tests.ir_framework.tests; + +import compiler.lib.ir_framework.CompilePhase; +import compiler.lib.ir_framework.IR; +import compiler.lib.ir_framework.IRNode; +import compiler.lib.ir_framework.Test; +import compiler.lib.ir_framework.driver.irmatching.IRMatcher; +import compiler.lib.ir_framework.driver.irmatching.Matchable; +import compiler.lib.ir_framework.driver.irmatching.parser.TestClassParser; +import jdk.test.lib.Utils; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; + +/* + * @test + * @bug 8300273 + * @requires vm.debug == true & vm.flagless + * @summary Test TestClassParser such that it correctly parses the hotspot_pid* files with safepoint interruption messages + * @library /test/lib /testlibrary_tests / + * @build jdk.test.whitebox.WhiteBox + * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox + * @run junit/othervm -Xbootclasspath/a:. -DSkipWhiteBoxInstall=true -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI compiler.testlibrary_tests.ir_framework.tests.TestSafepointWhilePrinting + */ +public class TestSafepointWhilePrinting { + static int iFld; + + @org.junit.Test + public void test() throws IOException { + String hotspotPidFileName = "safepoint_while_printing_hotspot_pid.log"; + Path hotspotPidFilePath = Paths.get(Utils.TEST_SRC).resolve(hotspotPidFileName); + // Copy file to current workdir + Files.copy(hotspotPidFilePath, Paths.get("").resolve(hotspotPidFileName), + StandardCopyOption.REPLACE_EXISTING); + + String irEncoding = + """ + ##### IRMatchRulesEncoding - used by TestFramework ##### + ,{comma separated applied @IR rule ids} + test1,1 + test2,1 + testSafepointInBlock,1 + testQueueInBlock1,1 + testQueueInBlock2,1 + testDoubleInterruptOuter,1 + testDoubleInterruptMiddle,1 + testDoubleInterruptInner,1 + testCompilePhaseBackToBackFirst,1 + testCompilePhaseBackToBackLast,1 + ----- END ----- + """; + TestClassParser testClassParser = new TestClassParser(TestSafepointWhilePrinting.class); + Matchable testClassMatchable = testClassParser.parse(hotspotPidFileName, irEncoding); + IRMatcher matcher = new IRMatcher(testClassMatchable); + matcher.match(); + } + + @Test + @IR(counts = {IRNode.CMP_UL3, "1"}) + public void test1() { + iFld = 34; + } + + @Test + @IR(counts = {IRNode.CMP_UL3, "1"}) + public void test2() { + iFld = 34; + } + + @Test + @IR(counts = {"testSafepointInBlock @ bci:-1", "1"}, phase = CompilePhase.PRINT_IDEAL) + public void testSafepointInBlock() { + iFld = 34; + } + + @Test + @IR(counts = {"testQueueInBlock1 @ bci:-1", "1"}, phase = CompilePhase.PRINT_IDEAL) + public void testQueueInBlock1() { + iFld = 34; + } + + @Test + @IR(counts = {"testQueueInBlock2 @ bci:-1", "1"}, phase = CompilePhase.PRINT_IDEAL) + public void testQueueInBlock2() { + iFld = 34; + } + @Test + @IR(counts = {"!jvms: TestSafepointWhilePrinting::testDoubleInterruptOuter", "1"}, phase = CompilePhase.PRINT_IDEAL) + public void testDoubleInterruptOuter() { + iFld = 34; + } + + @Test + @IR(counts = {"testDoubleInterruptMiddle @ bci:-1", "1", IRNode.CMP_UL3, "1"}, phase = CompilePhase.PRINT_IDEAL) + public void testDoubleInterruptMiddle() { + iFld = 34; + } + + @Test + @IR(counts = {IRNode.CON_L, "1"}, phase = CompilePhase.PRINT_IDEAL) + public void testDoubleInterruptInner() { + iFld = 34; + } + + @Test + @IR(counts = {"(line 115)", "1", IRNode.CMP_UL3, "1"}, phase = {CompilePhase.AFTER_PARSING, CompilePhase.BEFORE_MATCHING}) + public void testCompilePhaseBackToBackFirst() { + iFld = 34; + } + + @Test + @IR(counts = {"(line 115)", "1", IRNode.CMP_UL3, "1"}, phase = {CompilePhase.AFTER_PARSING, CompilePhase.BEFORE_MATCHING}) + public void testCompilePhaseBackToBackLast() { + iFld = 34; + } +} diff --git a/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestScenarios.java b/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestScenarios.java index b54724cccf6..32787c33d9a 100644 --- a/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestScenarios.java +++ b/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestScenarios.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -52,20 +52,20 @@ public class TestScenarios { Scenario s3dup = new Scenario(3, "-XX:TLABRefillWasteFraction=53"); try { new TestFramework().addScenarios(sDefault, s1, s2, s3).start(); - Utils.shouldHaveThrownException(baos.toString()); + Asserts.fail("Should have thrown exception"); } catch (TestRunException e) { if (!e.getMessage().contains("The following scenarios have failed: #0, #1, #3")) { - Utils.throwIfNoSafepointPrinting(baos.toString(), e); + throw e; } } baos.reset(); try { new TestFramework().addScenarios(s1, s2, s3).start(); - Utils.shouldHaveThrownException(baos.toString()); + Asserts.fail("Should have thrown exception"); } catch (TestRunException e) { if (!e.getMessage().contains("The following scenarios have failed: #1, #3")) { - Utils.throwIfNoSafepointPrinting(baos.toString(), e); + throw e; } } System.setOut(oldOut); diff --git a/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/Utils.java b/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/Utils.java deleted file mode 100644 index 676c3bfa373..00000000000 --- a/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/Utils.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package ir_framework.tests; - -import compiler.lib.ir_framework.driver.irmatching.IRMatcher; -import jdk.test.lib.Asserts; - -public class Utils { - public static void shouldHaveThrownException(String output) { - // Do not throw an exception if we hit a safepoint while printing which could possibly let the IR matching fail. - // This happens very rarely. If there is a problem with the test, then we will catch that on the next test invocation. - if (!output.contains(IRMatcher.SAFEPOINT_WHILE_PRINTING_MESSAGE)) { - Asserts.fail("Should have thrown exception"); - } - } - - public static void throwIfNoSafepointPrinting(String output, RuntimeException e) { - if (!output.contains(IRMatcher.SAFEPOINT_WHILE_PRINTING_MESSAGE)) { - throw e; - } - } -} diff --git a/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/safepoint_while_printing_hotspot_pid.log b/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/safepoint_while_printing_hotspot_pid.log new file mode 100644 index 00000000000..2bdd2540f08 --- /dev/null +++ b/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/safepoint_while_printing_hotspot_pid.log @@ -0,0 +1,163 @@ + + 1682 967 b 3 jdk.test.lib.Asserts::assertEquals (7 bytes) + + + + + + + + + + 1716 995 3 compiler.testlibrary_tests.ir_framework.tests.TestSafepointWhilePrinting::compareLongWithImm5 (8 bytes) made not entrant + + 1716 1018 b 4 compiler.testlibrary_tests.ir_framework.tests.TestSafepointWhilePrinting::test1 (8 bytes) + + + + 1716 1008 b 3 java.util.Arrays::copyOfRange (90 bytes) + + 1716 1013 b 4 compiler.testlibrary_tests.ir_framework.tests.TestSafepointWhilePrinting::test2 (8 bytes) + + + + +AFTER: print_ideal + 0 Root === 0 26 [[ 0 1 3 24 ]] inner + 3 Start === 3 0 [[ 3 5 6 7 8 9 11 ]] #{0:control, 1:abIO, 2:memory, 3:rawptr:BotPTR, 4:return_address, 5:compiler/intrinsics/TestSafepointWhilePrinting:NotNull *, 6:long, 7:half} + 5 Parm === 3 [[ 26 ]] Control !jvms: TestSafepointWhilePrinting::test1 @ bci:-1 (line 115) + 6 Parm === 3 [[ 26 ]] I_O !jvms: + + +AFTER: print_ideal + 0 Root === 0 26 [[ 0 1 3 24 ]] inner + 3 Start === 3 0 [[ 3 5 6 7 8 9 11 ]] #{0:control, 1:abIO, 2:memory, 3:rawptr:BotPTR, 4:return_address, 5:compiler/intrinsics/TestSafepointWhilePrinting:NotNull *, 6:long, 7:half} + 5 Parm === 3 [[ 26 ]] Control !jvms: TestSafepointWhilePrinting::test2 @ bci:-1 (line 109) + 6 Parm === 3 [[ 26 ]] I_O !jvms: TestSafepointWhilePrinting::test2 @ bci:-1 (line 109) + 7 Parm === 3 [[ 26 ]] Memory Memory: @BotPTR *+bot, idx=Bot; !jvms: TestSafepointWhilePrinting::test2 @ bci:-1 (line 109) + 8 Parm === 3 [[ 26 ]] FramePtr !jvms: TestSafepointWhilePrinting::test2 @ bci:-1 (line 109) + 9 Parm === 3 [[ 26 ]] ReturnAdr !jvms: TestSafepointWhilePrinting::test2 @ bci:-1 (line 109) + 11 Parm === 3 [[ 25 ]] Parm1: long !jvms: TestSafepointWhilePrinting::test2 @ bci:-1 (line 109) + 24 ConL === 0 [[ 25 ]] #long:42 + 25 CmpUL3 === _ 11 24 [[ 26 ]] !jvms: TestSafepointWhilePrinting::test2 @ bci:4 (line 109) + 26 Return === 5 6 7 8 9 returns 25 [[ 0 ]] + + + TestSafepointWhilePrinting::test1 @ bci:-1 (line 115) + 7 Parm === 3 [[ 26 ]] Memory Memory: @BotPTR *+bot, idx=Bot; !jvms: TestSafepointWhilePrinting::test1 @ bci:-1 (line 115) + 8 Parm === 3 [[ 26 ]] FramePtr !jvms: TestSafepointWhilePrinting::test1 @ bci:-1 (line 115) + 9 Parm === 3 [[ 26 ]] ReturnAdr !jvms: TestSafepointWhilePrinting::test1 @ bci:-1 (line 115) + 11 Parm === 3 [[ 25 ]] Parm1: long !jvms: TestSafepointWhilePrinting::test1 @ bci:-1 (line 115) + 24 ConL === 0 [[ 25 ]] #long:172032 + 25 CmpUL3 === _ 11 24 [[ 26 ]] !jvms: TestSafepointWhilePrinting::test1 @ bci:4 (line 115) + 26 Return === 5 6 7 8 9 returns 25 [[ 0 ]] + + + + + 1784 993 3 compiler.intrinsics.TestCompareUnsigned::compareLongWithImm3 (8 bytes) made not entrant + 1784 1013 b 4 compiler.intrinsics.TestCompareUnsigned::compareLongWithImm1 (8 bytes) + +AFTER: print_ideal + 0 Root === 0 26 [[ 0 1 3 24 ]] inner + 8 Parm === 3 [[ 26 ]] FramePtr !jvms: TestSafepointWhilePrinting::testSafepointInBlock + @ bci:-1 (line 109) + 24 ConL === 0 [[ 25 ]] #long:42 + 26 Return === 5 6 7 8 9 returns 25 [[ 0 ]] + + + + + +AFTER: print_ideal + 0 Root === 0 26 [[ 0 1 3 24 ]] inner + 8 Parm === 3 [[ 26 ]] FramePtr !jvms: TestSafepointWhilePrinting::testQueueInBlock1 + + + + @ bci:-1 (line 109) + 24 ConL === 0 [[ 25 ]] #long:42 + 26 Return === 5 6 7 8 9 returns 25 [[ 0 ]] + + +AFTER: print_ideal + 0 Root === 0 26 [[ 0 1 3 24 ]] inner + 8 Parm === 3 [[ 26 ]] FramePtr !jvms: TestSafepointWhilePrinting::testQueueInBlock2 + @ bci:-1 (line 109) + 24 ConL === 0 [[ 25 ]] #long:42 + 26 Return === 5 6 7 8 9 returns 25 [[ 0 ]] + + + + + + + +AFTER: print_ideal + 0 Root === 0 26 [[ 0 1 3 24 ]] inner + 3 Start === 3 0 [[ 3 5 6 7 8 9 11 ]] #{0:control, 1:abIO, 2:memory, 3:rawptr:BotPTR, 4:return_address, 5:compiler/intrinsics/TestSafepointWhilePrinting:NotNull *, 6:long, 7:half} + 6 Parm === 3 [[ 26 ]] I_O !jvms: + + +AFTER: print_ideal + 0 Root === 0 26 [[ 0 1 3 24 ]] inner + 8 Parm === 3 [[ 26 ]] FramePtr !jvms: TestSafepointWhilePrinting::testDoubleInterruptMiddle + @ bci:-1 (line 109) + 25 Cmp + + + + + 24 ConL === 0 [[ 25 ]] #long:42 + 26 Return === 5 6 7 8 9 returns 25 [[ 0 ]] + + +UL3 === _ 11 24 [[ 26 ]] !jvms: TestSafepointWhilePrinting::test2 @ bci:4 (line 109) + 26 Return === 5 6 7 8 9 returns 25 [[ 0 ]] + + + TestSafepointWhilePrinting::testDoubleInterruptOuter @ bci:-1 (line 115) + 7 Parm === 3 [[ 26 ]] Memory Memory: @BotPTR *+bot, idx=Bot; !jvms: TestSafepointWhilePrinting::test1 @ bci:-1 (line 115) + 8 Parm === 3 [[ 26 ]] FramePtr !jvms: TestSafepointWhilePrinting::test1 @ bci:-1 (line 115) + 9 Parm === 3 [[ 26 ]] ReturnAdr !jvms: TestSafepointWhilePrinting::test1 @ bci:-1 (line 115) + 11 Parm === 3 [[ 25 ]] Parm1: long !jvms: TestSafepointWhilePrinting::test1 @ bci:-1 (line 115) + 24 ConL === 0 [[ 25 ]] #long:172032 + 25 CmpUL3 === _ 11 24 [[ 26 ]] !jvms: TestSafepointWhilePrinting::test1 @ bci:4 (line 115) + 26 Return === 5 6 7 8 9 returns 25 [[ 0 ]] + + + + + + 24 ConL === 0 [[ 25 ]] #long:172032 + 25 CmpUL + + + + 24 ConL === 0 [[ 25 ]] #long:172032 + 25 CmpUL3 === _ 11 24 [[ 26 ]] !jvms: TestSafepointWhilePrinting::test1 @ bci:4 (line 115) + + + 24 ConL === 0 [[ 25 ]] #long:172032 + 25 CmpU + +3 === _ 11 24 [[ 26 ]] !jvms: TestSafepointWhilePrinting::test1 @ bci:4 ( + +L3 === _ 11 24 [[ 26 ]] !jvms: TestSafepointWhilePrinting::test1 @ bci:4 (line + +line 115) + + + + + + 24 ConL === 0 [[ 25 ]] #long:172032 + 25 CmpU + +115) + + +L3 === _ 11 24 [[ 26 ]] !jvms: TestSafepointWhilePrinting::test1 @ bci:4 (line 115) + \ No newline at end of file