Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v20]

2025-02-01 Thread altrisi
On Fri, 18 Oct 2024 21:56:53 GMT, Shaojin Wen wrote: >> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into >> primitive arrays by combining values ​​into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that >> these two meth

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v20]

2025-02-01 Thread Shaojin Wen
On Fri, 18 Oct 2024 21:56:53 GMT, Shaojin Wen wrote: >> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into >> primitive arrays by combining values ​​into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that >> these two meth

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v20]

2025-02-01 Thread altrisi
On Fri, 18 Oct 2024 21:56:53 GMT, Shaojin Wen wrote: >> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into >> primitive arrays by combining values ​​into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that >> these two meth

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v20]

2024-11-05 Thread Shaojin Wen
On Fri, 18 Oct 2024 21:56:53 GMT, Shaojin Wen wrote: >> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into >> primitive arrays by combining values ​​into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that >> these two meth

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v20]

2024-11-05 Thread Emanuel Peter
On Fri, 18 Oct 2024 21:56:53 GMT, Shaojin Wen wrote: >> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into >> primitive arrays by combining values ​​into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that >> these two meth

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v20]

2024-10-21 Thread Shaojin Wen
On Fri, 18 Oct 2024 21:56:53 GMT, Shaojin Wen wrote: >> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into >> primitive arrays by combining values ​​into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that >> these two meth

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v20]

2024-10-21 Thread Chen Liang
On Fri, 18 Oct 2024 21:56:53 GMT, Shaojin Wen wrote: >> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into >> primitive arrays by combining values ​​into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that >> these two meth

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v20]

2024-10-21 Thread Emanuel Peter
On Fri, 18 Oct 2024 21:56:53 GMT, Shaojin Wen wrote: >> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into >> primitive arrays by combining values ​​into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that >> these two meth

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v20]

2024-10-21 Thread Emanuel Peter
On Fri, 18 Oct 2024 21:56:53 GMT, Shaojin Wen wrote: >> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into >> primitive arrays by combining values ​​into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that >> these two meth

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v20]

2024-10-21 Thread Claes Redestad
On Mon, 21 Oct 2024 07:58:42 GMT, Emanuel Peter wrote: >> 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 changes >> brought in by the merge/rebase. The pull request contains 26 additional >> commits s

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v20]

2024-10-21 Thread Emanuel Peter
On Mon, 21 Oct 2024 01:29:16 GMT, Shaojin Wen wrote: >> 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 changes >> brought in by the merge/rebase. The pull request contains 26 additional >> commits sin

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v20]

2024-10-20 Thread Shaojin Wen
On Fri, 18 Oct 2024 21:56:53 GMT, Shaojin Wen wrote: >> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into >> primitive arrays by combining values ​​into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that >> these two meth

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v20]

2024-10-20 Thread Shaojin Wen
On Fri, 18 Oct 2024 21:56:53 GMT, Shaojin Wen wrote: >> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into >> primitive arrays by combining values ​​into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that >> these two meth

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v20]

2024-10-20 Thread Claes Redestad
On Fri, 18 Oct 2024 21:56:53 GMT, Shaojin Wen wrote: >> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into >> primitive arrays by combining values ​​into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that >> these two meth

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v20]

2024-10-20 Thread Shaojin Wen
On Fri, 18 Oct 2024 21:56:53 GMT, Shaojin Wen wrote: >> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into >> primitive arrays by combining values ​​into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that >> these two meth

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v20]

2024-10-19 Thread Claes Redestad
On Fri, 18 Oct 2024 23:29:58 GMT, Shaojin Wen wrote: > After PR 19970, the performance has been significantly improved. Below are > the performance numbers for AMD CPU (x64) It'd be interesting to check performance on this micro with #19970 alone - PR Comment: https://git.openjdk.

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v20]

2024-10-18 Thread Shaojin Wen
On Fri, 18 Oct 2024 21:56:53 GMT, Shaojin Wen wrote: >> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into >> primitive arrays by combining values ​​into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that >> these two meth

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v20]

