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

2023-12-03 Thread Damon Fenacci
On Thu, 30 Nov 2023 15:51:46 GMT, Roger Riggs wrote: >> Strings, after construction, are immutable but may be constructed from >> mutable arrays of bytes, characters, or integers. >> The string constructors should guard against the effects of mutating the >> arrays during construction that migh

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

2023-12-01 Thread Roger Riggs
On Thu, 30 Nov 2023 08:00:12 GMT, Damon Fenacci wrote: >> Roger Riggs has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Use byte off branches in char_array_compress >> Verified by manual tests with "-XX:AVX3Threshold=0" >> And test in

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

2023-12-01 Thread Claes Redestad
On Thu, 30 Nov 2023 15:51:46 GMT, Roger Riggs wrote: >> Strings, after construction, are immutable but may be constructed from >> mutable arrays of bytes, characters, or integers. >> The string constructors should guard against the effects of mutating the >> arrays during construction that migh

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

2023-11-30 Thread Roger Riggs
> Strings, after construction, are immutable but may be constructed from > mutable arrays of bytes, characters, or integers. > The string constructors should guard against the effects of mutating the > arrays during construction that might invalidate internal invariants for the > correct behavio

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

2023-11-30 Thread Damon Fenacci
On Mon, 27 Nov 2023 19:09:40 GMT, Roger Riggs wrote: >> Strings, after construction, are immutable but may be constructed from >> mutable arrays of bytes, characters, or integers. >> The string constructors should guard against the effects of mutating the >> arrays during construction that migh

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

2023-11-28 Thread Raffaello Giulietti
On Mon, 27 Nov 2023 19:09:40 GMT, Roger Riggs wrote: >> Strings, after construction, are immutable but may be constructed from >> mutable arrays of bytes, characters, or integers. >> The string constructors should guard against the effects of mutating the >> arrays during construction that migh

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

2023-11-27 Thread Roger Riggs
> Strings, after construction, are immutable but may be constructed from > mutable arrays of bytes, characters, or integers. > The string constructors should guard against the effects of mutating the > arrays during construction that might invalidate internal invariants for the > correct behavio

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

