8375272: [IR Framework] Miscellaneous clean-ups

Reviewed-by: mchevalier, dfenacci, thartmann
This commit is contained in:
Christian Hagedorn 2026-01-26 16:23:30 +00:00
parent f4607ed0a7
commit bbae38e510
15 changed files with 153 additions and 84 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2026, 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
@ -581,7 +581,7 @@ void Compile::print_phase(const char* phase_name) {
tty->print_cr("%u.\t%s", ++_phase_counter, phase_name);
}
void Compile::print_ideal_ir(const char* phase_name) {
void Compile::print_ideal_ir(const char* compile_phase_name) const {
// keep the following output all in one block
// This output goes directly to the tty, not the compiler log.
// To enable tools to match it up with the compilation activity,
@ -593,7 +593,7 @@ void Compile::print_ideal_ir(const char* phase_name) {
stringStream ss;
if (_output == nullptr) {
ss.print_cr("AFTER: %s", phase_name);
ss.print_cr("AFTER: %s", compile_phase_name);
// Print out all nodes in ascending order of index.
// It is important that we traverse both inputs and outputs of nodes,
// so that we reach all nodes that are connected to Root.
@ -610,7 +610,7 @@ void Compile::print_ideal_ir(const char* phase_name) {
xtty->head("ideal compile_id='%d'%s compile_phase='%s'",
compile_id(),
is_osr_compilation() ? " compile_kind='osr'" : "",
phase_name);
compile_phase_name);
}
tty->print("%s", ss.as_string());
@ -671,7 +671,7 @@ Compile::Compile(ciEnv* ci_env, ciMethod* target, int osr_bci,
_coarsened_locks(comp_arena(), 8, 0, nullptr),
_congraph(nullptr),
NOT_PRODUCT(_igv_printer(nullptr) COMMA)
_unique(0),
_unique(0),
_dead_node_count(0),
_dead_node_list(comp_arena()),
_node_arena_one(mtCompiler, Arena::Tag::tag_node),
@ -865,7 +865,7 @@ Compile::Compile(ciEnv* ci_env, ciMethod* target, int osr_bci,
#ifndef PRODUCT
if (should_print_ideal()) {
print_ideal_ir("print_ideal");
print_ideal_ir("PrintIdeal");
}
#endif
@ -938,7 +938,7 @@ Compile::Compile(ciEnv* ci_env,
_for_merge_stores_igvn(comp_arena(), 8, 0, nullptr),
_congraph(nullptr),
NOT_PRODUCT(_igv_printer(nullptr) COMMA)
_unique(0),
_unique(0),
_dead_node_count(0),
_dead_node_list(comp_arena()),
_node_arena_one(mtCompiler, Arena::Tag::tag_node),
@ -5165,17 +5165,17 @@ void Compile::sort_macro_nodes() {
}
}
void Compile::print_method(CompilerPhaseType cpt, int level, Node* n) {
void Compile::print_method(CompilerPhaseType compile_phase, int level, Node* n) {
if (failing_internal()) { return; } // failing_internal to not stress bailouts from printing code.
EventCompilerPhase event(UNTIMED);
if (event.should_commit()) {
CompilerEvent::PhaseEvent::post(event, C->_latest_stage_start_counter, cpt, C->_compile_id, level);
CompilerEvent::PhaseEvent::post(event, C->_latest_stage_start_counter, compile_phase, C->_compile_id, level);
}
#ifndef PRODUCT
ResourceMark rm;
stringStream ss;
ss.print_raw(CompilerPhaseTypeHelper::to_description(cpt));
int iter = ++_igv_phase_iter[cpt];
ss.print_raw(CompilerPhaseTypeHelper::to_description(compile_phase));
int iter = ++_igv_phase_iter[compile_phase];
if (iter > 1) {
ss.print(" %d", iter);
}
@ -5203,8 +5203,8 @@ void Compile::print_method(CompilerPhaseType cpt, int level, Node* n) {
if (should_print_phase(level)) {
print_phase(name);
}
if (should_print_ideal_phase(cpt)) {
print_ideal_ir(CompilerPhaseTypeHelper::to_name(cpt));
if (should_print_ideal_phase(compile_phase)) {
print_ideal_ir(CompilerPhaseTypeHelper::to_name(compile_phase));
}
#endif
C->_latest_stage_start_counter.stamp();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2026, 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
@ -666,7 +666,7 @@ public:
uint next_igv_idx() { return _igv_idx++; }
bool trace_opto_output() const { return _trace_opto_output; }
void print_phase(const char* phase_name);
void print_ideal_ir(const char* phase_name);
void print_ideal_ir(const char* compile_phase_name) const;
bool should_print_ideal() const { return _directive->PrintIdealOption; }
bool parsed_irreducible_loop() const { return _parsed_irreducible_loop; }
void set_parsed_irreducible_loop(bool z) { _parsed_irreducible_loop = z; }
@ -680,7 +680,7 @@ public:
void begin_method();
void end_method();
void print_method(CompilerPhaseType cpt, int level, Node* n = nullptr);
void print_method(CompilerPhaseType compile_phase, int level, Node* n = nullptr);
#ifndef PRODUCT
bool should_print_igv(int level);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2026, 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
@ -161,7 +161,7 @@ public enum CompilePhase {
static {
for (CompilePhase phase : CompilePhase.values()) {
if (phase == PRINT_IDEAL) {
PHASES_BY_PARSED_NAME.put("print_ideal", phase);
PHASES_BY_PARSED_NAME.put("PrintIdeal", phase);
} else {
PHASES_BY_PARSED_NAME.put(phase.name(), phase);
}

View File

@ -183,7 +183,7 @@ public class TestFramework {
private List<String> flags;
private int defaultWarmup = -1;
private boolean testClassesOnBootClassPath;
private boolean isAllowNotCompilable = false;
private boolean allowNotCompilable = false;
/*
* Public interface methods
@ -498,7 +498,7 @@ public class TestFramework {
* and else it is ignored silently.
*/
public TestFramework allowNotCompilable() {
this.isAllowNotCompilable = true;
this.allowNotCompilable = true;
return this;
}
@ -721,7 +721,7 @@ public class TestFramework {
nonWhiteListedFlags.forEach((f) -> System.out.println(" - " + f));
}
System.out.println("");
System.out.println();
}
/**
@ -860,8 +860,8 @@ public class TestFramework {
private List<String> anyNonWhitelistedJTregVMAndJavaOptsFlags() {
List<String> flags = Arrays.stream(Utils.getTestJavaOpts())
.map(s -> s.replaceFirst("-XX:[+|-]?|-(?=[^D|^e])", ""))
.collect(Collectors.toList());
List<String> nonWhiteListedFlags = new ArrayList();
.toList();
List<String> nonWhiteListedFlags = new ArrayList<>();
for (String flag : flags) {
if (flag.contains("agentpath")) {
throw new SkippedException("Can't run test with -javaagent");
@ -877,10 +877,10 @@ public class TestFramework {
private void runTestVM(List<String> additionalFlags) {
TestVMProcess testVMProcess = new TestVMProcess(additionalFlags, testClass, helperClasses, defaultWarmup,
isAllowNotCompilable, testClassesOnBootClassPath);
allowNotCompilable, testClassesOnBootClassPath);
if (shouldVerifyIR) {
try {
TestClassParser testClassParser = new TestClassParser(testClass, isAllowNotCompilable);
TestClassParser testClassParser = new TestClassParser(testClass, allowNotCompilable);
Matchable testClassMatchable = testClassParser.parse(testVMProcess.getHotspotPidFileName(),
testVMProcess.getApplicableIRRules());
IRMatcher matcher = new IRMatcher(testClassMatchable);

View File

@ -38,7 +38,6 @@ import java.io.File;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
* This class prepares, creates, and runs the Test VM with verification of proper termination. The class also stores
@ -108,7 +107,7 @@ public class TestVMProcess {
cmds.add("-XX:+UnlockDiagnosticVMOptions");
cmds.add("-XX:+WhiteBoxAPI");
// Ignore CompileCommand flags which have an impact on the profiling information.
List<String> jtregVMFlags = Arrays.stream(Utils.getTestJavaOpts()).filter(s -> !s.contains("CompileThreshold")).collect(Collectors.toList());
List<String> jtregVMFlags = Arrays.stream(Utils.getTestJavaOpts()).filter(s -> !s.contains("CompileThreshold")).toList();
if (!PREFER_COMMAND_LINE_FLAGS) {
cmds.addAll(jtregVMFlags);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2026, 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
@ -32,6 +32,7 @@ import compiler.lib.ir_framework.driver.irmatching.Matchable;
import compiler.lib.ir_framework.driver.irmatching.MatchableMatcher;
import compiler.lib.ir_framework.driver.irmatching.irrule.IRRule;
import compiler.lib.ir_framework.driver.irmatching.parser.VMInfo;
import compiler.lib.ir_framework.driver.network.testvm.java.IRRuleIds;
import compiler.lib.ir_framework.shared.TestFormat;
import compiler.lib.ir_framework.shared.TestFormatException;
@ -53,14 +54,14 @@ public class IRMethod implements IRMethodMatchable {
private final Method method;
private final MatchableMatcher matcher;
public IRMethod(Method method, int[] ruleIds, IR[] irAnnos, Compilation compilation, VMInfo vmInfo) {
public IRMethod(Method method, IRRuleIds irRuleIds, IR[] irAnnos, Compilation compilation, VMInfo vmInfo) {
this.method = method;
this.matcher = new MatchableMatcher(createIRRules(method, ruleIds, irAnnos, compilation, vmInfo));
this.matcher = new MatchableMatcher(createIRRules(method, irRuleIds, irAnnos, compilation, vmInfo));
}
private List<Matchable> createIRRules(Method method, int[] ruleIds, IR[] irAnnos, Compilation compilation, VMInfo vmInfo) {
private List<Matchable> createIRRules(Method method, IRRuleIds irRuleIds, IR[] irAnnos, Compilation compilation, VMInfo vmInfo) {
List<Matchable> irRules = new ArrayList<>();
for (int ruleId : ruleIds) {
for (int ruleId : irRuleIds) {
try {
irRules.add(new IRRule(ruleId, irAnnos[ruleId - 1], compilation, vmInfo));
} catch (TestFormatException e) {
@ -89,13 +90,12 @@ public class IRMethod implements IRMethodMatchable {
return new IRMethodMatchResult(method, matcher.match());
}
List<MatchResult> match;
for (int i = 0; i < 10; i++) { // warm up
match = matcher.match();
matcher.match();
}
long startTime = System.nanoTime();
match = matcher.match();
List<MatchResult> match = matcher.match();
long endTime = System.nanoTime();
long duration = (endTime - startTime);
System.out.println("Verifying IR rules for " + name() + ": " + duration + " ns = " + (duration / 1000000) + " ms");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2025, 2026, 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
@ -24,8 +24,7 @@
package compiler.lib.ir_framework.driver.irmatching.irmethod;
import compiler.lib.ir_framework.IR;
import compiler.lib.ir_framework.Run;
import compiler.lib.ir_framework.RunMode;
import compiler.lib.ir_framework.Test;
import java.lang.reflect.Method;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2025, 2026, 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,8 +23,7 @@
package compiler.lib.ir_framework.driver.irmatching.irmethod;
import compiler.lib.ir_framework.Run;
import compiler.lib.ir_framework.RunMode;
import compiler.lib.ir_framework.Test;
import compiler.lib.ir_framework.driver.irmatching.MatchResult;
import compiler.lib.ir_framework.driver.irmatching.visitor.MatchResultVisitor;

View File

@ -26,12 +26,15 @@ 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.driver.network.testvm.java.IRRuleIds;
import compiler.lib.ir_framework.shared.TestFormat;
import compiler.lib.ir_framework.shared.TestFrameworkException;
import compiler.lib.ir_framework.test.ApplicableIRRulesPrinter;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -75,15 +78,15 @@ public class ApplicableIRRulesParser {
* assembly output in {@link HotSpotPidFileParser}.
*/
private void createTestMethodMap(String applicableIRRules, Class<?> testClass) {
Map<String, int[]> irRulesMap = parseApplicableIRRules(applicableIRRules);
Map<String, IRRuleIds> irRulesMap = parseApplicableIRRules(applicableIRRules);
createTestMethodsWithApplicableIRRules(testClass, irRulesMap);
}
/**
* Read the Applicable IR Rules emitted by the Test VM to decide if an @IR rule must be checked for a method.
*/
private Map<String, int[]> parseApplicableIRRules(String applicableIRRules) {
Map<String, int[]> irRulesMap = new HashMap<>();
private Map<String, IRRuleIds> parseApplicableIRRules(String applicableIRRules) {
Map<String, IRRuleIds> irRulesMap = new HashMap<>();
String[] applicableIRRulesLines = getApplicableIRRulesLines(applicableIRRules);
for (String s : applicableIRRulesLines) {
String line = s.trim();
@ -92,8 +95,8 @@ public class ApplicableIRRulesParser {
throw new TestFrameworkException("Invalid Applicable IR Rules format. No comma found: " + splitLine[0]);
}
String testName = splitLine[0];
int[] irRulesIdx = getRuleIndexes(splitLine);
irRulesMap.put(testName, irRulesIdx);
IRRuleIds irRuleIds = parseIrRulesIds(splitLine);
irRulesMap.put(testName, irRuleIds);
}
return irRulesMap;
}
@ -116,24 +119,24 @@ public class ApplicableIRRulesParser {
/**
* Parse rule indexes from a single line of the Applicable IR Rules in the format: <method,idx1,idx2,...>
*/
private int[] getRuleIndexes(String[] splitLine) {
int[] irRulesIdx = new int[splitLine.length - 1];
private IRRuleIds parseIrRulesIds(String[] splitLine) {
List<Integer> irRuleIds = new ArrayList<>();
for (int i = 1; i < splitLine.length; i++) {
try {
irRulesIdx[i - 1] = Integer.parseInt(splitLine[i]);
irRuleIds.add(Integer.parseInt(splitLine[i]));
} catch (NumberFormatException e) {
throw new TestFrameworkException("Invalid Applicable IR Rules format. No number found: " + splitLine[i]);
}
}
return irRulesIdx;
return new IRRuleIds(irRuleIds);
}
private void createTestMethodsWithApplicableIRRules(Class<?> testClass, Map<String, int[]> irRulesMap) {
private void createTestMethodsWithApplicableIRRules(Class<?> testClass, Map<String, IRRuleIds> irRulesMap) {
for (Method m : testClass.getDeclaredMethods()) {
IR[] irAnnos = m.getAnnotationsByType(IR.class);
if (irAnnos.length > 0) {
// Validation of legal @IR attributes and placement of the annotation was already done in Test VM.
int[] irRuleIds = irRulesMap.get(m.getName());
IRRuleIds irRuleIds = irRulesMap.get(m.getName());
validateIRRuleIds(m, irAnnos, irRuleIds);
if (hasAnyApplicableIRRules(irRuleIds)) {
testMethods.put(m.getName(), new TestMethod(m, irAnnos, irRuleIds));
@ -142,18 +145,18 @@ public class ApplicableIRRulesParser {
}
}
private void validateIRRuleIds(Method m, IR[] irAnnos, int[] ids) {
TestFramework.check(ids != null, "Should find method name in validIrRulesMap for " + m);
TestFramework.check(ids.length > 0, "Did not find any rule indices for " + m);
TestFramework.check((ids[0] >= 1 || ids[0] == ApplicableIRRulesPrinter.NO_RULE_APPLIED)
&& ids[ids.length - 1] <= irAnnos.length,
private void validateIRRuleIds(Method m, IR[] irAnnos, IRRuleIds irRuleIds) {
TestFramework.check(irRuleIds != null, "Should find method name in validIrRulesMap for " + m);
TestFramework.check(!irRuleIds.isEmpty(), "Did not find any rule indices for " + m);
TestFramework.check((irRuleIds.first() >= 1 || irRuleIds.first() == ApplicableIRRulesPrinter.NO_RULE_APPLIED)
&& irRuleIds.last() <= irAnnos.length,
"Invalid IR rule index found in validIrRulesMap for " + m);
}
/**
* Does the list of IR rules contain any applicable IR rules for the given conditions?
*/
private boolean hasAnyApplicableIRRules(int[] irRuleIds) {
return irRuleIds[0] != ApplicableIRRulesPrinter.NO_RULE_APPLIED;
private boolean hasAnyApplicableIRRules(IRRuleIds irRuleIds) {
return irRuleIds.first() != ApplicableIRRulesPrinter.NO_RULE_APPLIED;
}
}

View File

@ -71,9 +71,9 @@ class IRMethodBuilder {
Test[] testAnnos = testMethod.method().getAnnotationsByType(Test.class);
boolean allowMethodNotCompilable = allowNotCompilable || testAnnos[0].allowNotCompilable();
if (allowMethodNotCompilable) {
return new NotCompilableIRMethod(testMethod.method(), testMethod.irRuleIds().length);
return new NotCompilableIRMethod(testMethod.method(), testMethod.irRuleIds().count());
} else {
return new NotCompiledIRMethod(testMethod.method(), testMethod.irRuleIds().length);
return new NotCompiledIRMethod(testMethod.method(), testMethod.irRuleIds().count());
}
}
}

View File

@ -26,6 +26,7 @@ package compiler.lib.ir_framework.driver.irmatching.parser;
import compiler.lib.ir_framework.IR;
import compiler.lib.ir_framework.driver.irmatching.irmethod.IRMethod;
import compiler.lib.ir_framework.driver.irmatching.parser.hotspot.LoggedMethod;
import compiler.lib.ir_framework.driver.network.testvm.java.IRRuleIds;
import java.lang.reflect.Method;
@ -40,9 +41,9 @@ import java.lang.reflect.Method;
public class TestMethod {
private final Method method;
private final IR[] irAnnos;
private final int[] irRuleIds;
private final IRRuleIds irRuleIds;
public TestMethod(Method m, IR[] irAnnos, int[] irRuleIds) {
public TestMethod(Method m, IR[] irAnnos, IRRuleIds irRuleIds) {
this.method = m;
this.irAnnos = irAnnos;
this.irRuleIds = irRuleIds;
@ -56,7 +57,7 @@ public class TestMethod {
return irAnnos;
}
public int[] irRuleIds() {
public IRRuleIds irRuleIds() {
return irRuleIds;
}
}

View File

@ -0,0 +1,68 @@
/*
* Copyright (c) 2026, 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.network.testvm.java;
import compiler.lib.ir_framework.IR;
import compiler.lib.ir_framework.driver.irmatching.irmethod.IRMethod;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Stream;
/**
* Class to hold the indices of the applicable {@link IR @IR} rules of an {@link IRMethod}.
*/
public class IRRuleIds implements Iterable<Integer> {
private final List<Integer> ruleIds;
public IRRuleIds(List<Integer> ruleIds) {
this.ruleIds = ruleIds;
}
public int first() {
return ruleIds.getFirst();
}
public int last() {
return ruleIds.getLast();
}
public boolean isEmpty() {
return ruleIds.isEmpty();
}
public int count() {
return ruleIds.size();
}
@Override
public Iterator<Integer> iterator() {
return ruleIds.iterator();
}
public Stream<Integer> stream() {
return ruleIds.stream();
}
}

View File

@ -92,7 +92,7 @@ public class TestVM {
static final boolean XCOMP = Platform.isComp();
static final boolean VERBOSE = Boolean.getBoolean("Verbose");
private static final boolean PRINT_TIMES = Boolean.getBoolean("PrintTimes");
private static final boolean PRINT_TIMES = Boolean.getBoolean("PrintTimes") || VERBOSE;
public static final boolean USE_COMPILER = WHITE_BOX.getBooleanVMFlag("UseCompiler");
static final boolean EXCLUDE_RANDOM = Boolean.getBoolean("ExcludeRandom");
private static final String TESTLIST = System.getProperty("Test", "");
@ -823,14 +823,14 @@ public class TestVM {
forceCompileMap.forEach((key, value) -> builder.append("- ").append(key).append(" at CompLevel.").append(value)
.append(System.lineSeparator()));
throw new TestRunException("Could not force compile the following @ForceCompile methods:"
+ System.lineSeparator() + builder.toString());
+ System.lineSeparator() + builder);
}
/**
* Once all framework tests are collected, they are run in this method.
*/
private void runTests() {
TreeMap<Long, String> durations = (PRINT_TIMES || VERBOSE) ? new TreeMap<>() : null;
TreeMap<Long, String> durations = PRINT_TIMES ? new TreeMap<>() : null;
long startTime = System.nanoTime();
List<AbstractTest> testList;
boolean testFilterPresent = testFilterPresent();
@ -867,11 +867,11 @@ public class TestVM {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
builder.append(test.toString()).append(":").append(System.lineSeparator()).append(sw.toString())
builder.append(test).append(":").append(System.lineSeparator()).append(sw)
.append(System.lineSeparator()).append(System.lineSeparator());
failures++;
}
if (PRINT_TIMES || VERBOSE) {
if (PRINT_TIMES) {
long endTime = System.nanoTime();
long duration = (endTime - startTime);
durations.put(duration, test.getName());
@ -886,7 +886,7 @@ public class TestVM {
}
// Print execution times
if (VERBOSE || PRINT_TIMES) {
if (PRINT_TIMES) {
TestFrameworkSocket.write("Test execution times:", PRINT_TIMES_TAG, true);
for (Map.Entry<Long, String> entry : durations.entrySet()) {
TestFrameworkSocket.write(String.format("%-25s%15d ns%n", entry.getValue() + ":", entry.getKey()),
@ -898,7 +898,7 @@ public class TestVM {
// Finally, report all occurred exceptions in a nice format.
String msg = System.lineSeparator() + System.lineSeparator() + "Test Failures (" + failures + ")"
+ System.lineSeparator() + "----------------" + "-".repeat(String.valueOf(failures).length());
throw new TestRunException(msg + System.lineSeparator() + builder.toString());
throw new TestRunException(msg + System.lineSeparator() + builder);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2026, 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
@ -180,6 +180,12 @@ class BadIRAndRuntimeCheckedTests {
throw new BadCheckedTestException("expected");
}
}
static class BadCheckedTestException extends RuntimeException {
BadCheckedTestException(String s) {
super(s);
}
}
}
class BadIRCheckedTests {
@ -224,9 +230,3 @@ class BadIRCheckedTests {
}
}
}
class BadCheckedTestException extends RuntimeException {
BadCheckedTestException(String s) {
super(s);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, 2026, 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,7 +25,6 @@ package ir_framework.tests;
import compiler.lib.ir_framework.*;
import compiler.lib.ir_framework.driver.TestVMException;
import compiler.lib.ir_framework.shared.TestRunException;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
@ -360,10 +359,11 @@ class TestSetupTestsWithExpectedExceptions {
public void checkThrowInCheck(int x) {
throw new BadCheckedTestException("expected check");
}
}
class BadCheckedTestException extends RuntimeException {
BadCheckedTestException(String s) {
super(s);
static class BadCheckedTestException extends RuntimeException {
BadCheckedTestException(String s) {
super(s);
}
}
}