2024-10-18 Thread Shaojin Wen
> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into > primitive arrays by combining values ​​into larger stores. > > This PR rewrites the code of appendNull and append(boolean) methods so that > these two methods can be optimized by C2. Shaojin Wen has updated the pul

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v19]

2024-10-18 Thread Emanuel Peter
On Mon, 23 Sep 2024 23:23:12 GMT, Shaojin Wen wrote: >> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into >> primitive arrays by combining values ​​into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that >> these two meth

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v19]

2024-09-23 Thread Emanuel Peter
On Mon, 23 Sep 2024 23:23:12 GMT, Shaojin Wen wrote: >> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into >> primitive arrays by combining values ​​into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that >> these two meth

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v19]

2024-09-23 Thread Shaojin Wen
> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into > primitive arrays by combining values ​​into larger stores. > > This PR rewrites the code of appendNull and append(boolean) methods so that > these two methods can be optimized by C2. Shaojin Wen has updated the pul

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v17]

2024-09-22 Thread Shaojin Wen
On Sun, 22 Sep 2024 02:03:02 GMT, Chen Liang wrote: > We should declare `count` before `ensureCapacitiyInternal`. Same for append > boolean. Declaring count before ensureCapacityInternal will cause performance regression under x64. It took a lot of time to find this, but the underlying reason

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v18]

2024-09-22 Thread Shaojin Wen
On Sun, 22 Sep 2024 02:01:36 GMT, Chen Liang wrote: >> 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 changes >> brought in by the merge/rebase. The pull request contains 23 additional >> commits sinc

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v18]

2024-09-22 Thread Shaojin Wen
> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into > primitive arrays by combining values ​​into larger stores. > > This PR rewrites the code of appendNull and append(boolean) methods so that > these two methods can be optimized by C2. Shaojin Wen has updated the pul

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v17]

2024-09-21 Thread Chen Liang
On Sat, 24 Aug 2024 06:27:26 GMT, Shaojin Wen wrote: >> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into >> primitive arrays by combining values ​​into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that >> these two meth

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v17]

2024-08-23 Thread Shaojin Wen
> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into > primitive arrays by combining values ​​into larger stores. > > This PR rewrites the code of appendNull and append(boolean) methods so that > these two methods can be optimized by C2. Shaojin Wen has updated the pul

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v4]

2024-07-26 Thread Emanuel Peter
On Thu, 25 Jul 2024 01:14:32 GMT, Shaojin Wen wrote: >> @cl4es I would wait, to be honest. I'm currently quite busy, but I hope I >> can do something here in the next 2-3 weeks. > > @eme64 Unsafe.putByte MergeStore of master branch doesn't work > > > import sun.misc.Unsafe; > > public class

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v4]

2024-07-24 Thread Shaojin Wen
On Wed, 26 Jun 2024 14:39:57 GMT, Emanuel Peter wrote: >>> I filed: >>> >>> [JDK-8335113](https://bugs.openjdk.org/browse/JDK-8335113): C2 MergeStores: >>> allow merging of putChar and other larger stores on smaller array elements >> >> Great! Should we hold off on this optimization and see if

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v16]

2024-07-24 Thread Shaojin Wen
> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into > primitive arrays by combining values ​​into larger stores. > > This PR rewrites the code of appendNull and append(boolean) methods so that > these two methods can be optimized by C2. Shaojin Wen has updated the pul

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v15]

2024-07-23 Thread Shaojin Wen
On Tue, 23 Jul 2024 13:48:57 GMT, Chen Liang wrote: >> explicit array stores has the overhead of boundary checking. If putCharsAt >> of StringLatin1 is not implemented based on Unsafe, the performance will be >> worse than StringUTF16. >> >> Of course, this is a common problem. StringUTF16.pu

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v15]

2024-07-23 Thread Chen Liang
On Tue, 23 Jul 2024 13:42:20 GMT, Shaojin Wen wrote: >> src/java.base/share/classes/java/lang/StringLatin1.java line 832: >> >>> 830: static void putCharsAt(byte[] val, int index, int c1, int c2, int >>> c3, int c4) { >>> 831: assert index >= 0 && index + 3 < length(val) : "Trusted

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v15]

