RFR: 8359678: C2: assert(static_cast<T1>(result) == thing) caused by ReverseBytesNode::Value() [v2]
Hannes Greule
hgreule at openjdk.org
Tue Jul 8 08:06:40 UTC 2025
On Fri, 4 Jul 2025 13:12:30 GMT, Manuel Hässig <mhaessig at openjdk.org> wrote:
>> Hannes Greule has updated the pull request incrementally with one additional commit since the last revision:
>>
>> remove classfile version
>
> You forgot to add the new tests to the array of tests in `@Run`:
>
> stderr: Exception in thread "main" compiler.lib.ir_framework.shared.TestRunException:
>
> Test Failures (1)
> -----------------
> Custom Run Test: @Run: runMethod - @Tests: {testI1,testI2,testI3,testL1,testL2,testL3,testS1,testS2,testS3,testUS1,testUS2,testUS3}:
> compiler.lib.ir_framework.shared.TestRunException: There was an error while invoking @Run method public void ReverseBytesConstantsTests.runMethod()
> at compiler.lib.ir_framework.test.CustomRunTest.invokeTest(CustomRunTest.java:162)
> at compiler.lib.ir_framework.test.AbstractTest.run(AbstractTest.java:100)
> at compiler.lib.ir_framework.test.CustomRunTest.run(CustomRunTest.java:89)
> at compiler.lib.ir_framework.test.TestVM.runTests(TestVM.java:865)
> at compiler.lib.ir_framework.test.TestVM.start(TestVM.java:255)
> at compiler.lib.ir_framework.test.TestVM.main(TestVM.java:168)
> Caused by: java.lang.reflect.InvocationTargetException
> at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:119)
> at java.base/java.lang.reflect.Method.invoke(Method.java:565)
> at compiler.lib.ir_framework.test.CustomRunTest.invokeTest(CustomRunTest.java:159)
> ... 5 more
> Caused by: java.lang.ArrayIndexOutOfBoundsException: Index -24674 out of bounds for length 128
> at java.base/java.lang.Character.valueOf(Character.java:9284)
> at ReverseBytesConstantsTests.assertResultUS(ReverseBytesConstantsTests.java:102)
> at ReverseBytesConstantsTests.runMethod(ReverseBytesConstantsTests.java:66)
> at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
> ... 7 more
> at compiler.lib.ir_framework.test.TestVM.runTests(TestVM.java:901)
> at compiler.lib.ir_framework.test.TestVM.start(TestVM.java:255)
> at compiler.lib.ir_framework.test.TestVM.main(TestVM.java:168)
Thanks @mhaessig. It seems like the methods don't need to be added there, as other methods were missing too. I updated the list nonetheless.
Regarding the exception, I'm not sure what the expectations and guarantees are here. Does Java code have to expect inputs that are illegal in Java but legal in bytecode? I can work around this by casting the result to int explicitly (to compare `Integer` objects instead), but I feel like this is a deeper problem.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/25988#issuecomment-3047806943
More information about the hotspot-compiler-dev
mailing list