JDK-8284115 : [IR Framework] Compilation is not found due to rare safepoint while dumping PrintIdeal/PrintOptoAssembly
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 19
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • CPU: x86_64
  • Submitted: 2022-03-31
  • Updated: 2022-11-11
  • Resolved: 2022-05-17
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 17 JDK 19
17.0.7-oracleFixed 19 b23Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
Test
compiler/c2/irTests/DivLNodeIdealizationTests.java
fails with 
One or more @IR rules failed:

Failed IR Rules (1) of Methods (1)
----------------------------------
1) Method "public long compiler.c2.irTests.DivLNodeIdealizationTests.retainDenominator(long,long)":
   * Method was not compiled. Did you specify any compiler directives preventing a compilation or used a @Run method in STANDALONE mode? In the latter case, make sure to always trigger a C2 compilation by invoking the test enough times.
>>> 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:91)
	at compiler.lib.ir_framework.driver.irmatching.IRMatcher.reportFailures(IRMatcher.java:82)
	at compiler.lib.ir_framework.driver.irmatching.IRMatcher.applyIRRules(IRMatcher.java:54)
	at compiler.lib.ir_framework.driver.irmatching.IRMatcher.<init>(IRMatcher.java:43)
	at compiler.lib.ir_framework.TestFramework.runTestVM(TestFramework.java:702)
	at compiler.lib.ir_framework.TestFramework.start(TestFramework.java:671)
	at compiler.lib.ir_framework.TestFramework.start(TestFramework.java:324)
	at compiler.lib.ir_framework.TestFramework.run(TestFramework.java:210)
	at compiler.lib.ir_framework.TestFramework.run(TestFramework.java:199)
	at compiler.c2.irTests.DivLNodeIdealizationTests.main(DivLNodeIdealizationTests.java:37)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
	at java.base/java.lang.reflect.Method.invoke(Method.java:577)
	at com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:312)
	at java.base/java.lang.Thread.run(Thread.java:1532)

Comments
Changeset: 39842538 Author: Christian Hagedorn <chagedorn@openjdk.org> Date: 2022-05-17 11:23:11 +0000 URL: https://git.openjdk.java.net/jdk/commit/39842538004c5fca57701070484c78cacf95ed64
17-05-2022

A pull request was submitted for review. URL: https://git.openjdk.java.net/jdk/pull/8692 Date: 2022-05-13 07:45:18 +0000
13-05-2022

I had a look at it and it seems to be another occurrence of safepoint interference while dumping the IR (see JDK-8271471). In this case here, I've found that the "<!-- safepoint while printing -->" message was emitted when dumping the IR of a method. During this interruption, another test class method was enqueued for compilation which is logged to the hotspot_pid file. The HotSpotPidFileParser looks for these messages in order to find and correctly map the PrintIdeal and PrintOptoAssembly outputs. However, the HotSpotPidFileParser does not expect such a queuing message to be found inside a PrintIdeal/PrintOptoAssembly block and thus ignores it (only happens when safepointing on rare occasions). As a result, we later do not parser the PrintIdeal and PrintOptoAssembly output of the enqueued method during the safepoint and fail with the assertion above that we did not find any compilation output for the method. Snippet of the hotspot_pid file: # PrintIdeal output of retainDenominator() 3 Start === 3 0 [[ 3 5 6 7 8 9 13 11 ]] #{0:control, 1:abIO, 2:memory, 3:rawptr:BotPTR, 4:return_address, 5:compiler/c2/irTests/DivLNodeIdealizationTests:NotNull *, 6:long, 7:half, 8:long, 9:half} 36 CallStaticJava === 34 6 7 8 9 ( 35 1 1 1 1 1 26 1 27 1 ) [[ 37 ]] # Static uncommon_trap(reason=&apos;div0_check&apos; action=&apos;maybe_recompile&apos; debug_id=&apos;0&apos;) void ( int ) C=0.000100 DivLNodeIdealizationTests::retainDenominator @ bci:4 (line 130) !jvms: DivLNodeIdealizationTests::retainDenominator<!-- safepoint while printing --> # Safepoint interruption <writer thread='40451'/> # Enqueuing of another test class method identityThird() <task_queued compile_id='205' method='compiler.c2.irTests.DivLNodeIdealizationTests identityThird (JJ)J' bytes='6' count='6000' iicount='6000' blocking='1' stamp='1.046' comment='whitebox' hot_count='6000'/> <writer thread='23811'/> @ bci:4 (line 130) # Continue to dump PrintIdeal of retainDenominator() 41 DivL === 33 26 13 [[ 42 ]] !jvms: DivLNodeIdealizationTests::retainDenominator @ bci:4 (line 130) 9 Parm === 3 [[ 42 36 ]] ReturnAdr !jvms: DivLNodeIdealizationTests::retainDenominator @ bci:-1 (line 130) Later we fail with the assertion that we did not find the compilation output of identityThird(). The fix should be to make the HotSpotPidFileParser aware of the possibilty of a safepoint when reading the PrintIdeal and PrintOptoAssembly output and therefore add a check if there was a method enqueued for compilation wile reading inside BlockOutputReader::readBlock(). I'm going to be away the next three week and will therefore only have a chance to come back to this afterwards. But as this only seem to be happening rarely, it should probably be fine to postpone this fix until I'm back.
08-04-2022

[~chagedorn] [~cslucas] This looks like either a bug in the tests or in the underlying IR test framework, any ideas?
08-04-2022

ILW = failure due to test bug; intermittent, low-frequency failure on single platform in debug mode; run the test with default JVM configuration = MLM = P4
08-04-2022

The test only seems to fail when run with the JVM flags "-server -XX:-TieredCompilation", as is done in tier 3.
08-04-2022

Here's a log file snippet from the jdk-19+18-1151-tier3 sightingOne or more @IR rules failed: Failed IR Rules (1) of Methods (1) ---------------------------------- 1) Method "public long compiler.c2.irTests.DivLNodeIdealizationTests.retainDenominator(long,long)": * Method was not compiled. Did you specify any compiler directives preventing a compilation or used a @Run method in STANDALONE mode? In the latter case, make sure to always trigger a C2 compilation by invoking the test enough times. >>> 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:91) at compiler.lib.ir_framework.driver.irmatching.IRMatcher.reportFailures(IRMatcher.java:82) at compiler.lib.ir_framework.driver.irmatching.IRMatcher.applyIRRules(IRMatcher.java:54) at compiler.lib.ir_framework.driver.irmatching.IRMatcher.<init>(IRMatcher.java:43) at compiler.lib.ir_framework.TestFramework.runTestVM(TestFramework.java:702) at compiler.lib.ir_framework.TestFramework.start(TestFramework.java:671) at compiler.lib.ir_framework.TestFramework.start(TestFramework.java:324) at compiler.lib.ir_framework.TestFramework.run(TestFramework.java:210) at compiler.lib.ir_framework.TestFramework.run(TestFramework.java:199) at compiler.c2.irTests.DivLNodeIdealizationTests.main(DivLNodeIdealizationTests.java:37) 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.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:312) at java.base/java.lang.Thread.run(Thread.java:828) JavaTest Message: Test threw exception: compiler.lib.ir_framework.driver.irmatching.IRViolationException JavaTest Message: shutting down test result: Failed. Execution failed: `main' threw exception: compiler.lib.ir_framework.driver.irmatching.IRViolationException: There were one or multiple IR rule failures. Please check stderr for more information.: compiler/c2/irTests/DivLNodeIdealizationTests.java
07-04-2022