2024-07-23 Thread Shaojin Wen
On Tue, 23 Jul 2024 13:25:16 GMT, Chen Liang wrote: >> Shaojin Wen has updated the pull request incrementally with one additional >> commit since the last revision: >> >> replace unsafe with putChar > > src/java.base/share/classes/java/lang/StringLatin1.java line 832: > >> 830: static vo

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v15]

2024-07-23 Thread Chen Liang
On Tue, 23 Jul 2024 12:57:52 GMT, Shaojin Wen wrote: >> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into >> primitive arrays by combining values ​​into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that >> these two meth

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v15]

2024-07-23 Thread Shaojin Wen
> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into > primitive arrays by combining values ​​into larger stores. > > This PR rewrites the code of appendNull and append(boolean) methods so that > these two methods can be optimized by C2. Shaojin Wen has updated the pul

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v14]

2024-07-17 Thread Shaojin Wen
> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into > primitive arrays by combining values ​​into larger stores. > > This PR rewrites the code of appendNull and append(boolean) methods so that > these two methods can be optimized by C2. Shaojin Wen has updated the pul

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v13]

2024-06-26 Thread Shaojin Wen
On Sun, 23 Jun 2024 08:47:25 GMT, Shaojin Wen wrote: >> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into >> primitive arrays by combining values ​​into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that >> these two meth

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v4]

2024-06-26 Thread Claes Redestad
On Thu, 20 Jun 2024 14:32:25 GMT, Shaojin Wen wrote: >> @cl4es @wenshao I think we should probably work on `putChar`, or at least >> figure out what blocks `MergeStore` for `putChar`. Can someone produce a >> simple stand-alone `.java` file that uses `putChar`, so that I can >> investigate wh

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v4]

2024-06-26 Thread Emanuel Peter
On Wed, 26 Jun 2024 14:38:04 GMT, Claes Redestad wrote: >> @wenshao @cl4es I think this use-case is quite a valid one, and deserves an >> extension. I filed: >> >> [JDK-8335113](https://bugs.openjdk.org/browse/JDK-8335113): C2 MergeStores: >> allow merging of putChar and other larger stores on

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v4]

2024-06-26 Thread Claes Redestad
On Tue, 25 Jun 2024 17:19:28 GMT, Emanuel Peter wrote: > I filed: > > [JDK-8335113](https://bugs.openjdk.org/browse/JDK-8335113): C2 MergeStores: > allow merging of putChar and other larger stores on smaller array elements Great! Should we hold off on this optimization and see if we can avoid

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v4]

2024-06-25 Thread Emanuel Peter
On Thu, 20 Jun 2024 14:32:25 GMT, Shaojin Wen wrote: >> @cl4es @wenshao I think we should probably work on `putChar`, or at least >> figure out what blocks `MergeStore` for `putChar`. Can someone produce a >> simple stand-alone `.java` file that uses `putChar`, so that I can >> investigate wh

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v13]

2024-06-25 Thread Emanuel Peter
On Sun, 23 Jun 2024 08:47:25 GMT, Shaojin Wen wrote: >> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into >> primitive arrays by combining values ​​into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that >> these two meth

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v12]

2024-06-23 Thread Shaojin Wen
On Thu, 20 Jun 2024 09:54:37 GMT, Claes Redestad wrote: >> Shaojin Wen has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Utf16 case remove `append first utf16 char` > > src/java.base/share/classes/java/lang/StringLatin1.java line 832: > >

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v13]

2024-06-23 Thread Shaojin Wen
> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into > primitive arrays by combining values ​​into larger stores. > > This PR rewrites the code of appendNull and append(boolean) methods so that > these two methods can be optimized by C2. Shaojin Wen has updated the pul

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v4]

2024-06-20 Thread Shaojin Wen
On Thu, 20 Jun 2024 10:54:49 GMT, Emanuel Peter wrote: >> I'm not opposed to accepting this patch as-is, but I think we should do so >> with an eye towards reverting if we figure out a way to improve the >> `putChar` intrinsic so that it doesn't block merge store optimization. What >> do you t

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v4]

