RFR: 8307139: Fix signed integer overflow in compiler code, part 1
Dean Long
dlong at openjdk.org
Thu May 4 04:15:14 UTC 2023
On Wed, 3 May 2023 00:58:00 GMT, Vladimir Kozlov <kvn 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.
I can make the multiplier 10000000000 so we don't have to assert or artificially restrict _idx further than INT_MAX. I also need to change the type from uintx to uint64_t so I don't break 32-bit ports.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13767#discussion_r1184523882
More information about the hotspot-dev
mailing list