RFR: 8359678: C2: assert(static_cast<T1>(result) == thing) caused by ReverseBytesNode::Value() [v2]

Emanuel Peter epeter at openjdk.org
Fri Jul 4 06:13:45 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

Just a drive-by comment. Won't have time for a full review for a few weeks.

test/hotspot/jtreg/compiler/c2/gvn/ReverseBytesConstantsTests.java line 23:

> 21:  * questions.
> 22:  */
> 23: package compiler.c2.gvn;

Why did you remove the package? You can add the `jasm` file to the package too, I think that should work, no?

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

PR Review: https://git.openjdk.org/jdk/pull/25988#pullrequestreview-2985704166
PR Review Comment: https://git.openjdk.org/jdk/pull/25988#discussion_r2184491532


More information about the hotspot-compiler-dev mailing list