2024-06-20 Thread Emanuel Peter
On Thu, 20 Jun 2024 10:09:46 GMT, Claes Redestad wrote: >> @wenshao I'm glad we figured it out a bit, and I hope you learned a thing or >> two :) >> >>> It would be even better if Unsafe.putChar could be used for MergeStore in >>> the future. >> >> The `_putCharStringU` intrinsic uses >> `Li

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v4]

2024-06-20 Thread Claes Redestad
On Thu, 13 Jun 2024 07:36:34 GMT, Emanuel Peter wrote: >> Thanks to @eme64 's patience and help, I found a way to use MergeStore >> without doing boundary checking. >> >> It would be even better if Unsafe.putChar could be used for MergeStore in >> the future. >> >> ## 1. JavaCode >> >> class

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v12]

2024-06-20 Thread Claes Redestad
On Mon, 17 Jun 2024 05:53:45 GMT, Shaojin Wen wrote: >> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into >> primitive arrays by combining values ​​into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that >> these two meth

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v8]

2024-06-19 Thread Shaojin Wen
On Thu, 13 Jun 2024 09:51:21 GMT, Claes Redestad wrote: >> Shaojin Wen has updated the pull request incrementally with two additional >> commits since the last revision: >> >> - rename benchmark >> - code format & use long address > > Replacing `StringUTF16.putChar` with an `Unsafe.putByte` c

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v12]

2024-06-16 Thread Shaojin Wen
> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into > primitive arrays by combining values ​​into larger stores. > > This PR rewrites the code of appendNull and append(boolean) methods so that > these two methods can be optimized by C2. Shaojin Wen has updated the pul

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v11]

2024-06-16 Thread Shaojin Wen
> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into > primitive arrays by combining values ​​into larger stores. > > This PR rewrites the code of appendNull and append(boolean) methods so that > these two methods can be optimized by C2. Shaojin Wen has updated the pul

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v10]

2024-06-14 Thread Shaojin Wen
> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into > primitive arrays by combining values ​​into larger stores. > > This PR rewrites the code of appendNull and append(boolean) methods so that > these two methods can be optimized by C2. Shaojin Wen has updated the pul

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v9]

2024-06-14 Thread Shaojin Wen
On Fri, 14 Jun 2024 01:17:29 GMT, Shaojin Wen wrote: >> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into >> primitive arrays by combining values ​​into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that >> these two meth

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v9]

2024-06-13 Thread Shaojin Wen
> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into > primitive arrays by combining values ​​into larger stores. > > This PR rewrites the code of appendNull and append(boolean) methods so that > these two methods can be optimized by C2. Shaojin Wen has updated the pul

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v8]

2024-06-13 Thread Shaojin Wen
On Thu, 13 Jun 2024 02:06:42 GMT, Shaojin Wen wrote: >> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into >> primitive arrays by combining values ​​into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that >> these two meth

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v8]

2024-06-13 Thread Claes Redestad
On Thu, 13 Jun 2024 02:06:42 GMT, Shaojin Wen wrote: >> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into >> primitive arrays by combining values ​​into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that >> these two meth

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v4]

2024-06-13 Thread Emanuel Peter
On Wed, 12 Jun 2024 15:58:59 GMT, Shaojin Wen wrote: >>> @eme64 It seems like MergeStore didn't happen, is there something I did >>> wrong? >> >> Yes ;) >> >> @wenshao The issue is that the pattern matching is quite **limited**. >> `putCharsAt(byte[] value, int i, char c1, char c2, char c3, ch

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v8]

2024-06-12 Thread Shaojin Wen
> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into > primitive arrays by combining values ​​into larger stores. > > This PR rewrites the code of appendNull and append(boolean) methods so that > these two methods can be optimized by C2. Shaojin Wen has updated the pul

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v7]

2024-06-12 Thread Shaojin Wen
> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into > primitive arrays by combining values ​​into larger stores. > > This PR rewrites the code of appendNull and append(boolean) methods so that > these two methods can be optimized by C2. Shaojin Wen has updated the pul

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v6]

