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

Roberto Castañeda Lozano rcastanedalo at openjdk.org
Wed May 10 13:47:20 UTC 2023


On Thu, 4 May 2023 07:44:16 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.
>
> Dean Long has updated the pull request incrementally with one additional commit since the last revision:
> 
>   make room for all digits of _idx in debug_idx

Looks good!

src/hotspot/share/c1/c1_Canonicalizer.cpp line 339:

> 337:     switch (t->tag()) {
> 338:       case intTag   : set_constant(java_negate(t->as_IntConstant   ()->value())); return;
> 339:       case longTag  : set_constant(java_negate(t->as_LongConstant  ()->value())); return;

Suggestion:

      case intTag   : set_constant(java_negate(t->as_IntConstant()->value())); return;
      case longTag  : set_constant(java_negate(t->as_LongConstant()->value())); return;

src/hotspot/share/c1/c1_Canonicalizer.cpp line 340:

> 338:       case intTag   : set_constant(java_negate(t->as_IntConstant   ()->value())); return;
> 339:       case longTag  : set_constant(java_negate(t->as_LongConstant  ()->value())); return;
> 340:       case floatTag : set_constant(-t->as_FloatConstant ()->value()); return;

Suggestion:

      case floatTag : set_constant(-t->as_FloatConstant()->value()); return;

src/hotspot/share/opto/intrinsicnode.cpp line 247:

> 245:     if (opc == Op_CompressBits) {
> 246:       // Bit compression selects the source bits corresponding to true mask bits
> 247:       // and lays them out contiguously at desitination bit positions starting from

Suggestion:

      // and lays them out contiguously at destination bit positions starting from

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

Marked as reviewed by rcastanedalo (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/13767#pullrequestreview-1420653631
PR Review Comment: https://git.openjdk.org/jdk/pull/13767#discussion_r1189915681
PR Review Comment: https://git.openjdk.org/jdk/pull/13767#discussion_r1189916882
PR Review Comment: https://git.openjdk.org/jdk/pull/13767#discussion_r1189920045


More information about the hotspot-dev mailing list