Skip to content

Commit 59b7fb1

Browse files
committed
8300273: [IR framework] Handle <!-- safepoint while printing --> message instead of bailing out
Reviewed-by: thartmann, kvn
1 parent 5b1584b commit 59b7fb1

28 files changed

+1076
-585
lines changed

src/hotspot/share/compiler/compileTask.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@ void CompileTask::log_task(xmlStream* log) {
338338
void CompileTask::log_task_queued() {
339339
ttyLocker ttyl;
340340
ResourceMark rm;
341+
NoSafepointVerifier nsv;
341342

342343
xtty->begin_elem("task_queued");
343344
log_task(xtty);

test/hotspot/jtreg/compiler/lib/ir_framework/TestFramework.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@
2929
import compiler.lib.ir_framework.driver.irmatching.IRMatcher;
3030
import compiler.lib.ir_framework.driver.irmatching.IRViolationException;
3131
import compiler.lib.ir_framework.driver.irmatching.Matchable;
32-
import compiler.lib.ir_framework.driver.irmatching.parser.MethodCompilationParser;
32+
import compiler.lib.ir_framework.driver.irmatching.parser.TestClassParser;
3333
import compiler.lib.ir_framework.shared.*;
3434
import compiler.lib.ir_framework.test.TestVM;
3535
import jdk.test.lib.Platform;
@@ -747,9 +747,9 @@ private void runTestVM(List<String> additionalFlags) {
747747
TestVMProcess testVMProcess = new TestVMProcess(additionalFlags, testClass, helperClasses, defaultWarmup);
748748
if (shouldVerifyIR) {
749749
try {
750-
MethodCompilationParser methodCompilationParser = new MethodCompilationParser(testClass);
751-
Matchable testClassMatchable = methodCompilationParser.parse(testVMProcess.getHotspotPidFileName(),
752-
testVMProcess.getIrEncoding());
750+
TestClassParser testClassParser = new TestClassParser(testClass);
751+
Matchable testClassMatchable = testClassParser.parse(testVMProcess.getHotspotPidFileName(),
752+
testVMProcess.getIrEncoding());
753753
IRMatcher matcher = new IRMatcher(testClassMatchable);
754754
matcher.match();
755755
} catch (IRViolationException e) {

test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/IRMatcher.java

+6-20
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -23,26 +23,25 @@
2323

2424
package compiler.lib.ir_framework.driver.irmatching;
2525

26-
import compiler.lib.ir_framework.driver.irmatching.parser.MethodCompilationParser;
26+
import compiler.lib.ir_framework.driver.irmatching.parser.TestClassParser;
2727
import compiler.lib.ir_framework.driver.irmatching.report.CompilationOutputBuilder;
2828
import compiler.lib.ir_framework.driver.irmatching.report.FailureMessageBuilder;
2929

3030
/**
31-
* This class performs IR matching on the prepared {@link TestClass} object parsed by {@link MethodCompilationParser}.
31+
* This class performs IR matching on the prepared {@link TestClass} object parsed by {@link TestClassParser}.
3232
* All applicable @IR rules are matched with all their defined compilation phases. If there are any IR matching failures,
3333
* an {@link IRViolationException} is reported which provides a formatted failure message and the compilation outputs
3434
* of the failed compilation phases.
3535
*/
3636
public class IRMatcher {
37-
public static final String SAFEPOINT_WHILE_PRINTING_MESSAGE = "<!-- safepoint while printing -->";
3837
private final Matchable testClass;
3938

4039
public IRMatcher(Matchable testClass) {
4140
this.testClass = testClass;
4241
}
4342

4443
/**
45-
* Do an IR matching of all methods with applicable @IR rules prepared with by the {@link MethodCompilationParser}.
44+
* Do an IR matching of all methods with applicable @IR rules prepared with by the {@link TestClassParser}.
4645
*/
4746
public void match() {
4847
MatchResult result = testClass.match();
@@ -58,20 +57,7 @@ public void match() {
5857
*/
5958
private void reportFailures(MatchResult result) {
6059
String failureMsg = new FailureMessageBuilder(result).build();
61-
String compilationOutput = new CompilationOutputBuilder(result).build();
62-
throwIfNoSafepointWhilePrinting(failureMsg, compilationOutput);
63-
}
64-
65-
/**
66-
* In some very rare cases, the hotspot_pid* file to IR match on contains "<!-- safepoint while printing -->"
67-
* (emitted by ttyLocker::break_tty_for_safepoint) which might be the reason for a matching error.
68-
* Do not throw an exception in this case (i.e. bailout).
69-
*/
70-
private void throwIfNoSafepointWhilePrinting(String failures, String compilations) {
71-
if (!compilations.contains(SAFEPOINT_WHILE_PRINTING_MESSAGE)) {
72-
throw new IRViolationException(failures, compilations);
73-
} else {
74-
System.out.println("Found " + SAFEPOINT_WHILE_PRINTING_MESSAGE + ", bail out of IR matching");
75-
}
60+
String compilationOutput = new CompilationOutputBuilder(result).build();
61+
throw new IRViolationException(failureMsg, compilationOutput);
7662
}
7763
}

test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/AbstractLine.java

-88
This file was deleted.

test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/BlockOutputReader.java

-73
This file was deleted.

0 commit comments

Comments
 (0)