RFR: 8311906: Improve robustness of String constructors with mutable array inputs [v4]

Claes Redestad redestad at openjdk.org
Wed Nov 15 15:43:43 UTC 2023


On Wed, 15 Nov 2023 15:32:54 GMT, Claes Redestad <redestad at openjdk.org> wrote:

>> Roger Riggs has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Update PPC implementation of string_compress to return the index of the non-latin1 char
>>   Patch supplied by TheRealMDoerr
>
> src/hotspot/cpu/x86/macroAssembler_x86.cpp line 8617:
> 
>> 8615:     lea(dst, Address(dst, tmp5, Address::times_1));
>> 8616:     subptr(len, tmp5);
>> 8617:     jmpb(copy_chars_loop);
> 
> This cause a crash if I run with `-XX:UseAVX=3 -XX:AVX3Threshold=0`:
> 
> 
> #
> # A fatal error has been detected by the Java Runtime Environment:
> #
> #  Internal Error (macroAssembler_x86.hpp:122), pid=3400452, tid=3400470
> #  guarantee(this->is8bit(imm8)) failed: Short forward jump exceeds 8-bit offset at <null>:0
> #
> 
> 
> Needs to be a `jmp(copy_chars_loop)`.

Alternatively:

if (UseSSE42Intrinsics) {
  jmpb(copy_chars_loop);
} else {
  jmp(copy_chars_loop);
}


More generally I do wonder if it'd make most sense to make the AVX512 and SSE42 implementations exclusive, though. Especially since we shouldn't mix AVX and SSE code (the code in this intrinsic seem to follow paths which are either/or, but it seems fragile). Perhaps @TobiHartmann can advise?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16425#discussion_r1394386963


More information about the core-libs-dev mailing list