RFR: 8359678: C2: assert(static_cast<T1>(result) == thing) caused by ReverseBytesNode::Value() [v2]
Manuel Hässig
mhaessig at openjdk.org
Fri Jul 4 13:14:39 UTC 2025
On Thu, 26 Jun 2025 07:55:23 GMT, Hannes Greule <hgreule at openjdk.org> wrote:
>> Fixes an assertion when passing an int larger than short/char to the corresponding reverseBytes method in a constant-folding scenario. By just using static_cast, we can ignore the upper bytes and just swap the lower bytes.
>>
>> Using jasm, I added a test case that covers such inputs. It felt easier to test this way than the other scenarios mentioned in the bug report.
>>
>> I also removed the redundant checked_cast calls from the int/long case; we already have the correct type there.
>>
>> Please review. Thanks.
>
> 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)
-------------
PR Comment: https://git.openjdk.org/jdk/pull/25988#issuecomment-3036245144
More information about the hotspot-compiler-dev
mailing list