RFR: 8359678: C2: assert(static_cast<T1>(result) == thing) caused by ReverseBytesNode::Value()
Hannes Greule
hgreule at openjdk.org
Wed Jun 25 21:06:47 UTC 2025
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.
-------------
Commit messages:
- fix
- test
Changes: https://git.openjdk.org/jdk/pull/25988/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25988&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8359678
Stats: 83 lines in 3 files changed: 74 ins; 2 del; 7 mod
Patch: https://git.openjdk.org/jdk/pull/25988.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/25988/head:pull/25988
PR: https://git.openjdk.org/jdk/pull/25988
More information about the hotspot-compiler-dev
mailing list