2024-06-12 Thread Shaojin Wen
> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into > primitive arrays by combining values ​​into larger stores. > > This PR rewrites the code of appendNull and append(boolean) methods so that > these two methods can be optimized by C2. Shaojin Wen has updated the pul

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v4]

2024-06-12 Thread Shaojin Wen
On Wed, 12 Jun 2024 14:58:39 GMT, Emanuel Peter wrote: >> @wenshao If you look at the tests in >> https://github.com/openjdk/jdk/pull/16245, you can see examples like this: >> https://github.com/eme64/jdk/blob/93bf2ddc9b7f584724034aec6a4f8b9fe1b2dfda/test/hotspot/jtreg/compiler/c2/TestMergeStore

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v5]

2024-06-12 Thread Shaojin Wen
> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into > primitive arrays by combining values ​​into larger stores. > > This PR rewrites the code of appendNull and append(boolean) methods so that > these two methods can be optimized by C2. Shaojin Wen has updated the pul

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v4]

2024-06-12 Thread Emanuel Peter
On Wed, 12 Jun 2024 14:24:00 GMT, Emanuel Peter wrote: >> _putCharStringU will perform MergeStore but with bounds checking. Can the C2 >> optimizer perform MergeStore without bounds checking in this case? >> >> StringUTF16.putChar does not have a bounds check, so there should be no >> bounds c

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v4]

2024-06-12 Thread Shaojin Wen
On Wed, 12 Jun 2024 14:24:00 GMT, Emanuel Peter wrote: >> _putCharStringU will perform MergeStore but with bounds checking. Can the C2 >> optimizer perform MergeStore without bounds checking in this case? >> >> StringUTF16.putChar does not have a bounds check, so there should be no >> bounds c

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v4]

2024-06-12 Thread Emanuel Peter
On Wed, 12 Jun 2024 14:16:50 GMT, Shaojin Wen wrote: >> Shaojin Wen has updated the pull request incrementally with one additional >> commit since the last revision: >> >> revert > > _putCharStringU will perform MergeStore but with bounds checking. Can the C2 > optimizer perform MergeStore w

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v4]

2024-06-12 Thread Shaojin Wen
On Tue, 11 Jun 2024 11:35:28 GMT, Shaojin Wen wrote: >> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into >> primitive arrays by combining values ​​into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that >> these two meth

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v4]

2024-06-12 Thread Claes Redestad
On Wed, 12 Jun 2024 13:38:21 GMT, Shaojin Wen wrote: > In the AbstractStringBuilder#appendNull method, is it possible to not check > the bounds based on the information from ensureCapacityInternal? Perhaps you'd need something like a `Preconditions.checkIndex` in or before the 4-char `StringUT

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v4]

2024-06-12 Thread Claes Redestad
On Tue, 11 Jun 2024 11:35:28 GMT, Shaojin Wen wrote: >> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into >> primitive arrays by combining values ​​into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that >> these two meth

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v4]

2024-06-12 Thread Shaojin Wen
On Tue, 11 Jun 2024 11:35:28 GMT, Shaojin Wen wrote: >> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into >> primitive arrays by combining values ​​into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that >> these two meth

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v4]

2024-06-12 Thread Emanuel Peter
On Tue, 11 Jun 2024 11:35:28 GMT, Shaojin Wen wrote: >> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into >> primitive arrays by combining values ​​into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that >> these two meth

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v4]

2024-06-12 Thread Shaojin Wen
On Tue, 11 Jun 2024 11:35:28 GMT, Shaojin Wen wrote: >> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into >> primitive arrays by combining values ​​into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that >> these two meth

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v4]

2024-06-12 Thread Claes Redestad
On Tue, 11 Jun 2024 11:35:28 GMT, Shaojin Wen wrote: >> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into >> primitive arrays by combining values ​​into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that >> these two meth

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v4]

2024-06-12 Thread Claes Redestad
On Tue, 11 Jun 2024 11:35:28 GMT, Shaojin Wen wrote: >> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into >> primitive arrays by combining values ​​into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that >> these two meth

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v4]

