Re: RFR: 8362376: Use @Stable annotation in Java FDLIBM implementation

2025-07-17 Thread Shaojin Wen
On Thu, 17 Jul 2025 10:27:27 GMT, Raffaello Giulietti wrote: >> Add `@Stable` to the static final arrays used in the Java port of FDLIBM. > > src/java.base/share/classes/java/lang/FdLibm.java line 815: > >> 813: */ >> 814: >> 815: private static final int init_jk[] = {2, 3, 4,

Re: RFR: 8362376: Use @Stable annotation in Java FDLIBM implementation

2025-07-17 Thread Shaojin Wen
On Wed, 16 Jul 2025 04:53:04 GMT, Joe Darcy wrote: > Add `@Stable` to the static final arrays used in the Java port of FDLIBM. src/java.base/share/classes/java/lang/FdLibm.java line 457: > 455: pio4 = 0x1.921fb54442d18p-1, // 7.85398163397448278999e-01 > 456: pio4lo=

Re: RFR: 8359424: Eliminate table lookup in Integer/Long toHexString [v2]

2025-07-13 Thread Shaojin Wen
On Sun, 15 Jun 2025 05:53:26 GMT, Shaojin Wen wrote: >> In PR #22928, UUID introduced long-based vectorized hexadecimal to string >> conversion, which can also be used in Integer::toHexString and >> Long::toHexString to eliminate table lookups. The benefit of eliminating &

Re: RFR: 8361018: Re-examine buffering and encoding conversion in BufferedWriter [v6]

2025-07-02 Thread Shaojin Wen
On Tue, 1 Jul 2025 00:01:21 GMT, Shaojin Wen wrote: >> BufferedWriter -> OutputStreamWriter -> StreamEncoder >> >> In this call chain, BufferedWriter has a char[] buffer, and StreamEncoder >> has a ByteBuffer. There are two layers of cache here, or the BufferedW

Re: RFR: 8361018: Re-examine buffering and encoding conversion in BufferedWriter [v6]

2025-07-01 Thread Shaojin Wen
On Tue, 1 Jul 2025 02:33:16 GMT, Chen Liang wrote: > I think we can split this into two parts: > > 1. Update buffering strategy for BufferedWriter when backing writer is an > OutputStreamWriter > 2. Use an alternative StreamDecoder impl if the CharsetDecoder is an > ArrayDecoder > > This shou

Re: RFR: 8361018: Re-examine buffering and encoding conversion in BufferedWriter [v6]

2025-06-30 Thread Shaojin Wen
On Tue, 1 Jul 2025 00:41:03 GMT, Xueming Shen wrote: > While I understand the motivation behind the PR, it's a bit challenging, as a > reviewer :-) to review a change that is essentially to 'break' the > abstraction layer by surfacing a lower-level implementation to the top API > solely for pe

Re: RFR: 8361018: Re-examine buffering and encoding conversion in BufferedWriter [v5]

2025-06-30 Thread Shaojin Wen
On Tue, 1 Jul 2025 02:07:07 GMT, Brett Okken wrote: > > StreamEncoder has a ByteBuffer that acts as a buffer, > > At a fixed sized of 512 bytes which cannot be affected by size passed into > the BufferedWriter? So I added this method StreamEncoder::growByteBufferIfEmptyNeeded and called it in

Re: RFR: 8361018: Re-examine buffering and encoding conversion in BufferedWriter [v5]

2025-06-30 Thread Shaojin Wen
On Mon, 30 Jun 2025 23:57:45 GMT, Brett Okken wrote: > What about a benchmark which exercises the actual benefits of buffering? So > many very small writes to a backing OutputStream which is (artificially) > slow. Perhaps have an OutputStream which sleeps 1ms on every call. The write > out mor

Re: RFR: 8361018: Re-examine buffering and encoding conversion in BufferedWriter [v6]

2025-06-30 Thread Shaojin Wen
tly. In > addition, improve write(String) in StreamEncoder to avoid unnecessary > encoding conversion. Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: Revert "BufferedWriter buffer use StringBuilder"

Re: RFR: 8361018: Re-examine buffering and encoding conversion in BufferedWriter [v5]

2025-06-30 Thread Shaojin Wen
tly. In > addition, improve write(String) in StreamEncoder to avoid unnecessary > encoding conversion. Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: BufferedWriter buffer use StringBuilder - Changes: - all: h

Re: RFR: 8361018: Re-examine buffering and encoding conversion in BufferedWriter [v4]

2025-06-30 Thread Shaojin Wen
tly. In > addition, improve write(String) in StreamEncoder to avoid unnecessary > encoding conversion. Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: bug fix for encodeUTF8 & remove unused computeSizeUTF8 - C

Re: RFR: 8361018: Re-examine buffering and encoding conversion in BufferedWriter [v3]

2025-06-30 Thread Shaojin Wen
tly. In > addition, improve write(String) in StreamEncoder to avoid unnecessary > encoding conversion. Shaojin Wen has updated the pull request incrementally with three additional commits since the last revision: - bug fix for encodeUTF8 - bug fix for encodeUTF8 - bug fix for

Re: RFR: 8361018: Eliminate unnecessary buffering and encoding conversion in BufferedWriter [v2]

2025-06-29 Thread Shaojin Wen
tly. In > addition, improve write(String) in StreamEncoder to avoid unnecessary > encoding conversion. Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: copyright - Changes: - all: https://git.openjdk.org/jdk/pu

Re: RFR: 8361018: Eliminate unnecessary buffering and encoding conversion in BufferedWriter

2025-06-29 Thread Shaojin Wen
On Fri, 27 Jun 2025 16:48:40 GMT, Shaojin Wen wrote: > BufferedWriter -> OutputStreamWriter -> StreamEncoder > > In this call chain, BufferedWriter has a char[] buffer, and StreamEncoder has > a ByteBuffer. There are two layers of cache here, or the BufferedWriter layer >

RFR: 8361018: Eliminate unnecessary buffering and encoding conversion in BufferedWriter

2025-06-29 Thread Shaojin Wen
BufferedWriter -> OutputStreamWriter -> StreamEncoder In this call chain, BufferedWriter has a char[] buffer, and StreamEncoder has a ByteBuffer. There are two layers of cache here, or the BufferedWriter layer can be removed. And when charset is UTF8, if the content of write(String) is LATIN1,

Withdrawn: 8349176: Speed up Integer/Long.toString via allocateUninitializedArray

2025-06-29 Thread Shaojin Wen
On Wed, 29 Jan 2025 16:36:24 GMT, Shaojin Wen wrote: > The byte[] allocated in Integer/Long.toString is fully filled, so we can use > StringConcatHelper::newArray to create byte[] to improve performance. This pull request has been closed without being integrated. - PR:

Re: RFR: 8349176: Speed up Integer/Long.toString via allocateUninitializedArray [v5]

2025-06-28 Thread Shaojin Wen
On Fri, 27 Jun 2025 19:09:27 GMT, Roger Riggs wrote: >> Shaojin Wen has updated the pull request with a new target base due to a >> merge or a rebase. The pull request now contains 11 commits: >> >> - Merge remote-tracking branch 'upstream/master'

Integrated: 8357289: Break down the String constructor into smaller methods

2025-06-27 Thread Shaojin Wen
On Sun, 18 May 2025 12:48:07 GMT, Shaojin Wen wrote: > Through JVM Option +PrintInlining, we found that String has a constructor > codeSize of 852, which is too large. This caused failed to inline. > > The following is the output information of PrintInlining: > >

Re: RFR: 8357289: Break down the String constructor into smaller methods [v8]

2025-06-26 Thread Shaojin Wen
On Wed, 25 Jun 2025 00:13:56 GMT, Shaojin Wen wrote: >> Through JVM Option +PrintInlining, we found that String has a constructor >> codeSize of 852, which is too large. This caused failed to inline. >> >> The following is the output information of PrintInlining: &g

Re: RFR: 8355177: Speed up StringBuilder::append(char[]) via Unsafe::copyMemory [v8]

2025-06-26 Thread Shaojin Wen
erRiggs completed the optimization when the encoder is LATIN1 in PR > #24967. This PR continues to complete the optimization when the encoder is > UTF16. Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: Update src/java.base/share/classes

Re: RFR: 8357289: Break down the String constructor into smaller methods [v7]

2025-06-25 Thread Shaojin Wen
On Mon, 26 May 2025 19:20:06 GMT, Shaojin Wen wrote: >> Through JVM Option +PrintInlining, we found that String has a constructor >> codeSize of 852, which is too large. This caused failed to inline. >> >> The following is the output information of PrintInlining: &g

Re: RFR: 8355177: Speed up StringBuilder::append(char[]) via Unsafe::copyMemory [v7]

2025-06-24 Thread Shaojin Wen
erRiggs completed the optimization when the encoder is LATIN1 in PR > #24967. This PR continues to complete the optimization when the encoder is > UTF16. Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: Microbenchmark java.lang.StringBui

Re: RFR: 8355177: Speed up StringBuilder::append(char[]) via Unsafe::copyMemory [v6]

2025-06-24 Thread Shaojin Wen
erRiggs completed the optimization when the encoder is LATIN1 in PR > #24967. This PR continues to complete the optimization when the encoder is > UTF16. Shaojin Wen has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 12 commits: - inlin

Re: RFR: 8357289: Break down the String constructor into smaller methods [v8]

2025-06-24 Thread Shaojin Wen
g > constructor > > > String(Charset charset, byte[] bytes, int offset, int length) {} > > The above String constructor is too large; break it down into smaller methods > with a codeSize under 325 to allow them to be inlined by the C2. Shaojin Wen has updated the pull requ

Re: RFR: 8358533: Improve performance of java.io.Reader.readAllLines

2025-06-18 Thread Shaojin Wen
On Wed, 18 Jun 2025 00:04:37 GMT, Brian Burkhalter wrote: > Replaces the implementation `readAllCharsAsString().lines().toList()` with > reading into a temporary `char` array which is then processed to detect line > terminators and copy non-terminating characters into strings which are added >

Re: RFR: 8358533: Improve performance of java.io.Reader.readAllLines

2025-06-17 Thread Shaojin Wen
On Wed, 18 Jun 2025 00:04:37 GMT, Brian Burkhalter wrote: > Replaces the implementation `readAllCharsAsString().lines().toList()` with > reading into a temporary `char` array which is then processed to detect line > terminators and copy non-terminating characters into strings which are added >

Re: RFR: 8358533: Improve performance of java.io.Reader.readAllLines

2025-06-17 Thread Shaojin Wen
On Wed, 18 Jun 2025 00:04:37 GMT, Brian Burkhalter wrote: > Replaces the implementation `readAllCharsAsString().lines().toList()` with > reading into a temporary `char` array which is then processed to detect line > terminators and copy non-terminating characters into strings which are added >

Re: RFR: 8359424: Eliminate table lookup in Integer/Long toHexString [v2]

2025-06-14 Thread Shaojin Wen
misses occur. Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: Update src/java.base/share/classes/java/util/UUID.java Co-authored-by: ExE Boss <3889017+exe-b...@users.noreply.github.com> - Changes: - all: https://g

Re: RFR: 8347009: Speed ​​up parseInt and parseLong [v22]

2025-06-14 Thread Shaojin Wen
GITS cache array, which avoids > performance degradation caused by cache misses. Shaojin Wen has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 41 commits: - Merge remote-tracking branch 'origin/optim_parse_int_long_202501'

Re: RFR: 8359424: Eliminate table lookup in Integer/Long toHexString

2025-06-13 Thread Shaojin Wen
On Tue, 7 Jan 2025 10:39:18 GMT, Shaojin Wen wrote: > In PR #22928, UUID introduced long-based vectorized hexadecimal to string > conversion, which can also be used in Integer::toHexString and > Long::toHexString to eliminate table lookups. The benefit of eliminating > table loo

RFR: 8359424: Eliminate table lookup in Integer/Long toHexString

2025-06-13 Thread Shaojin Wen
In PR #22928, UUID introduced long-based vectorized hexadecimal to string conversion, which can also be used in Integer::toHexString and Long::toHexString to eliminate table lookups. The benefit of eliminating table lookups is that the performance is better when cache misses occur.

Re: RFR: 8359424: Eliminate table lookup in Integer/Long toHexString

2025-06-13 Thread Shaojin Wen
On Tue, 7 Jan 2025 10:39:18 GMT, Shaojin Wen wrote: > In PR #22928, UUID introduced long-based vectorized hexadecimal to string > conversion, which can also be used in Integer::toHexString and > Long::toHexString to eliminate table lookups. The benefit of eliminating > table loo

Re: RFR: 8347009: Speed ​​up parseInt and parseLong [v21]

2025-06-09 Thread Shaojin Wen
On Fri, 2 May 2025 03:53:23 GMT, Shaojin Wen wrote: >> This is an optimization for decimal Integer.parseInt and Long.parseLong, >> which improves performance by about 10%. The optimization includes: >> 1. Improve performance by parsing 2 numbers at a time, which has performanc

Re: RFR: 8357913: Add `@Stable` to BigInteger and BigDecimal [v3]

2025-06-04 Thread Shaojin Wen
On Wed, 4 Jun 2025 12:08:09 GMT, Per Minborg wrote: > The newly marked arrays are indeed only updated once. Can we see any > benchmark showing a performance gain? I ran `make test TEST="micro:java.math.BigDecimals` on a MacBook M1 Pro, and there was no performance improvement with the Stable a

Re: RFR: 8357913: Add `@Stable` to BigInteger and BigDecimal [v2]

2025-06-04 Thread Shaojin Wen
On Wed, 4 Jun 2025 14:03:49 GMT, Raffaello Giulietti wrote: >> Please do _not_ fix the `mag` issue in this PR. >> I'll take care of it in a future PR. > > I just filed [JDK-8358599](https://bugs.openjdk.org/browse/JDK-8358599). > Please do _not_ fix the `mag` issue in this PR. I'll take care of

Re: RFR: 8357913: Add `@Stable` to BigInteger and BigDecimal [v4]

2025-06-04 Thread Shaojin Wen
> Some static final arrays of BigInteger and BigDecimal are stable and > immutable. We should add `@Stable` to give the optimizer more information Shaojin Wen has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated c

Re: RFR: 8357913: Add `@Stable` to BigInteger and BigDecimal [v3]

2025-06-03 Thread Shaojin Wen
On Mon, 2 Jun 2025 18:23:25 GMT, Per Minborg wrote: >> Shaojin Wen has updated the pull request incrementally with one additional >> commit since the last revision: >> >> BigInteger::mag remove Stable > > A general comment with respect to `@Stable` is that it

Re: RFR: 8357823: Changes in StringBuilder (JDK-8351443) caused a 1-3% regression in biojava

2025-06-02 Thread Shaojin Wen
On Fri, 30 May 2025 14:01:04 GMT, Roger Riggs wrote: > Comment out assertions added in JDK-8351443 from > AbstractStringBuilder.ensureCapacityNewCoder that increase the codesize, > preventing some inlining, and reducing performance > >assert coder == newCoder || newCoder == UTF16 : "ba

Re: RFR: 8357913: Add `@Stable` to BigInteger and BigDecimal [v2]

2025-05-30 Thread Shaojin Wen
On Fri, 30 May 2025 21:36:52 GMT, ExE Boss wrote: >> Shaojin Wen has updated the pull request incrementally with one additional >> commit since the last revision: >> >> bug fix, from @minborg > > src/java.base/share/classes/java/math/BigInteger.java line 192:

Re: RFR: 8357913: Add `@Stable` to BigInteger and BigDecimal [v3]

2025-05-30 Thread Shaojin Wen
> Some static final arrays of BigInteger and BigDecimal are stable and > immutable. We should add `@Stable` to give the optimizer more information Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: BigInteger::mag remove

Integrated: 8357690: Add @Stable and final to java.lang.CharacterDataLatin1 and other CharacterData classes

2025-05-29 Thread Shaojin Wen
On Sat, 24 May 2025 10:00:56 GMT, Shaojin Wen wrote: > Classes such as java.lang.CharacterDataXXX have multiple static final arrays, > these are immutable, We should add `@Stable` and final to provide information > to the optimizer. This pull request has now been integrated.

Re: RFR: 8357690: Add @Stable and final to java.lang.CharacterDataLatin1 and other CharacterData classes [v3]

2025-05-28 Thread Shaojin Wen
On Wed, 28 May 2025 19:20:08 GMT, ExE Boss wrote: >> Shaojin Wen has updated the pull request incrementally with one additional >> commit since the last revision: >> >> fix comments, from @natoj > > src/java.base/share/classes/java/lang/CharacterData00.java.temp

Integrated: 8357681: Fixed the DigitList::toString method causing incorrect results during debugging

2025-05-28 Thread Shaojin Wen
On Sun, 18 May 2025 11:11:32 GMT, Shaojin Wen wrote: > When debugging getLong/getDouble/getDecimal of DigitList, the debugger will > call the DigitList::toString method. At this time, DigitList::toString will > modify tempBuilder, which will cause incorrect results. This pull reques

Re: RFR: 8357913: Add `@Stable` to BigInteger and BigDecimal [v2]

2025-05-28 Thread Shaojin Wen
> Some static final arrays of BigInteger and BigDecimal are stable and > immutable. We should add `@Stable` to give the optimizer more information Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: bug fix, from @m

RFR: 8357913: Add `@Stable` to BigInteger and BigDecimal

2025-05-27 Thread Shaojin Wen
Some static final arrays of BigInteger and BigDecimal are stable and immutable. We should add `@Stable` to give the optimizer more information - Commit messages: - BigInteger::mag add `@Stable` - add stable Changes: https://git.openjdk.org/jdk/pull/25437/files Webrev: https://we

Re: RFR: 8357681: Fixed the DigitList::toString method causing incorrect results during debugging

2025-05-27 Thread Shaojin Wen
On Tue, 27 May 2025 19:31:44 GMT, Volkan Yazici wrote: > _Nit:_ Would it be an overkill to add a test (verifying `toString` doesn't > spoil the content) to avoid falling on the same slippery slope (i.e., _"Let > me optimize this by reusing the `SB`!"_) again? The original code that calls getSt

Re: RFR: 8357681: Fixed the DigitList::toString method causing incorrect results during debugging

2025-05-27 Thread Shaojin Wen
On Tue, 27 May 2025 17:11:41 GMT, Johannes Döbler wrote: >> When debugging getLong/getDouble/getDecimal of DigitList, the debugger will >> call the DigitList::toString method. At this time, DigitList::toString will >> modify tempBuilder, which will cause incorrect results. > > src/java.base/sha

Re: RFR: 8357690: Add @Stable and final to java.lang.CharacterDataLatin1 and other CharacterData classes [v3]

2025-05-27 Thread Shaojin Wen
> Classes such as java.lang.CharacterDataXXX have multiple static final arrays, > these are immutable, We should add `@Stable` and final to provide information > to the optimizer. Shaojin Wen has updated the pull request incrementally with one additional commit since the last revisio

Re: RFR: 8357690: Add @Stable and final to java.lang.CharacterDataLatin1 and other CharacterData classes [v2]

2025-05-27 Thread Shaojin Wen
On Tue, 27 May 2025 16:50:40 GMT, Naoto Sato wrote: > Nice refactoring. As to C-style array rewrite, I am not so keen on that as > they only appear in the generated source files, without any actual benefit. You and @cl4es both mentioned this, and I agree, but it should be another PR to remove

Re: RFR: 8357289: Break down the String constructor into smaller methods [v7]

2025-05-26 Thread Shaojin Wen
g > constructor > > > String(Charset charset, byte[] bytes, int offset, int length) {} > > The above String constructor is too large; break it down into smaller methods > with a codeSize under 325 to allow them to be inlined by the C2. Shaojin Wen has updated the pull requ

Re: RFR: 8357289: Break down the String constructor into smaller methods [v6]

2025-05-26 Thread Shaojin Wen
g > constructor > > > String(Charset charset, byte[] bytes, int offset, int length) {} > > The above String constructor is too large; break it down into smaller methods > with a codeSize under 325 to allow them to be inlined by the C2. Shaojin Wen has updated the pull requ

Re: RFR: 8357690: Add @Stable and final to java.lang.CharacterDataLatin1 and other CharacterData classes [v2]

2025-05-26 Thread Shaojin Wen
> Classes such as java.lang.CharacterDataXXX have multiple static final arrays, > these are immutable, We should add `@Stable` and final to provide information > to the optimizer. Shaojin Wen has updated the pull request incrementally with one additional commit since the last revisio

Integrated: 8357685: Change the type of Integer::digits from char[] to byte[]

2025-05-25 Thread Shaojin Wen
On Sat, 24 May 2025 02:30:16 GMT, Shaojin Wen wrote: > Integer::digits type can use byte[] instead of char[], which can reduce the > conversion from char to byte in the process of Integer.toString. Using byte[] > can also save memory. This pull request has now been integrated.

Re: RFR: 8357289: Break down the String constructor into smaller methods [v3]

2025-05-24 Thread Shaojin Wen
On Sun, 25 May 2025 04:39:24 GMT, Chen Liang wrote: >> Shaojin Wen has updated the pull request incrementally with one additional >> commit since the last revision: >> >> create method share variant val & coder > > src/java.base/share/classes/java/la

Re: RFR: 8357289: Break down the String constructor into smaller methods [v5]

2025-05-24 Thread Shaojin Wen
g > constructor > > > String(Charset charset, byte[] bytes, int offset, int length) {} > > The above String constructor is too large; break it down into smaller methods > with a codeSize under 325 to allow them to be inlined by the C2. Shaojin Wen has updated the pull requ

Re: RFR: 8357289: Break down the String constructor into smaller methods [v4]

2025-05-24 Thread Shaojin Wen
g > constructor > > > String(Charset charset, byte[] bytes, int offset, int length) {} > > The above String constructor is too large; break it down into smaller methods > with a codeSize under 325 to allow them to be inlined by the C2. Shaojin Wen has updated the pull requ

Re: RFR: 8357289: Break down the String constructor into smaller methods [v3]

2025-05-24 Thread Shaojin Wen
On Sun, 25 May 2025 04:40:44 GMT, Chen Liang wrote: >> Shaojin Wen has updated the pull request incrementally with one additional >> commit since the last revision: >> >> create method share variant val & coder > > src/java.base/share/classes/java/la

Re: RFR: 8357690: Add @Stable and final to java.lang.CharacterDataLatin1 and other CharacterData classes

2025-05-24 Thread Shaojin Wen
On Sat, 24 May 2025 23:04:50 GMT, Chen Liang wrote: >> Classes such as java.lang.CharacterDataXXX have multiple static final >> arrays, which will not be modified. We should add @Stable to provide >> information to the optimizer. > > make/jdk/src/classes/build/tools/generatecharacter/GenerateCh

RFR: 8357690: Add @Stable and final to java.lang.CharacterDataLatin1 and other CharacterData classes

2025-05-24 Thread Shaojin Wen
Classes such as java.lang.CharacterDataXXX have multiple static final arrays, which will not be modified. We should add @Stable to provide information to the optimizer. - Commit messages: - sealed & final - add @Stable - stable Changes: https://git.openjdk.org/jdk/pull/25430/fil

Integrated: 8357081: Removed unused methods of HexDigits

2025-05-24 Thread Shaojin Wen
On Thu, 15 May 2025 22:03:22 GMT, Shaojin Wen wrote: > In HexDigits, getCharsLatin1 and getCharsUTF16 are no longer used, so remove > these methods This pull request has now been integrated. Changeset: b0373537 Author:Shaojin Wen URL: https://git.openjdk.org/jdk/

Re: RFR: 8357685: Changing the type of Integer::digits from char[] to byte[] [v2]

2025-05-24 Thread Shaojin Wen
> Integer::digits type can use byte[] instead of char[], which can reduce the > conversion from char to byte in the process of Integer.toString. Using byte[] > can also save memory. Shaojin Wen has updated the pull request incrementally with one additional commit since the last

RFR: 8357685: Changing the type of Integer::digits from char[] to byte[]

2025-05-24 Thread Shaojin Wen
Integer::digits type can use byte[] instead of char[], which can reduce the conversion from char to byte in the process of Integer.toString. Using byte[] can also save memory. - Commit messages: - char[] -> byte[] Changes: https://git.openjdk.org/jdk/pull/25426/files Webrev: htt

RFR: 8357681: Fixed the DigitList::toString method causing incorrect results during debugging

2025-05-23 Thread Shaojin Wen
When debugging getLong/getDouble/getDecimal of DigitList, the debugger will call the DigitList::toString method. At this time, DigitList::toString will modify tempBuilder, which will cause incorrect results. - Commit messages: - minimal change - remove tempBuilder Changes: https:

Re: RFR: 8354799: ZipInputStream doesn't verify CRC for ZIP entry with empty file data [v3]

2025-05-23 Thread Shaojin Wen
On Mon, 12 May 2025 11:27:35 GMT, Jaikiran Pai wrote: >> Can I please get a review of this change which addresses the issue noted in >> https://bugs.openjdk.org/browse/JDK-8354799? >> >> `java.util.zip.ZipInputStream` when dealing with a `STORED` entry of zero >> size was missing a CRC check f

Re: RFR: 8357081: Removed unused methods of HexDigits [v2]

2025-05-22 Thread Shaojin Wen
> In HexDigits, getCharsLatin1 and getCharsUTF16 are no longer used, so remove > these methods Shaojin Wen has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains two commits: - Merge remote-tracking branch 'upstream/m

Integrated: 8353741: Eliminate table lookup in UUID.toString

2025-05-22 Thread Shaojin Wen
On Mon, 6 Jan 2025 13:18:50 GMT, Shaojin Wen wrote: > Improve the performance of UUID::toString by using Long.expand and SWAR (SIMD > within a register) instead of table lookup. Eliminating the table lookup can > also avoid the performance degradation problem when the cache misses.

Re: RFR: 8357531: The `SegmentBulkOperations::fill` method can be improved using overlaps [v2]

2025-05-22 Thread Shaojin Wen
On Thu, 22 May 2025 08:14:35 GMT, Per Minborg wrote: >> This PR builds on a concept John Rose told me about some time ago. Instead >> of combining memory operations of various sizes, a single large and skewed >> memory operation can be made to clean up the tail of remaining bytes. >> >> This h

Re: RFR: 8357531: The `SegmentBulkOperations::fill` method can be improved using overlaps [v2]

2025-05-22 Thread Shaojin Wen
On Thu, 22 May 2025 08:11:09 GMT, Per Minborg wrote: >> This PR builds on a concept John Rose told me about some time ago. Instead >> of combining memory operations of various sizes, a single large and skewed >> memory operation can be made to clean up the tail of remaining bytes. >> >> This h

Re: RFR: 8357281: sun.util.Locale.LanguageTag should be immutable

2025-05-21 Thread Shaojin Wen
On Wed, 21 May 2025 21:19:36 GMT, Justin Lu wrote: > _sun.util.Locale.LanguageTag_ is essentially a BCP47 language tag data > carrier for Locale. The class, once created is not modified; the class should > be made immutable. Converting the class to a record accomplishes this and > also simplif

Re: RFR: 8349176: Speed up Integer/Long.toString via allocateUninitializedArray [v5]

2025-05-21 Thread Shaojin Wen
> The byte[] allocated in Integer/Long.toString is fully filled, so we can use > StringConcatHelper::newArray to create byte[] to improve performance. Shaojin Wen has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 11 commits: -

Integrated: 8357063: Document preconditions for DecimalDigits methods

2025-05-21 Thread Shaojin Wen
On Thu, 15 May 2025 06:24:44 GMT, Shaojin Wen wrote: > Similar to PR #24982 > Document preconditions on certain DecimalDigits methods that use operations > either unsafe and/or without range checks. This pull request has now been integrated. Changeset: 07871cd7 Author: Shaojin

Re: RFR: 8353741: Eliminate table lookup in UUID.toString [v8]

2025-05-20 Thread Shaojin Wen
> Improve the performance of UUID::toString by using Long.expand and SWAR (SIMD > within a register) instead of table lookup. Eliminating the table lookup can > also avoid the performance degradation problem when the cache misses. Shaojin Wen has updated the pull request incrementally

Re: RFR: 8353741: Eliminate table lookup in UUID.toString [v7]

2025-05-20 Thread Shaojin Wen
> Improve the performance of UUID::toString by using Long.expand and SWAR (SIMD > within a register) instead of table lookup. Eliminating the table lookup can > also avoid the performance degradation problem when the cache misses. Shaojin Wen has updated the pull request incrementally

Re: RFR: 8354799: ZipInputStream doesn't verify CRC for ZIP entry with empty file data [v3]

2025-05-20 Thread Shaojin Wen
On Mon, 12 May 2025 11:27:35 GMT, Jaikiran Pai wrote: >> Can I please get a review of this change which addresses the issue noted in >> https://bugs.openjdk.org/browse/JDK-8354799? >> >> `java.util.zip.ZipInputStream` when dealing with a `STORED` entry of zero >> size was missing a CRC check f

Re: RFR: 8353741: Eliminate table lookup in UUID.toString [v6]

2025-05-20 Thread Shaojin Wen
On Tue, 20 May 2025 19:51:14 GMT, Roger Riggs wrote: >> Shaojin Wen has updated the pull request incrementally with one additional >> commit since the last revision: >> >> hex8 comments > > src/java.base/share/classes/java/util/UUID.java line 528: > >

Re: RFR: 8357063: Document preconditions for DecimalDigits methods [v4]

2025-05-20 Thread Shaojin Wen
On Tue, 20 May 2025 15:53:34 GMT, Jaikiran Pai wrote: >> Shaojin Wen has updated the pull request incrementally with one additional >> commit since the last revision: >> >> warning > > src/java.base/share/classes/jdk/internal/util/DecimalDigits.java line

Re: RFR: 8357289: Break down the String constructor into smaller methods [v3]

2025-05-20 Thread Shaojin Wen
On Tue, 20 May 2025 08:26:20 GMT, Per Minborg wrote: > I wonder if it would be better to first check `COMPACT_STRINGS` in a > first-level `if` and then branch off to separate support methods? Looking at > the comments near the declaration of `COMPACT_STRINGS`, this might provide > additional b

Re: RFR: 8357289: Break down the String constructor into smaller methods [v3]

2025-05-19 Thread Shaojin Wen
g > constructor > > > String(Charset charset, byte[] bytes, int offset, int length) {} > > The above String constructor is too large; break it down into smaller methods > with a codeSize under 325 to allow them to be inlined by the C2. Shaojin Wen has updated the pull requ

Re: RFR: 8357289: Break down the String constructor into smaller methods [v2]

2025-05-19 Thread Shaojin Wen
g > constructor > > > String(Charset charset, byte[] bytes, int offset, int length) {} > > The above String constructor is too large; break it down into smaller methods > with a codeSize under 325 to allow them to be inlined by the C2. Shaojin Wen has updated the pull requ

Re: RFR: 8357289: Break down the String constructor into smaller methods

2025-05-19 Thread Shaojin Wen
On Sun, 18 May 2025 20:44:12 GMT, Chen Liang wrote: >> Through JVM Option +PrintInlining, we found that String has a constructor >> codeSize of 852, which is too large. This caused failed to inline. >> >> The following is the output information of PrintInlining: >> >> @ 9 jav

Re: RFR: 8357289: Break down the String constructor into smaller methods

2025-05-19 Thread Shaojin Wen
On Sun, 18 May 2025 12:48:07 GMT, Shaojin Wen wrote: > Through JVM Option +PrintInlining, we found that String has a constructor > codeSize of 852, which is too large. This caused failed to inline. > > The following is the output information of PrintInlining: > >

RFR: 8357289: Break down the String constructor into smaller methods

2025-05-19 Thread Shaojin Wen
Through JVM Option +PrintInlining, we found that String has a constructor codeSize of 852, which is too large. This caused failed to inline. The following is the output information of PrintInlining: @ 9 java.lang.String:: (12 bytes) inline (hot) !m @ 1 java.

Re: RFR: 8353741: Eliminate table lookup in UUID.toString [v3]

2025-05-19 Thread Shaojin Wen
On Mon, 19 May 2025 18:30:20 GMT, Roger Riggs wrote: >> Shaojin Wen has updated the pull request incrementally with one additional >> commit since the last revision: >> >> simplify code > > src/java.base/share/classes/java/util/UUID.java line 491: > >>

Re: RFR: 8353741: Eliminate table lookup in UUID.toString [v6]

2025-05-19 Thread Shaojin Wen
> Improve the performance of UUID::toString by using Long.expand and SWAR (SIMD > within a register) instead of table lookup. Eliminating the table lookup can > also avoid the performance degradation problem when the cache misses. Shaojin Wen has updated the pull request incrementally

Re: RFR: 8353741: Eliminate table lookup in UUID.toString [v5]

2025-05-19 Thread Shaojin Wen
> Improve the performance of UUID::toString by using Long.expand and SWAR (SIMD > within a register) instead of table lookup. Eliminating the table lookup can > also avoid the performance degradation problem when the cache misses. Shaojin Wen has updated the pull request incrementally

Re: RFR: 8353741: Eliminate table lookup in UUID.toString [v4]

2025-05-19 Thread Shaojin Wen
On Mon, 19 May 2025 20:17:43 GMT, Shaojin Wen wrote: >> Improve the performance of UUID::toString by using Long.expand and SWAR >> (SIMD within a register) instead of table lookup. Eliminating the table >> lookup can also avoid the performance degradation problem when th

Re: RFR: 8353741: Eliminate table lookup in UUID.toString [v4]

2025-05-19 Thread Shaojin Wen
> Improve the performance of UUID::toString by using Long.expand and SWAR (SIMD > within a register) instead of table lookup. Eliminating the table lookup can > also avoid the performance degradation problem when the cache misses. Shaojin Wen has updated the pull request with a new ta

Re: RFR: 8357081: Removed unused methods of HexDigits

2025-05-19 Thread Shaojin Wen
On Thu, 15 May 2025 22:03:22 GMT, Shaojin Wen wrote: > In HexDigits, getCharsLatin1 and getCharsUTF16 are no longer used, so remove > these methods The getCharsLatin1/getCharsUTF16 methods of HexDigits may be used in j.u.Formatter/HexFormat in the future. For this reason, should we kee

Re: RFR: 8355177: Speed up StringBuilder::append(char[]) via Unsafe::copyMemory [v4]

2025-05-17 Thread Shaojin Wen
On Fri, 2 May 2025 07:13:21 GMT, Shaojin Wen wrote: >>> ```java >>> > char[] ca = new char[end - off]; >>> ``` >>> >>> Your code here has a memory allocation, which may cause slowdown >> >> This is exactly what I wanted to

Re: RFR: 8357063: Document preconditions for DecimalDigits methods [v4]

2025-05-16 Thread Shaojin Wen
> Similar to PR #24982 > Document preconditions on certain DecimalDigits methods that use operations > either unsafe and/or without range checks. Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: warning -

Re: RFR: 8357063: Document preconditions for DecimalDigits methods [v3]

2025-05-16 Thread Shaojin Wen
> Similar to PR #24982 > Document preconditions on certain DecimalDigits methods that use operations > either unsafe and/or without range checks. Shaojin Wen has updated the pull request incrementally with seven additional commits since the last revision: - Update src/java.base/shar

Re: RFR: 8357063: Document preconditions for DecimalDigits methods [v2]

2025-05-16 Thread Shaojin Wen
> Similar to PR #24982 > Document preconditions on certain DecimalDigits methods that use operations > either unsafe and/or without range checks. Shaojin Wen has updated the pull request incrementally with two additional commits since the last revision: - assert - document add

RFR: 8357081: Removed unused methods of HexDigits

2025-05-15 Thread Shaojin Wen
In HexDigits, getCharsLatin1 and getCharsUTF16 are no longer used, so remove these methods - Commit messages: - remove unused code Changes: https://git.openjdk.org/jdk/pull/25258/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25258&range=00 Issue: https://bugs.openjdk.o

Re: RFR: 8356891: Some code simplifications for basic BigIntegers' bit operations [v6]

2025-05-15 Thread Shaojin Wen
On Thu, 15 May 2025 15:37:39 GMT, fabioromano1 wrote: >> Some changes in `Biginteger`s' bit operations that increase the code >> readability and slightly optimize the execution time. > > fabioromano1 has updated the pull request incrementally with one additional > commit since the last revision

Re: RFR: 8357063: Document preconditions for DecimalDigits methods

2025-05-15 Thread Shaojin Wen
On Thu, 15 May 2025 18:12:28 GMT, Raffaello Giulietti wrote: > @wenshao I understand this is a kind of followup of #24982, but why this > title? It seems just renaming some methods with more speaking names. Yes, it is just a renaming of some methods, the title is followup #24982, does the sam

RFR: 8357063: Document preconditions for DecimalDigits methods

2025-05-15 Thread Shaojin Wen
Similar to PR #24982 Document preconditions on certain DecimalDigits methods that use operations either unsafe and/or without range checks. - Commit messages: - Document preconditions for DecimalDigits methods Changes: https://git.openjdk.org/jdk/pull/25246/files Webrev: https:/

Re: RFR: 8355177: Speed up StringBuilder::append(char[]) via Unsafe::copyMemory [v4]

2025-05-12 Thread Shaojin Wen
On Mon, 12 May 2025 18:33:03 GMT, Roger Riggs wrote: >>> This use of Unsafe is not warranted. If it can't be done with arrayCopy, >>> leave the original code as is. >> >> The core library also uses Unsafe.copyMemory in many places. Can it be used >> in this scenario? Or can we find other ways

Re: RFR: 8355177: Speed up StringBuilder::append(char[]) via UTF16::compress & Unsafe::copyMemory [v5]

2025-05-10 Thread Shaojin Wen
p to > improve the speed. Shaojin Wen has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains nine commits: - copyright - Merge remote-tracking branch 'upstream/master' into optim_sb_append_chars_202504 # Conflicts:

Re: RFR: 8356255: Add Stable Field Updaters to allow efficient lazy field evaluations [v3]

2025-05-07 Thread Shaojin Wen
On Wed, 7 May 2025 07:46:45 GMT, Per Minborg wrote: >> This sketch shows how "Stable Updaters" can be used to create stable >> computations of `@Stable` fields. Only one updater is needed per class, >> similar to `AtomicIntegerFieldUpdater`. > > Per Minborg has updated the pull request incremen

Re: RFR: 8341184: Clean up the interaction between the launcher native code and the LauncherHelper [v16]

2025-05-07 Thread Shaojin Wen
On Mon, 24 Feb 2025 09:46:29 GMT, Jaikiran Pai wrote: >> Can I please get a review of this change, which simplifies the interaction >> between the `java` launcher's native code with the >> `sun.launcher.LauncherHelper`? >> >> As noted in https://bugs.openjdk.org/browse/JDK-8341184, this propo

  1   2   3   4   5   6   7   8   9   10   >