JDK-8300273 : [IR framework] Handle message instead of bailing out
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 17,20,21
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2023-01-17
  • Updated: 2023-06-23
  • Resolved: 2023-02-02
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 21
21 b09Fixed
Related Reports
Relates :  
Relates :  
Description
Instead of bailing out of IR matching when encountering the "<!-- safepoint while printing -->" message, we should extend the HotSpotPidFileParser to handle this case. This would allow us to get rid of this special case handling in IR matching.


Original report:

With the following VM change, that should be harmless, TestCompareUnsigned.java fails intermittently (1/10):

diff --git a/src/hotspot/share/code/codeCache.cpp b/src/hotspot/share/code/codeCache.cpp
index 1ecefbe26c2..b463268dd68 100644
--- a/src/hotspot/share/code/codeCache.cpp
+++ b/src/hotspot/share/code/codeCache.cpp
@@ -1435,7 +1435,7 @@ void CodeCache::flush_dependents_on(InstanceKlass* dependee) {
     marked = mark_for_deoptimization(changes);
   }
 
-  if (marked > 0) {
+  if (true) {
     // At least one nmethod has been marked for deoptimization
     Deoptimization::deoptimize_all_marked();
   }



Run Test VM:
Command line: [/oracle/jdk/build/fastdebug/jdk/bin/java -cp /oracle/jdk/open/JTwork/classes/compiler/intrinsics/TestCompareUnsigned.d:/oracle/jdk/open/test/hotspot/jtreg/compiler/intrinsics:/oracle/jdk/open/JTwork/classes/test/lib:/oracle/jdk/open/test/lib:/oracle/jdk/open/JTwork/classes:/oracle/jdk/open/test/hotspot/jtreg:/home/tobias/programs/jtreg/lib/javatest.jar:/home/tobias/programs/jtreg/lib/jtreg.jar -Djava.library.path=. -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Dir.framework.server.port=40681 -XX:+PrintCompilation -XX:+UnlockDiagnosticVMOptions -XX:+LogCompilation -XX:CompilerDirectivesFile=test-vm-compile-commands-pid-560669.log -XX:CompilerDirectivesLimit=131 -XX:-OmitStackTraceInFastThrow -DShouldDoIRVerification=true -XX:-BackgroundCompilation -XX:CompileCommand=quiet -DWarmup=1 compiler.lib.ir_framework.test.TestVM compiler.intrinsics.TestCompareUnsigned ]
[2023-01-17T15:06:39.310899397Z] Gathering output for process 560694
[2023-01-17T15:06:41.293900861Z] Waiting for completion for process 560694
[2023-01-17T15:06:41.294021205Z] Waiting for completion finished for process 560694
Output and diagnostic info for process 560694 was saved into 'pid-560694-output.log'
[2023-01-17T15:06:41.309555163Z] Waiting for completion for process 560694
[2023-01-17T15:06:41.309656107Z] Waiting for completion finished for process 560694

Compilation of Failed Method
----------------------------
1) Compilation of "public int compiler.intrinsics.TestCompareUnsigned.lessThanInt(int,int)":
> Phase "PrintIdeal":
<empty>

STDERR:

Command Line:
/oracle/jdk/build/fastdebug/jdk/bin/java -DReproduce=true -cp /oracle/jdk/open/JTwork/classes/compiler/intrinsics/TestCompareUnsigned.d:/oracle/jdk/open/test/hotspot/jtreg/compiler/intrinsics:/oracle/jdk/open/JTwork/classes/test/lib:/oracle/jdk/open/test/lib:/oracle/jdk/open/JTwork/classes:/oracle/jdk/open/test/hotspot/jtreg:/home/tobias/programs/jtreg/lib/javatest.jar:/home/tobias/programs/jtreg/lib/jtreg.jar -Djava.library.path=. -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Dir.framework.server.port=40681 -XX:+PrintCompilation -XX:+UnlockDiagnosticVMOptions -XX:+LogCompilation -XX:CompilerDirectivesFile=test-vm-compile-commands-pid-560669.log -XX:CompilerDirectivesLimit=131 -XX:-OmitStackTraceInFastThrow -DShouldDoIRVerification=true -XX:-BackgroundCompilation -XX:CompileCommand=quiet -DWarmup=1 compiler.lib.ir_framework.test.TestVM compiler.intrinsics.TestCompareUnsigned

One or more @IR rules failed:

Failed IR Rules (2) of Methods (1)
----------------------------------
1) Method "public int compiler.intrinsics.TestCompareUnsigned.lessThanInt(int,int)" - [Failed IR rules: 2]:
   * @IR rule 1: "@compiler.lib.ir_framework.IR(phase={DEFAULT}, applyIfCPUFeatureAnd={}, applyIf={}, applyIfCPUFeatureOr={}, applyIfCPUFeature={}, counts={}, failOn={"_#CMP_U3#_"}, applyIfAnd={}, applyIfOr={}, applyIfNot={})"
     > Phase "PrintIdeal":
       - NO compilation output found for this phase! Make sure this phase is emitted or remove it from the list of compile phases in the @IR rule to match on.
   * @IR rule 2: "@compiler.lib.ir_framework.IR(phase={DEFAULT}, applyIfCPUFeatureAnd={}, applyIf={}, applyIfCPUFeatureOr={}, applyIfCPUFeature={}, counts={"_#CMP_U#_", "1"}, failOn={}, applyIfAnd={}, applyIfOr={}, applyIfNot={})"
     > Phase "PrintIdeal":
       - NO compilation output found for this phase! Make sure this phase is emitted or remove it from the list of compile phases in the @IR rule to match on.

>>> Check stdout for compilation output of the failed methods


  #############################################################
   - To only run the failed tests use -DTest, -DExclude,
     and/or -DScenarios.
   - To also get the standard output of the test VM run with
     -DReportStdout=true or for even more fine-grained logging
     use -DVerbose=true.
  #############################################################


compiler.lib.ir_framework.driver.irmatching.IRViolationException: There were one or multiple IR rule failures. Please check stderr for more information.
	at compiler.lib.ir_framework.driver.irmatching.IRMatcher.throwIfNoSafepointWhilePrinting(IRMatcher.java:72)
	at compiler.lib.ir_framework.driver.irmatching.IRMatcher.reportFailures(IRMatcher.java:62)
	at compiler.lib.ir_framework.driver.irmatching.IRMatcher.match(IRMatcher.java:50)
	at compiler.lib.ir_framework.TestFramework.runTestVM(TestFramework.java:754)
	at compiler.lib.ir_framework.TestFramework.start(TestFramework.java:719)
	at compiler.lib.ir_framework.TestFramework.start(TestFramework.java:339)
	at compiler.intrinsics.TestCompareUnsigned.main(TestCompareUnsigned.java:45)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
	at java.base/java.lang.reflect.Method.invoke(Method.java:578)
	at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:125)
	at java.base/java.lang.Thread.run(Thread.java:1623)

Comments
Changeset: 59b7fb1a Author: Christian Hagedorn <chagedorn@openjdk.org> Date: 2023-02-02 14:39:28 +0000 URL: https://git.openjdk.org/jdk/commit/59b7fb1a91c594f98f06b28cb95310a38565397d
02-02-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/12246 Date: 2023-01-27 09:31:40 +0000
27-01-2023

It's worth noting that non-failing runs often print: Found <!-- safepoint while printing -->, bail out of IR matching
17-01-2023

It might well be that this is expected behavior with the VM change but it was not obvious to me and should be investigated. ILW = IR framework failure due to missing compilation output, single test and only with VM changes, no workaround = MLH = P4
17-01-2023