2023-11-27 Thread Claes Redestad
On Mon, 27 Nov 2023 17:28:34 GMT, Roger Riggs wrote: >> src/hotspot/cpu/x86/macroAssembler_x86.cpp line 8584: >> >>> 8582: evpcmpuw(mask1, tmp1Reg, tmp2Reg, Assembler::le, >>> Assembler::AVX_512bit); >>> 8583: kortestdl(mask1, mask1); >>> 8584: jcc(Assembler::carryClear, reset_for_c

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

2023-11-27 Thread Roger Riggs
On Mon, 27 Nov 2023 13:43:52 GMT, Damon Fenacci wrote: >> Roger Riggs has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Apply StringUTF16.coderFromArrayLen > > src/hotspot/cpu/x86/macroAssembler_x86.cpp line 8584: > >> 8582: evpcmpuw(

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

2023-11-27 Thread Damon Fenacci
On Wed, 22 Nov 2023 05:03:41 GMT, Roger Riggs wrote: >> Strings, after construction, are immutable but may be constructed from >> mutable arrays of bytes, characters, or integers. >> The string constructors should guard against the effects of mutating the >> arrays during construction that migh

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

2023-11-21 Thread Roger Riggs
> Strings, after construction, are immutable but may be constructed from > mutable arrays of bytes, characters, or integers. > The string constructors should guard against the effects of mutating the > arrays during construction that might invalidate internal invariants for the > correct behavio

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

2023-11-21 Thread Roger Riggs
> Strings, after construction, are immutable but may be constructed from > mutable arrays of bytes, characters, or integers. > The string constructors should guard against the effects of mutating the > arrays during construction that might invalidate internal invariants for the > correct behavio

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

2023-11-20 Thread Raffaello Giulietti
On Mon, 20 Nov 2023 19:35:27 GMT, Roger Riggs wrote: >> Strings, after construction, are immutable but may be constructed from >> mutable arrays of bytes, characters, or integers. >> The string constructors should guard against the effects of mutating the >> arrays during construction that migh

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

2023-11-20 Thread Roger Riggs
> Strings, after construction, are immutable but may be constructed from > mutable arrays of bytes, characters, or integers. > The string constructors should guard against the effects of mutating the > arrays during construction that might invalidate internal invariants for the > correct behavio

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

2023-11-20 Thread Roger Riggs
> Strings, after construction, are immutable but may be constructed from > mutable arrays of bytes, characters, or integers. > The string constructors should guard against the effects of mutating the > arrays during construction that might invalidate internal invariants for the > correct behavio

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

2023-11-16 Thread Raffaello Giulietti
On Thu, 16 Nov 2023 20:27:11 GMT, Roger Riggs wrote: >> Strings, after construction, are immutable but may be constructed from >> mutable arrays of bytes, characters, or integers. >> The string constructors should guard against the effects of mutating the >> arrays during construction that migh

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

2023-11-16 Thread Roger Riggs
> Strings, after construction, are immutable but may be constructed from > mutable arrays of bytes, characters, or integers. > The string constructors should guard against the effects of mutating the > arrays during construction that might invalidate internal invariants for the > correct behavio

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

2023-11-16 Thread Roger Riggs
> Strings, after construction, are immutable but may be constructed from > mutable arrays of bytes, characters, or integers. > The string constructors should guard against the effects of mutating the > arrays during construction that might invalidate internal invariants for the > correct behavio

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

2023-11-16 Thread Roger Riggs
> Strings, after construction, are immutable but may be constructed from > mutable arrays of bytes, characters, or integers. > The string constructors should guard against the effects of mutating the > arrays during construction that might invalidate internal invariants for the > correct behavio

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

2023-11-16 Thread Claes Redestad
On Thu, 16 Nov 2023 10:05:14 GMT, Tobias Hartmann wrote: >> No, we don't mix: the SSE code is used as fallback only when the length is >> below 32 (if length is above 32 we check the tail with AVX code by >> shifting). >> >> I would suggest factoring out so that the implementations don't mix

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

2023-11-16 Thread Tobias Hartmann
On Thu, 16 Nov 2023 09:31:57 GMT, Claes Redestad wrote: >>> This cause a crash if I run with -XX:UseAVX=3 -XX:AVX3Threshold=0: >> >> Good catch! Do we have a test for that scenario? If not, one should be added. >> >>> Alternatively [...] >> >> I would suggest to use `jmp(copy_chars_loop)` here

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

2023-11-16 Thread Raffaello Giulietti
On Wed, 15 Nov 2023 22:15:54 GMT, Roger Riggs wrote: >> Strings, after construction, are immutable but may be constructed from >> mutable arrays of bytes, characters, or integers. >> The string constructors should guard against the effects of mutating the >> arrays during construction that migh

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

2023-11-16 Thread Claes Redestad
On Thu, 16 Nov 2023 08:59:25 GMT, Tobias Hartmann wrote: >> 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 exclus

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

2023-11-16 Thread Tobias Hartmann
On Wed, 15 Nov 2023 15:40:49 GMT, Claes Redestad wrote: >> 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:Use

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

2023-11-16 Thread Raffaello Giulietti
On Wed, 15 Nov 2023 22:15:54 GMT, Roger Riggs wrote: >> Strings, after construction, are immutable but may be constructed from >> mutable arrays of bytes, characters, or integers. >> The string constructors should guard against the effects of mutating the >> arrays during construction that migh

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

2023-11-16 Thread Raffaello Giulietti
On Wed, 15 Nov 2023 15:25:21 GMT, Raffaello Giulietti 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

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

2023-11-16 Thread Raffaello Giulietti
On Wed, 15 Nov 2023 22:08:19 GMT, Roger Riggs wrote: >> test/jdk/java/lang/String/StringRacyConstructor.java line 190: >> >>> 188: if (printWarningCount == 0) { >>> 189: printWarningCount = 1; >>> 190: System.out.println("StringUTF16.compre

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

2023-11-15 Thread Roger Riggs
On Wed, 15 Nov 2023 15:23:48 GMT, Raffaello Giulietti 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

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

2023-11-15 Thread Roger Riggs
> Strings, after construction, are immutable but may be constructed from > mutable arrays of bytes, characters, or integers. > The string constructors should guard against the effects of mutating the > arrays during construction that might invalidate internal invariants for the > correct behavio

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

2023-11-15 Thread Raffaello Giulietti
On Tue, 14 Nov 2023 16:05:51 GMT, Roger Riggs wrote: >> Strings, after construction, are immutable but may be constructed from >> mutable arrays of bytes, characters, or integers. >> The string constructors should guard against the effects of mutating the >> arrays during construction that migh

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

2023-11-15 Thread Claes Redestad
On Wed, 15 Nov 2023 15:32:54 GMT, Claes Redestad 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 The

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

2023-11-15 Thread Claes Redestad
On Tue, 14 Nov 2023 16:05:51 GMT, Roger Riggs wrote: >> Strings, after construction, are immutable but may be constructed from >> mutable arrays of bytes, characters, or integers. >> The string constructors should guard against the effects of mutating the >> arrays during construction that migh

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

2023-11-14 Thread Roger Riggs
> Strings, after construction, are immutable but may be constructed from > mutable arrays of bytes, characters, or integers. > The string constructors should guard against the effects of mutating the > arrays during construction that might invalidate internal invariants for the > correct behavio

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

2023-11-14 Thread Roger Riggs
On Tue, 14 Nov 2023 16:05:51 GMT, Roger Riggs wrote: >> Strings, after construction, are immutable but may be constructed from >> mutable arrays of bytes, characters, or integers. >> The string constructors should guard against the effects of mutating the >> arrays during construction that migh

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

2023-11-14 Thread Martin Doerr
On Mon, 13 Nov 2023 20:42:00 GMT, Roger Riggs wrote: >> Strings, after construction, are immutable but may be constructed from >> mutable arrays of bytes, characters, or integers. >> The string constructors should guard against the effects of mutating the >> arrays during construction that migh

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

2023-11-13 Thread Roger Riggs
> Strings, after construction, are immutable but may be constructed from > mutable arrays of bytes, characters, or integers. > The string constructors should guard against the effects of mutating the > arrays during construction that might invalidate internal invariants for the > correct behavio

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

2023-11-13 Thread Roger Riggs
On Thu, 9 Nov 2023 04:16:25 GMT, Roger Riggs wrote: >> Strings, after construction, are immutable but may be constructed from >> mutable arrays of bytes, characters, or integers. >> The string constructors should guard against the effects of mutating the >> arrays during construction that might

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

2023-11-13 Thread Amit Kumar
On Thu, 9 Nov 2023 04:16:25 GMT, Roger Riggs wrote: >> Strings, after construction, are immutable but may be constructed from >> mutable arrays of bytes, characters, or integers. >> The string constructors should guard against the effects of mutating the >> arrays during construction that might

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

2023-11-13 Thread Andrey Turbanov
On Thu, 9 Nov 2023 04:16:25 GMT, Roger Riggs wrote: >> Strings, after construction, are immutable but may be constructed from >> mutable arrays of bytes, characters, or integers. >> The string constructors should guard against the effects of mutating the >> arrays during construction that might

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

2023-11-10 Thread Martin Doerr
On Thu, 9 Nov 2023 04:16:25 GMT, Roger Riggs wrote: >> Strings, after construction, are immutable but may be constructed from >> mutable arrays of bytes, characters, or integers. >> The string constructors should guard against the effects of mutating the >> arrays during construction that might

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

2023-11-10 Thread Raffaello Giulietti
On Thu, 9 Nov 2023 04:16:25 GMT, Roger Riggs wrote: >> Strings, after construction, are immutable but may be constructed from >> mutable arrays of bytes, characters, or integers. >> The string constructors should guard against the effects of mutating the >> arrays during construction that might

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

2023-11-10 Thread Roger Riggs
On Fri, 10 Nov 2023 14:59:57 GMT, Raffaello Giulietti wrote: >> Roger Riggs has updated the pull request incrementally with three additional >> commits since the last revision: >> >> - Refactored extractCodePoints to avoid multiple resizes if the array was >> modified >> - Replaced isLatin1

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

2023-11-10 Thread Raffaello Giulietti
On Thu, 9 Nov 2023 04:16:25 GMT, Roger Riggs wrote: >> Strings, after construction, are immutable but may be constructed from >> mutable arrays of bytes, characters, or integers. >> The string constructors should guard against the effects of mutating the >> arrays during construction that might

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

2023-11-09 Thread Gui Cao
On Thu, 9 Nov 2023 04:16:25 GMT, Roger Riggs wrote: >> Strings, after construction, are immutable but may be constructed from >> mutable arrays of bytes, characters, or integers. >> The string constructors should guard against the effects of mutating the >> arrays during construction that might

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

2023-11-09 Thread Roger Riggs
On Thu, 9 Nov 2023 04:16:25 GMT, Roger Riggs wrote: >> Strings, after construction, are immutable but may be constructed from >> mutable arrays of bytes, characters, or integers. >> The string constructors should guard against the effects of mutating the >> arrays during construction that might

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

2023-11-09 Thread Roger Riggs
On Thu, 9 Nov 2023 09:07:31 GMT, Chen Liang wrote: > Just curious, how does benchmark > StringConstructor.newStringFromCharsMixedBegin change before and after this > patch? If we can see how much of an impact this has on CJK strings it would > be appreciated. You may have better insights from

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

2023-11-09 Thread Chen Liang
On Mon, 6 Nov 2023 15:30:46 GMT, Roger Riggs wrote: >> src/java.base/share/classes/java/lang/StringUTF16.java line 202: >> >>> 200: @ForceInline >>> 201: public static byte[] compress(final char[] val, final int off, >>> final int count) { >>> 202: byte[] latin1 = new byte[count

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

2023-11-09 Thread Tobias Hartmann
On Thu, 9 Nov 2023 04:16:25 GMT, Roger Riggs wrote: >> Strings, after construction, are immutable but may be constructed from >> mutable arrays of bytes, characters, or integers. >> The string constructors should guard against the effects of mutating the >> arrays during construction that might

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

2023-11-08 Thread Roger Riggs
> Strings, after construction, are immutable but may be constructed from > mutable arrays of bytes, characters, or integers. > The string constructors should guard against the effects of mutating the > arrays during construction that might invalidate internal invariants for the > correct behavio

Re: RFR: 8311906: Improve robustness of String constructors with mutable array inputs

2023-11-08 Thread Roger Riggs
On Wed, 8 Nov 2023 16:47:17 GMT, Raffaello Giulietti wrote: >> Strings, after construction, are immutable but may be constructed from >> mutable arrays of bytes, characters, or integers. >> The string constructors should guard against the effects of mutating the >> arrays during construction t

Re: RFR: 8311906: Improve robustness of String constructors with mutable array inputs

2023-11-08 Thread Raffaello Giulietti
On Mon, 30 Oct 2023 18:34:44 GMT, Roger Riggs wrote: > Strings, after construction, are immutable but may be constructed from > mutable arrays of bytes, characters, or integers. > The string constructors should guard against the effects of mutating the > arrays during construction that might in

Re: RFR: 8311906: Improve robustness of String constructors with mutable array inputs

2023-11-08 Thread Damon Fenacci
On Mon, 30 Oct 2023 18:34:44 GMT, Roger Riggs wrote: > Strings, after construction, are immutable but may be constructed from > mutable arrays of bytes, characters, or integers. > The string constructors should guard against the effects of mutating the > arrays during construction that might in

Re: RFR: 8311906: Improve robustness of String constructors with mutable array inputs

2023-11-07 Thread Roger Riggs
On Mon, 30 Oct 2023 18:34:44 GMT, Roger Riggs wrote: > Strings, after construction, are immutable but may be constructed from > mutable arrays of bytes, characters, or integers. > The string constructors should guard against the effects of mutating the > arrays during construction that might in

Re: RFR: 8311906: Improve robustness of String constructors with mutable array inputs

2023-11-07 Thread Roger Riggs
On Mon, 30 Oct 2023 18:34:44 GMT, Roger Riggs wrote: > Strings, after construction, are immutable but may be constructed from > mutable arrays of bytes, characters, or integers. > The string constructors should guard against the effects of mutating the > arrays during construction that might in

Re: RFR: 8311906: Improve robustness of String constructors with mutable array inputs

2023-11-07 Thread Damon Fenacci
On Mon, 30 Oct 2023 18:34:44 GMT, Roger Riggs wrote: > Strings, after construction, are immutable but may be constructed from > mutable arrays of bytes, characters, or integers. > The string constructors should guard against the effects of mutating the > arrays during construction that might in

Re: RFR: 8311906: Improve robustness of String constructors with mutable array inputs

2023-11-06 Thread Roger Riggs
On Sat, 4 Nov 2023 00:07:33 GMT, Chen Liang wrote: >> Strings, after construction, are immutable but may be constructed from >> mutable arrays of bytes, characters, or integers. >> The string constructors should guard against the effects of mutating the >> arrays during construction that might

Re: RFR: 8311906: Improve robustness of String constructors with mutable array inputs

2023-11-06 Thread Chen Liang
On Mon, 30 Oct 2023 18:34:44 GMT, Roger Riggs wrote: > Strings, after construction, are immutable but may be constructed from > mutable arrays of bytes, characters, or integers. > The string constructors should guard against the effects of mutating the > arrays during construction that might in

Re: RFR: 8311906: Improve robustness of String constructors with mutable array inputs

2023-11-06 Thread Roger Riggs
On Sun, 5 Nov 2023 13:32:20 GMT, ExE Boss wrote: >> Strings, after construction, are immutable but may be constructed from >> mutable arrays of bytes, characters, or integers. >> The string constructors should guard against the effects of mutating the >> arrays during construction that might in

Re: RFR: 8311906: Improve robustness of String constructors with mutable array inputs

2023-11-06 Thread ExE Boss
On Mon, 30 Oct 2023 18:34:44 GMT, Roger Riggs wrote: > Strings, after construction, are immutable but may be constructed from > mutable arrays of bytes, characters, or integers. > The string constructors should guard against the effects of mutating the > arrays during construction that might in

Re: RFR: 8311906: Improve robustness of String constructors with mutable array inputs

2023-11-06 Thread Jaikiran Pai
On Mon, 30 Oct 2023 18:34:44 GMT, Roger Riggs wrote: > Strings, after construction, are immutable but may be constructed from > mutable arrays of bytes, characters, or integers. > The string constructors should guard against the effects of mutating the > arrays during construction that might in