RFR: 8307139: Fix signed integer overflow in compiler code, part 1

Vladimir Kozlov kvn at openjdk.org
Wed May 3 01:01:13 UTC 2023


On Wed, 3 May 2023 00:22:58 GMT, Dean Long <dlong at openjdk.org> wrote:

> These changes attempt to fix signed overflow caught by running tier1 with -ftrapv.  I expect more changes will be needed.
> Most of the fixes are straight-forward and involve using unsigned or java_* functions that wrap.  However, I did try to improve the usefulness of _debug_idx because as it was the high digits of the value were monotonic but unpredictable.  Now the high digits use the compile_id, which seems like an improvement.

src/hotspot/share/opto/node.cpp line 74:

> 72:   Compile* C = Compile::current();
> 73:   assert(C->unique() < (INT_MAX - 1), "Node limit exceeded INT_MAX");
> 74:   uintx new_debug_idx = (uintx)C->compile_id() * 100000 + _idx;

Should we assert that _idx < 100000? We can use bigger multiplier since debug_idx is 64 bit value now.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13767#discussion_r1183165993


More information about the hotspot-dev mailing list