Integrated: 8359678: C2: assert(static_cast<T1>(result) == thing) caused by ReverseBytesNode::Value()

Hannes Greule hgreule at openjdk.org
Tue Jul 15 06:30:52 UTC 2025


On Wed, 25 Jun 2025 19:34:40 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.

This pull request has now been integrated.

Changeset: e5ab2107
Author:    Hannes Greule <hgreule at openjdk.org>
Committer: Tobias Hartmann <thartmann at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/e5ab210713f76c5307287bd97ce63f9e22d0ab8e
Stats:     81 lines in 3 files changed: 71 ins; 0 del; 10 mod

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

Reviewed-by: mhaessig, dlong, thartmann

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

PR: https://git.openjdk.org/jdk/pull/25988


More information about the hotspot-compiler-dev mailing list