RFR: 8342692: C2: long counted loop/long range checks: don't create loop-nest for short running loops [v16]

Christian Hagedorn chagedorn at openjdk.org
Wed Jul 9 10:37:52 UTC 2025


On Thu, 15 May 2025 10:30:13 GMT, Christian Hagedorn <chagedorn at openjdk.org> wrote:

>> Otherwise, this assert:
>> 
>> 
>> assert((1 << _reason_bits) >= Reason_LIMIT, "enough bits");
>> 
>> 
>> fails. Rather than tweak the allocation of bits to `_action_bits`, `_reason_bits`, `_debug_id_bits`, to extend `_reason_bits`, I thought it was simpler to have c2 and graal share the encoding of a reason given graal doesn't use the new `Reason_short_running_long_loop` and c2 doesn't use the jvmci specific `Reason_aliasing`.
>
> Makes sense, thanks for the explanation!

I think this sharing is now causing problems with SA tests, for example with `serviceability/sa/TestPrintMdo.java`:

 stderr: [Exception in thread "main" java.lang.InternalError: duplicate reasons: aliasing short_running_long_loop
	at jdk.hotspot.agent/sun.jvm.hotspot.oops.MethodData.initialize(MethodData.java:181)
	at jdk.hotspot.agent/sun.jvm.hotspot.oops.MethodData$1.update(MethodData.java:128)
	at jdk.hotspot.agent/sun.jvm.hotspot.runtime.VM.registerVMInitializedObserver(VM.java:569)
	at jdk.hotspot.agent/sun.jvm.hotspot.oops.MethodData.<clinit>(MethodData.java:126)
        [...]
]
 exitValue = 1

java.lang.RuntimeException: Test ERROR java.lang.RuntimeException: Expected to get exit value of [0], exit value is: [1]
	at TestPrintMdo.main(TestPrintMdo.java:66)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
	at java.base/java.lang.reflect.Method.invoke(Method.java:565)
	at com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138)
	at java.base/java.lang.Thread.run(Thread.java:1474)
Caused by: java.lang.RuntimeException: Expected to get exit value of [0], exit value is: [1]
	at jdk.test.lib.process.OutputAnalyzer.shouldHaveExitValue(OutputAnalyzer.java:522)
	at ClhsdbLauncher.runCmd(ClhsdbLauncher.java:148)
	at ClhsdbLauncher.run(ClhsdbLauncher.java:212)
	at TestPrintMdo.main(TestPrintMdo.java:62)
	... 4 more

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/21630#discussion_r2194657689


More information about the hotspot-compiler-dev mailing list