2024-06-12 Thread Emanuel Peter
On Wed, 12 Jun 2024 12:38:58 GMT, Shaojin Wen wrote: >> Shaojin Wen has updated the pull request incrementally with one additional >> commit since the last revision: >> >> revert > > -XX:+TraceMergeStores -XX:+UnlockDiagnosticVMOptions > -XX:DisableIntrinsic=_putCharStringU > > > > [Trace

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v4]

2024-06-12 Thread Shaojin Wen
On Tue, 11 Jun 2024 11:35:28 GMT, Shaojin Wen wrote: >> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into >> primitive arrays by combining values ​​into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that >> these two meth

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v4]

2024-06-12 Thread Claes Redestad
On Tue, 11 Jun 2024 11:35:28 GMT, Shaojin Wen wrote: >> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into >> primitive arrays by combining values ​​into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that >> these two meth

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v4]

2024-06-12 Thread Shaojin Wen
On Tue, 11 Jun 2024 11:35:28 GMT, Shaojin Wen wrote: >> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into >> primitive arrays by combining values ​​into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that >> these two meth

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v4]

2024-06-12 Thread Emanuel Peter
On Wed, 12 Jun 2024 12:18:32 GMT, Shaojin Wen wrote: > I have another question. The StringUTF16.putChar method inside JDK is an > intrinsic method, which seems to cause the putCharsAt method to be unable to > merge to long stores. Can you show me an example, with the `-XX:CompileCommand=printc

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v4]

2024-06-12 Thread Shaojin Wen
On Wed, 12 Jun 2024 11:59:47 GMT, Emanuel Peter wrote: >> Shaojin Wen has updated the pull request incrementally with one additional >> commit since the last revision: >> >> revert > > Going back to: > > ./java -XX:+TraceMergeStores -Xbatch -XX:CompileCommand=printcompilation,*::* > -XX:+Pr

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v4]

2024-06-12 Thread Emanuel Peter
On Tue, 11 Jun 2024 11:35:28 GMT, Shaojin Wen wrote: >> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into >> primitive arrays by combining values ​​into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that >> these two meth

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v4]

2024-06-12 Thread Emanuel Peter
On Tue, 11 Jun 2024 11:35:28 GMT, Shaojin Wen wrote: >> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into >> primitive arrays by combining values ​​into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that >> these two meth

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v4]

2024-06-12 Thread Shaojin Wen
On Tue, 11 Jun 2024 11:35:28 GMT, Shaojin Wen wrote: >> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into >> primitive arrays by combining values ​​into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that >> these two meth

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v4]

2024-06-12 Thread Emanuel Peter
On Tue, 11 Jun 2024 11:35:28 GMT, Shaojin Wen wrote: >> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into >> primitive arrays by combining values ​​into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that >> these two meth

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v4]

2024-06-11 Thread Shaojin Wen
On Tue, 11 Jun 2024 11:35:28 GMT, Shaojin Wen wrote: >> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into >> primitive arrays by combining values ​​into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that >> these two meth

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v4]

2024-06-11 Thread Emanuel Peter
On Tue, 11 Jun 2024 11:35:28 GMT, Shaojin Wen wrote: >> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into >> primitive arrays by combining values ​​into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that >> these two meth

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v4]

2024-06-11 Thread Emanuel Peter
On Tue, 11 Jun 2024 11:35:28 GMT, Shaojin Wen wrote: >> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into >> primitive arrays by combining values ​​into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that >> these two meth

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v4]

2024-06-11 Thread Shaojin Wen
On Tue, 11 Jun 2024 11:35:28 GMT, Shaojin Wen wrote: >> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into >> primitive arrays by combining values ​​into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that >> these two meth

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v4]

2024-06-11 Thread Shaojin Wen
On Tue, 11 Jun 2024 16:08:18 GMT, Emanuel Peter wrote: >> @eme64 TraceMergeStores are here, but I can't understand these assembly >> codes >> >> # JavaCode >> >> class AbstractStringBuilder { >> private AbstractStringBuilder appendNull() { >> int count = this.count; >> en

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v4]

2024-06-11 Thread Emanuel Peter
On Tue, 11 Jun 2024 15:55:18 GMT, Shaojin Wen wrote: >> @wenshao have you published info about `TraceMergeStores` somewhere? It is >> very well possible that the optimization does not apply in your code. Then >> you would need to dig into the VM code and see why. > > @eme64 TraceMergeStores are

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v4]

2024-06-11 Thread Emanuel Peter
On Tue, 11 Jun 2024 12:11:21 GMT, Shaojin Wen wrote: >> Shaojin Wen has updated the pull request incrementally with one additional >> commit since the last revision: >> >> revert > > ([f96cde4e](https://git.openjdk.org/jdk/pull/19626/files/f96cde4e79e12e2ea46e6061f918a69f11d59985)) > > ([0c

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v4]

2024-06-11 Thread Shaojin Wen
On Tue, 11 Jun 2024 11:35:28 GMT, Shaojin Wen wrote: >> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into >> primitive arrays by combining values ​​into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that >> these two meth

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v4]

2024-06-11 Thread Shaojin Wen
> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into > primitive arrays by combining values ​​into larger stores. > > This PR rewrites the code of appendNull and append(boolean) methods so that > these two methods can be optimized by C2. Shaojin Wen has updated the pul

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v3]

2024-06-11 Thread Emanuel Peter
On Tue, 11 Jun 2024 05:42:27 GMT, Shaojin Wen wrote: >> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into >> primitive arrays by combining values ​​into larger stores. >> >> This PR rewrites the code of appendNull and append(boolean) methods so that >> these two meth

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null

2024-06-11 Thread Emanuel Peter
On Tue, 11 Jun 2024 09:39:29 GMT, Shaojin Wen wrote: >> @wenshao This is just an assembly dump. You need to have some profiling data >> that tells you where the time is spent. I'm not going to do the analysis >> work for you, I'm sorry. I gave you some pointers as how to do that. If you >> hav

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null

2024-06-11 Thread Shaojin Wen
On Tue, 11 Jun 2024 09:32:14 GMT, Emanuel Peter wrote: >> @eme64 The assembly information is below, can you take a look and see if it >> can help you diagnose the problem? >> >> * JavaCode >> >> class AbstractStringBuilder { >> private AbstractStringBuilder appendNull() { >> int c

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null

2024-06-11 Thread Emanuel Peter
On Tue, 11 Jun 2024 09:17:00 GMT, Shaojin Wen wrote: >> @wenshao >>> @eme64 It seems that when the following code uses StringUTF16.putChar, C2's >>> optimization is not as good as the manual merging and storage effect. >> >> As I asked above, you will need to provide some evidence / generated

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null

2024-06-11 Thread Shaojin Wen
On Tue, 11 Jun 2024 06:27:13 GMT, Emanuel Peter wrote: >> @eme64 It seems that when the following code uses StringUTF16.putChar, C2's >> optimization is not as good as the manual merging and storage effect. >> >> class AbstractStringBuilder { >> private AbstractStringBuilder appendNull() {

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null

2024-06-10 Thread Emanuel Peter
On Mon, 10 Jun 2024 23:10:05 GMT, Shaojin Wen wrote: >> @wenshao >>> I think the performance of the Unsafe branch may be the best data for the >>> C2 optimizer. @eme64 can help me see if C2 can do it? >> >> Have you tried to see if the optimization actually was done/taken? You can >> use the

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v3]

2024-06-10 Thread Shaojin Wen
> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into > primitive arrays by combining values ​​into larger stores. > > This PR rewrites the code of appendNull and append(boolean) methods so that > these two methods can be optimized by C2. Shaojin Wen has updated the pul

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null [v2]

2024-06-10 Thread Shaojin Wen
> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into > primitive arrays by combining values ​​into larger stores. > > This PR rewrites the code of appendNull and append(boolean) methods so that > these two methods can be optimized by C2. Shaojin Wen has updated the pul

Re: RFR: 8333893: Optimization for StringBuilder append boolean & null

2024-06-10 Thread Claes Redestad
On Mon, 10 Jun 2024 12:12:58 GMT, Shaojin Wen wrote: > After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into > primitive arrays by combining values ​​into larger stores. > > This PR rewrites the code of appendNull and append(boolean) methods so that > these two methods c

  1   2   >