Re: RFR: 8331291: java.lang.classfile.Attributes class performs a lot of static initializations [v10]

2024-05-24 Thread Claes Redestad
On Fri, 24 May 2024 08:24:15 GMT, Adam Sotona wrote: >> Hi, >> During performance optimization work on Class-File API as JDK lambda >> generator we found some static initialization killers. >> One of them is `java.lang.classfile.Attributes` with tens of static fields >> initialized with

Integrated: 8332528: Generate code in SwitchBootstraps.generateTypeSwitch that require fewer adaptations

2024-05-23 Thread Claes Redestad
On Mon, 20 May 2024 10:52:27 GMT, Claes Redestad wrote: > We can fold the call to `Objects.checkIndex` into the code generated in > generateTypeSwitchSkeleton instead of doing so by filtering the MH argument. > This loads 9 less classes (of which 8 generated LFs and Specie

Re: RFR: 8332528: Generate code in SwitchBootstraps.generateTypeSwitch that require fewer adaptations [v4]

2024-05-23 Thread Claes Redestad
On Thu, 23 May 2024 11:09:14 GMT, Claes Redestad wrote: >> We can fold the call to `Objects.checkIndex` into the code generated in >> generateTypeSwitchSkeleton instead of doing so by filtering the MH argument. >> This loads 9 less classes (of which 8 generated LFs a

Re: RFR: 8332528: Generate code in SwitchBootstraps.generateTypeSwitch that require fewer adaptations [v3]

2024-05-23 Thread Claes Redestad
On Thu, 23 May 2024 09:46:51 GMT, Jan Lahoda wrote: >> Claes Redestad has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Add type switch to HelloClasslist > > src/java.base/share/classes/java/lang/runtime

Re: RFR: 8332528: Generate code in SwitchBootstraps.generateTypeSwitch that require fewer adaptations [v4]

2024-05-23 Thread Claes Redestad
used `findStatic` > calls to a holder. All in all this means a reduction by 22M cycles to > bootstrap a trivial switch expression on my M1. Claes Redestad has updated the pull request incrementally with one additional commit since the last revision: Remove unused im

Re: RFR: 8332490: JMH org.openjdk.bench.java.util.zip.InflaterInputStreams.inflaterInputStreamRead OOM [v2]

2024-05-22 Thread Claes Redestad
On Wed, 22 May 2024 07:49:27 GMT, Jaikiran Pai wrote: >> Can I please get a review of this test-only change for addressing >> https://bugs.openjdk.org/browse/JDK-8332490? >> >> The jmh test opens a `InflaterInputStream`, reads the stream contents, but >> then doesn't close the stream. This

Re: RFR: 8332490: JMH org.openjdk.bench.java.util.zip.InflaterInputStreams.inflaterInputStreamRead OOM

2024-05-22 Thread Claes Redestad
On Wed, 22 May 2024 07:20:04 GMT, Alan Bateman wrote: >> Can I please get a review of this test-only change for addressing >> https://bugs.openjdk.org/browse/JDK-8332490? >> >> The jmh test opens a `InflaterInputStream`, reads the stream contents, but >> then doesn't close the stream. This

Re: RFR: 8332490: JMH org.openjdk.bench.java.util.zip.InflaterInputStreams.inflaterInputStreamRead OOM

2024-05-22 Thread Claes Redestad
On Wed, 22 May 2024 05:16:42 GMT, Jaikiran Pai wrote: > Can I please get a review of this test-only change for addressing > https://bugs.openjdk.org/browse/JDK-8332490? > > The jmh test opens a `InflaterInputStream`, reads the stream contents, but > then doesn't close the stream. This can

Re: RFR: 8332528: Generate code in SwitchBootstraps.generateTypeSwitch that require fewer adaptations [v3]

2024-05-21 Thread Claes Redestad
On Tue, 21 May 2024 09:01:32 GMT, Claes Redestad wrote: >> We can fold the call to `Objects.checkIndex` into the code generated in >> generateTypeSwitchSkeleton instead of doing so by filtering the MH argument. >> This loads 9 less classes (of which 8 generated LFs a

Re: RFR: 8332528: Generate code in SwitchBootstraps.generateTypeSwitch that require fewer adaptations [v3]

2024-05-21 Thread Claes Redestad
On Tue, 21 May 2024 09:01:32 GMT, Claes Redestad wrote: >> We can fold the call to `Objects.checkIndex` into the code generated in >> generateTypeSwitchSkeleton instead of doing so by filtering the MH argument. >> This loads 9 less classes (of which 8 generated LFs a

Re: RFR: 8332528: Generate code in SwitchBootstraps.generateTypeSwitch that require fewer adaptations [v3]

2024-05-21 Thread Claes Redestad
used `findStatic` > calls to a holder. All in all this means a reduction by 22M cycles to > bootstrap a trivial switch expression on my M1. Claes Redestad has updated the pull request incrementally with one additional commit since the last revision: Add type switch to HelloClas

Re: RFR: 8332528: Generate code in SwitchBootstraps.generateTypeSwitch that require fewer adaptations [v2]

2024-05-21 Thread Claes Redestad
used `findStatic` > calls to a holder. All in all this means a reduction by 22M cycles to > bootstrap a trivial switch expression on my M1. Claes Redestad has updated the pull request incrementally with one additional commit since the last revision: Revert bf68b1d, tidy up ---

Re: RFR: 8332528: Generate code in SwitchBootstraps.generateTypeSwitch that require fewer adaptations

2024-05-21 Thread Claes Redestad
On Tue, 21 May 2024 00:16:51 GMT, Chen Liang wrote: >> We can fold the call to `Objects.checkIndex` into the code generated in >> generateTypeSwitchSkeleton instead of doing so by filtering the MH argument. >> This loads 9 less classes (of which 8 generated LFs and Species classes) on >> a

Re: RFR: 8332528: Generate code in SwitchBootstraps.generateTypeSwitch that require fewer adaptations

2024-05-20 Thread Claes Redestad
On Mon, 20 May 2024 18:06:32 GMT, Chen Liang wrote: >> We can fold the call to `Objects.checkIndex` into the code generated in >> generateTypeSwitchSkeleton instead of doing so by filtering the MH argument. >> This loads 9 less classes (of which 8 generated LFs and Species classes) on >> a

Re: RFR: 8332528: Generate code in SwitchBootstraps.generateTypeSwitch that require fewer adaptations

2024-05-20 Thread Claes Redestad
On Mon, 20 May 2024 10:52:27 GMT, Claes Redestad wrote: > We can fold the call to `Objects.checkIndex` into the code generated in > generateTypeSwitchSkeleton instead of doing so by filtering the MH argument. > This loads 9 less classes (of which 8 generated LFs and Specie

RFR: 8332528: Generate code in SwitchBootstraps.generateTypeSwitch that require fewer adaptations

2024-05-20 Thread Claes Redestad
We can fold the call to `Objects.checkIndex` into the code generated in generateTypeSwitchSkeleton instead of doing so by filtering the MH argument. This loads 9 less classes (of which 8 generated LFs and Species classes) on a minimal test, while being neutral on a throughput sanity test:

Integrated: 8331724: Refactor j.l.constant implementation to internal package

2024-05-17 Thread Claes Redestad
On Mon, 6 May 2024 14:39:08 GMT, Claes Redestad wrote: > This PR suggests refactoring the implementation classes of java.lang.constant > into a new package jdk.internal.constant to enable sharing some trusted > static factory methods with users elsewhere in

Re: RFR: 8331724: Refactor j.l.constant implementation to internal package [v13]

2024-05-17 Thread Claes Redestad
On Wed, 15 May 2024 11:17:42 GMT, Claes Redestad wrote: >> This PR suggests refactoring the implementation classes of >> java.lang.constant into a new package jdk.internal.constant to enable >> sharing some trusted static factory methods with users elsewher

Re: RFR: 8331724: Refactor j.l.constant implementation to internal package [v13]

2024-05-15 Thread Claes Redestad
On Wed, 15 May 2024 11:17:42 GMT, Claes Redestad wrote: >> This PR suggests refactoring the implementation classes of >> java.lang.constant into a new package jdk.internal.constant to enable >> sharing some trusted static factory methods with users elsewher

Re: RFR: 8331724: Refactor j.l.constant implementation to internal package [v13]

2024-05-15 Thread Claes Redestad
ge > ClassDescFactories.ReferenceOnly.ofNested 6 209,853 ± 132,525 22,017 ± > 0,573 ns/op 9,53x (p = 0,000*) > * = significant > > > The optimizations could be split out and PRd independently, but I think they > are simple enough to include in this refactoring. Claes Redestad ha

Re: RFR: 8331724: Refactor j.l.constant implementation to internal package [v12]

2024-05-15 Thread Claes Redestad
ge > ClassDescFactories.ReferenceOnly.ofNested 6 209,853 ± 132,525 22,017 ± > 0,573 ns/op 9,53x (p = 0,000*) > * = significant > > > The optimizations could be split out and PRd independently, but I think they > are simple enough to include in this refactoring. Claes Redestad has

Re: RFR: 8331724: Refactor j.l.constant implementation to internal package [v10]

2024-05-15 Thread Claes Redestad
On Wed, 15 May 2024 09:51:13 GMT, Adam Sotona wrote: >> Claes Redestad has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Use sb.repeat, consolidate > > src/java.base/share/classes/java/lang/constant/Clas

Re: RFR: 8331724: Refactor j.l.constant implementation to internal package [v11]

2024-05-15 Thread Claes Redestad
ge > ClassDescFactories.ReferenceOnly.ofNested 6 209,853 ± 132,525 22,017 ± > 0,573 ns/op 9,53x (p = 0,000*) > * = significant > > > The optimizations could be split out and PRd independently, but I think they > are simple enough to include in this refactoring. Claes Redestad

Re: RFR: 8331724: Refactor j.l.constant implementation to internal package [v10]

2024-05-15 Thread Claes Redestad
ge > ClassDescFactories.ReferenceOnly.ofNested 6 209,853 ± 132,525 22,017 ± > 0,573 ns/op 9,53x (p = 0,000*) > * = significant > > > The optimizations could be split out and PRd independently, but I think they > are simple enough to include in this refactoring. Claes R

Re: RFR: 8331724: Refactor j.l.constant implementation to internal package [v9]

2024-05-15 Thread Claes Redestad
On Tue, 14 May 2024 20:20:59 GMT, Chen Liang wrote: >> Claes Redestad has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Add microbenchmark for ClassDesc methods + a few optimizations > > src/java.base/sh

Re: RFR: 8331724: Refactor j.l.constant implementation to internal package [v9]

2024-05-14 Thread Claes Redestad
On Tue, 14 May 2024 17:25:37 GMT, Claes Redestad wrote: >> This PR suggests refactoring the implementation classes of >> java.lang.constant into a new package jdk.internal.constant to enable >> sharing some trusted static factory methods with users elsewher

Re: RFR: 8331724: Refactor j.l.constant implementation to internal package [v9]

2024-05-14 Thread Claes Redestad
ge > ClassDescFactories.ReferenceOnly.ofNested 6 209,853 ± 132,525 22,017 ± > 0,573 ns/op 9,53x (p = 0,000*) > * = significant > > > The optimizations could be split out and PRd independently, but I think they > are simple enough to include in this refactoring. Claes Redesta

Re: RFR: 8331724: Refactor j.l.constant implementation to internal package [v8]

2024-05-14 Thread Claes Redestad
ge > ClassDescFactories.ReferenceOnly.ofNested 6 209,853 ± 132,525 22,017 ± > 0,573 ns/op 9,53x (p = 0,000*) > * = significant > > > The optimizations could be split out and PRd independently, but I think they > are simple enough to include in this refactoring. Claes Redes

Re: RFR: 8331724: Refactor j.l.constant implementation to internal package [v7]

2024-05-14 Thread Claes Redestad
On Fri, 10 May 2024 08:50:07 GMT, Claes Redestad wrote: >> This PR suggests refactoring the implementation classes of >> java.lang.constant into a new package jdk.internal.constant to enable >> sharing some trusted static factory methods with users elsewher

Re: RFR: 8331291: java.lang.classfile.Attributes class performs a lot of static initializations [v8]

2024-05-14 Thread Claes Redestad
On Mon, 6 May 2024 18:24:25 GMT, Adam Sotona wrote: >> Hi, >> During performance optimization work on Class-File API as JDK lambda >> generator we found some static initialization killers. >> One of them is `java.lang.classfile.Attributes` with tens of static fields >> initialized with

Re: RFR: 8327499: MethodHandleStatics.traceLambdaForm includes methods that cannot be generated [v2]

2024-05-10 Thread Claes Redestad
On Fri, 10 May 2024 04:55:21 GMT, Chen Liang wrote: >> GenerateJLIClassesHelper has been making wrong assumptions about Invoker's >> LambdaForm method type parameters. Since they are distinct from those of >> Linkers, they are now tracked and generated separately. It seems that no >> proper

Re: RFR: 8331724: Refactor j.l.constant implementation to internal package [v7]

2024-05-10 Thread Claes Redestad
ge > ClassDescFactories.ReferenceOnly.ofNested 6 209,853 ± 132,525 22,017 ± > 0,573 ns/op 9,53x (p = 0,000*) > * = significant > > > The optimizations could be split out and PRd independently, but I think they > are simple enough to include in this refactoring. Claes Redestad h

Re: RFR: 8331932: Startup regressions in 23-b13 [v5]

2024-05-10 Thread Claes Redestad
On Thu, 9 May 2024 13:34:16 GMT, Claes Redestad wrote: >> A rather large startup regression was introduced in 23-b13 from >> [JDK-8309622](https://bugs.openjdk.org/browse/JDK-8309622). Some of that has >> been dealt with as enhancements such as >> [JDK-8330802](https:/

Integrated: 8331932: Startup regressions in 23-b13

2024-05-10 Thread Claes Redestad
On Wed, 8 May 2024 14:53:05 GMT, Claes Redestad wrote: > A rather large startup regression was introduced in 23-b13 from > [JDK-8309622](https://bugs.openjdk.org/browse/JDK-8309622). Some of that has > been dealt with as enhancements such as > [JDK-8330802](https://bugs.openjdk.or

Re: RFR: 8331744: java.lang.classfile.TypeKind improvements [v5]

2024-05-10 Thread Claes Redestad
On Thu, 9 May 2024 21:15:31 GMT, Chen Liang wrote: >> A peek into TypeKind during the research for #19105 reveals that TypeKind >> has a few issues: >> 1. Name mismatch for `newarraycode` and `fromNewArrayCode`: Renamed both to >> use "newarray code" >> 2. `fromDescriptor` can throw IOOBE if

Re: RFR: 8331744: java.lang.classfile.TypeKind improvements [v4]

2024-05-09 Thread Claes Redestad
On Thu, 9 May 2024 12:29:40 GMT, Adam Sotona wrote: >> I actually am not sure of the reason; it is indeed a tableswitch in >> bytecode. @cl4es might know it better? > > Generally I agree with the API changes and with the > `descriptor.isPrimitive()` test before requesting a descriptor string.

Re: RFR: 8331932: Startup regressions in 23-b13 [v5]

2024-05-09 Thread Claes Redestad
rticular case > since the amount of added bootstrapping overhead is dependent on which locale > the system runs under, which complicates testing and comparisons due to > relatively large differences in paths taken on different systems. Claes Redestad has updated the pull request incre

Re: RFR: 8331932: Startup regressions in 23-b13 [v4]

2024-05-08 Thread Claes Redestad
On Wed, 8 May 2024 18:32:42 GMT, Chen Liang wrote: >> Claes Redestad has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Remove redundant constructor > > src/java.base/share/classes/jdk/internal/util/Reference

Re: RFR: 8331724: Refactor j.l.constant implementation to internal package [v6]

2024-05-08 Thread Claes Redestad
On Wed, 8 May 2024 20:24:52 GMT, Chen Liang wrote: > This patch allows us to merge parsing logic for invoke, constant, and > classfile in the future, all in jdk.internal. Thanks for reviewing! Yes, that's the idea. - PR Comment:

Re: RFR: 8331724: Refactor j.l.constant implementation to internal package [v5]

2024-05-08 Thread Claes Redestad
On Wed, 8 May 2024 19:06:35 GMT, ExE Boss wrote: >> Claes Redestad has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Refactor to further avoid re-validating arguments > > src/java.base/share

Re: RFR: 8331724: Refactor j.l.constant implementation to internal package [v6]

2024-05-08 Thread Claes Redestad
ge > ClassDescFactories.ReferenceOnly.ofNested 6 209,853 ± 132,525 22,017 ± > 0,573 ns/op 9,53x (p = 0,000*) > * = significant > > > The optimizations could be split out and PRd independently, but I think they > are simple enough to include in this refactoring. Claes Redestad has

Re: RFR: 8331932: Startup regressions in 23-b13 [v4]

2024-05-08 Thread Claes Redestad
On Wed, 8 May 2024 17:57:22 GMT, Naoto Sato wrote: >> Claes Redestad has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Remove redundant constructor > > src/java.base/share/classes/sun/util/locale/Bas

Re: RFR: 8331932: Startup regressions in 23-b13 [v3]

2024-05-08 Thread Claes Redestad
On Wed, 8 May 2024 17:23:25 GMT, Alan Bateman wrote: >> Claes Redestad has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Extract singleton for interning BaseLocale > > src/java.base/share/classes/j

Re: RFR: 8331932: Startup regressions in 23-b13 [v4]

2024-05-08 Thread Claes Redestad
rticular case > since the amount of added bootstrapping overhead is dependent on which locale > the system runs under, which complicates testing and comparisons due to > relatively large differences in paths taken on different systems. Claes Redestad has updated the pull request incre

Re: RFR: 8331932: Startup regressions in 23-b13 [v3]

2024-05-08 Thread Claes Redestad
rticular case > since the amount of added bootstrapping overhead is dependent on which locale > the system runs under, which complicates testing and comparisons due to > relatively large differences in paths taken on different systems. Claes Redestad has updated the pull request incre

Re: RFR: 8331932: Startup regressions in 23-b13 [v2]

2024-05-08 Thread Claes Redestad
rticular case > since the amount of added bootstrapping overhead is dependent on which locale > the system runs under, which complicates testing and comparisons due to > relatively large differences in paths taken on different systems. Claes Redestad has updated the pull request incre

RFR: 8331932: Startup regressions in 23-b13

2024-05-08 Thread Claes Redestad
A rather large startup regression was introduced in 23-b13 from [JDK-8309622](https://bugs.openjdk.org/browse/JDK-8309622). Some of that has been dealt with as enhancements such as [JDK-8330802](https://bugs.openjdk.org/browse/JDK-8330802),

Re: RFR: 8331724: Refactor j.l.constant implementation to internal package [v5]

2024-05-08 Thread Claes Redestad
ge > ClassDescFactories.ReferenceOnly.ofNested 6 209,853 ± 132,525 22,017 ± > 0,573 ns/op 9,53x (p = 0,000*) > * = significant > > > The optimizations could be split out and PRd independently, but I think they > are simple enough to include in this refactoring. Claes Red

Re: RFR: 8331724: Refactor j.l.constant implementation to internal package [v4]

2024-05-07 Thread Claes Redestad
ge > ClassDescFactories.ReferenceOnly.ofNested 6 209,853 ± 132,525 22,017 ± > 0,573 ns/op 9,53x (p = 0,000*) > * = significant > > > The optimizations could be split out and PRd independently, but I think they > are simple enough to include in this refactoring. Claes Redestad has

Re: RFR: 8305457: Implement java.io.IO

2024-05-07 Thread Claes Redestad
On Tue, 7 May 2024 12:18:52 GMT, Rémi Forax wrote: >> I assume it's about performance. If so, I would defer any >> performance-related tweaks until they are necessary. Interactive reading >> from console does not sound like something requiring that level of >> performance tweaking. > > yes,

Re: RFR: 8331744: java.lang.classfile.TypeKind improvements [v3]

2024-05-07 Thread Claes Redestad
On Tue, 7 May 2024 01:49:27 GMT, Chen Liang wrote: >> A peek into TypeKind during the research for #19105 reveals that TypeKind >> has a few issues: >> 1. Name mismatch for `newarraycode` and `fromNewArrayCode`: Renamed both to >> use "newarray code" >> 2. `fromDescriptor` can throw IOOBE if

Re: RFR: 8331744: java.lang.classfile.TypeKind improvements

2024-05-06 Thread Claes Redestad
On Mon, 6 May 2024 20:48:05 GMT, Chen Liang wrote: > A peek into TypeKind during the research for #19105 reveals that TypeKind has > a few issues: > 1. Name mismatch for `newarraycode` and `fromNewArrayCode`: Renamed both to > use "newarray code" > 2. `fromDescriptor` can throw IOOBE if the

Re: RFR: 8331744: java.lang.classfile.TypeKind improvements

2024-05-06 Thread Claes Redestad
On Mon, 6 May 2024 20:48:05 GMT, Chen Liang wrote: > A peek into TypeKind during the research for #19105 reveals that TypeKind has > a few issues: > 1. Name mismatch for `newarraycode` and `fromNewArrayCode`: Renamed both to > use "newarray code" > 2. `fromDescriptor` can throw IOOBE if the

Re: RFR: 8331724: Refactor j.l.constant implementation to internal package [v3]

2024-05-06 Thread Claes Redestad
On Mon, 6 May 2024 14:58:02 GMT, Chen Liang wrote: >> Claes Redestad has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Rename ofTrusted to ofValidated, remove accidental module-info exports > > src/jav

Re: RFR: 8331724: Refactor j.l.constant implementation to internal package [v3]

2024-05-06 Thread Claes Redestad
ge > ClassDescFactories.ReferenceOnly.ofNested 6 209,853 ± 132,525 22,017 ± > 0,573 ns/op 9,53x (p = 0,000*) > * = significant > > > The optimizations could be split out and PRd independently, but I think they > are simple enough to include in this refactoring. Claes Redest

Re: RFR: 8331724: Refactor j.l.constant implementation to internal package [v2]

2024-05-06 Thread Claes Redestad
ge > ClassDescFactories.ReferenceOnly.ofNested 6 209,853 ± 132,525 22,017 ± > 0,573 ns/op 9,53x (p = 0,000*) > * = significant > > > The optimizations could be split out and PRd independently, but I think they > are simple enough to include in this refactoring. Claes Redestad

Re: RFR: 8331724: Refactor j.l.constant implementation to internal package

2024-05-06 Thread Claes Redestad
On Mon, 6 May 2024 14:51:17 GMT, Chen Liang wrote: >> This PR suggests refactoring the implementation classes of >> java.lang.constant into a new package jdk.internal.constant to enable >> sharing some trusted static factory methods with users elsewhere in >> java.base, such as

Re: RFR: 8331724: Refactor j.l.constant implementation to internal package

2024-05-06 Thread Claes Redestad
On Mon, 6 May 2024 14:46:09 GMT, Chen Liang wrote: >> This PR suggests refactoring the implementation classes of >> java.lang.constant into a new package jdk.internal.constant to enable >> sharing some trusted static factory methods with users elsewhere in >> java.base, such as

RFR: 8331724: Refactor j.l.constant implementation to internal package

2024-05-06 Thread Claes Redestad
This PR suggests refactoring the implementation classes of java.lang.constant into a new package jdk.internal.constant to enable sharing some trusted static factory methods with users elsewhere in java.base, such as java.lang.invoke and java.lang.classfile. The refactoring also adds some

Re: RFR: 8331291: java.lang.classfile.Attributes class performs a lot of static initializations [v4]

2024-05-06 Thread Claes Redestad
On Thu, 2 May 2024 11:08:16 GMT, Adam Sotona wrote: >> Hi, >> During performance optimization work on Class-File API as JDK lambda >> generator we found some static initialization killers. >> One of them is `java.lang.classfile.Attributes` with tens of static fields >> initialized with

Re: RFR: 8331427: Rename confusingly named ArraysSupport.signedHashCode

2024-05-01 Thread Claes Redestad
On Tue, 30 Apr 2024 14:38:11 GMT, Pavel Rappo wrote: > Please review this trivial method rename. While this issue was originally > spotted in [another PR], it makes sense to address it separately. Test > results are pending; not that I expect failures, but still. > > [another PR]: >

Integrated: 8331264: Reduce java.lang.constant initialization overhead

2024-04-30 Thread Claes Redestad
On Mon, 29 Apr 2024 08:11:06 GMT, Claes Redestad wrote: > I'm looking at ways at reducing/eliminating startup overheads the classfile > API in preparation of #17108, and have pushed a series of enhancements to > that effect already. This PR is a collection of minor improvements which

Re: RFR: 8331264: Reduce java.lang.constant initialization overhead [v3]

2024-04-29 Thread Claes Redestad
On Mon, 29 Apr 2024 17:45:55 GMT, Mandy Chung wrote: > The changes look good to me but I wonder if the non-zero length check before > calling `arraycopy` really needed? That seems to add some noise to the code. I recall benchmarking similar code in `MethodType` extensively, and found that it

Re: RFR: 8331264: Reduce java.lang.constant initialization overhead [v3]

2024-04-29 Thread Claes Redestad
On Mon, 29 Apr 2024 14:16:34 GMT, Per Minborg wrote: >> Claes Redestad has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Simplified void check > > src/java.base/share/classes/java/lang/constant/Constant

Re: RFR: 8331264: Reduce java.lang.constant initialization overhead [v3]

2024-04-29 Thread Claes Redestad
ons - or a 5% reduction in > executed bytecode - on a simple lambda startup test. Claes Redestad has updated the pull request incrementally with one additional commit since the last revision: Simplified void check - Changes: - all: https://git.openjdk.org/jdk/pull/18991/files

Re: RFR: 8331264: Reduce java.lang.constant initialization overhead [v2]

2024-04-29 Thread Claes Redestad
On Mon, 29 Apr 2024 12:18:15 GMT, Chen Liang wrote: >> Claes Redestad has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Descriptors can't be empty, optimize isArray and isClassOrInterface with >> descripto

Re: RFR: 8331264: Reduce java.lang.constant initialization overhead [v2]

2024-04-29 Thread Claes Redestad
ons - or a 5% reduction in > executed bytecode - on a simple lambda startup test. Claes Redestad has updated the pull request incrementally with one additional commit since the last revision: Descriptors can't be empty, optimize isArray and isClassOrInterface with descriptorSt

RFR: 8331264: Reduce java.lang.constant initialization overhead

2024-04-29 Thread Claes Redestad
I'm looking at ways at reducing/eliminating startup overheads the classfile API in preparation of #17108, and have pushed a series of enhancements to that effect already. This PR is a collection of minor improvements which add up to a 1.5% reduction in retired instructions - or a 5% reduction

Integrated: 8331114: Further improve performance of MethodTypeDesc::descriptorString

2024-04-27 Thread Claes Redestad
On Thu, 25 Apr 2024 09:41:11 GMT, Claes Redestad wrote: > When analyzing (startup) performance of the Classfile API I found this > opportunity to further improve `MethodTypeDescImpl::descriptorString`. > > Performance improves across the board in existing microbenchmark

Re: RFR: 8331134: Port SimpleStringBuilderStrategy to use ClassFile API [v10]

2024-04-27 Thread Claes Redestad
On Fri, 26 Apr 2024 14:57:07 GMT, Claes Redestad wrote: >> This patch suggests a workaround to an issue with huge SCF MH expression >> trees taking excessive JIT compilation resources by reviving (part of) the >> simple bytecode-generating strategy that was originally avail

Integrated: 8331134: Port SimpleStringBuilderStrategy to use ClassFile API

2024-04-27 Thread Claes Redestad
On Tue, 9 Apr 2024 12:01:49 GMT, Claes Redestad wrote: > This patch suggests a workaround to an issue with huge SCF MH expression > trees taking excessive JIT compilation resources by reviving (part of) the > simple bytecode-generating strategy that was originally available as

Re: RFR: 8331114: Further improve performance of MethodTypeDesc::descriptorString [v5]

2024-04-27 Thread Claes Redestad
On Fri, 26 Apr 2024 22:27:43 GMT, Claes Redestad wrote: >> When analyzing (startup) performance of the Classfile API I found this >> opportunity to further improve `MethodTypeDescImpl::descriptorString`. >> >> Performance improves across the board in existing micr

Re: RFR: 8331114: Further improve performance of MethodTypeDesc::descriptorString [v5]

2024-04-26 Thread Claes Redestad
lied similar approach to `MethodTypeDesc::displayDescriptor`: > while not performance sensitive I think these are so inter-related that it > makes sense to implement them in a similar fashion. Claes Redestad has updated the pull request with a new target base due to a merge or a rebase.

Re: RFR: 8331187: Optimize MethodTypeDesc and ClassDesc.ofDescriptor for primitive types [v3]

2024-04-26 Thread Claes Redestad
On Fri, 26 Apr 2024 20:35:44 GMT, Mandy Chung wrote: >> While I agree it may seem non-sensical to define `CD_Object` for `Object`, >> there's precedent in that `Wrapper.primitiveType` is `Object.class` - so for >> consistency I wired it up the same way. For the usage patterns introduced >>

Re: RFR: 8331114: Further improve performance of MethodTypeDesc::descriptorString [v4]

2024-04-26 Thread Claes Redestad
On Fri, 26 Apr 2024 18:21:16 GMT, Mandy Chung wrote: > I am glad that this only focuses on the descriptor string as > `MethodTypeDesc::displayDescriptor` is typically used for debugging and > exception message and not performance-sensitive. Yes, which is why I'd really like to desugar it:

Re: RFR: 8331187: Optimize MethodTypeDesc and ClassDesc.ofDescriptor for primitive types [v3]

2024-04-26 Thread Claes Redestad
On Fri, 26 Apr 2024 17:57:52 GMT, Mandy Chung wrote: >> Claes Redestad has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Copyrights and other comments from @JornVernee > > src/java.base/share/classes/sun/inv

Re: RFR: 8331134: Port SimpleStringBuilderStrategy to use ClassFile API [v9]

2024-04-26 Thread Claes Redestad
On Fri, 26 Apr 2024 02:20:34 GMT, Mandy Chung wrote: >> Claes Redestad has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Nits, clean up constant, introduce missing constant MethodTypeDesc for >> toStri

Re: RFR: 8331187: Optimize MethodTypeDesc and ClassDesc.ofDescriptor for primitive types [v3]

2024-04-26 Thread Claes Redestad
On Fri, 26 Apr 2024 14:47:16 GMT, Chen Liang wrote: > For the `equals` remark, it's that DynamicConstantDesc's equals is final so > subclasses cannot provide a faster implementation. But that's another topic. Hmm, that is unfortunate, yes. - PR Comment:

Re: RFR: 8331134: Port SimpleStringBuilderStrategy to use ClassFile API [v10]

2024-04-26 Thread Claes Redestad
le avoiding perturbing performance > at the vast majority of call sites. > > I was asked to use the new class file API for mainline. There's a version of > this patch implemented using ASM in 7c52a9f which might be a reasonable basis > for a backport. Claes Redestad has

Integrated: 8331187: Optimize MethodTypeDesc and ClassDesc.ofDescriptor for primitive types

2024-04-26 Thread Claes Redestad
On Fri, 26 Apr 2024 10:27:16 GMT, Claes Redestad wrote: > This PR makes ClassDesc.ofDescriptor return the shared constant for primitive > descriptor strings ("I" etc..), and leverages this further by refactoring > `MethodTypeDescImpl.ofDescriptor` to avoid the int

Re: RFR: 8331187: Optimize MethodTypeDesc and ClassDesc.ofDescriptor for primitive types [v3]

2024-04-26 Thread Claes Redestad
On Fri, 26 Apr 2024 12:43:32 GMT, Chen Liang wrote: > Primitive class desc sharing should be really helpful, especially considering > that they are represented as condy and their `equals` is thus quite > inefficient. Ok. We could consider overriding `equals` in `PrimitiveClassDescImpl` if

Re: RFR: 8331187: Optimize MethodTypeDesc and ClassDesc.ofDescriptor for primitive types [v3]

2024-04-26 Thread Claes Redestad
On Fri, 26 Apr 2024 12:58:35 GMT, Chen Liang wrote: >> src/java.base/share/classes/java/lang/constant/ClassDesc.java line 163: >> >>> 161: // implicit null-check >>> 162: return (descriptor.length() == 1) >>> 163:? >>>

Integrated: 8327247: C2 uses up to 2GB of RAM to compile complex string concat in extreme cases

2024-04-26 Thread Claes Redestad
On Thu, 25 Apr 2024 14:15:56 GMT, Claes Redestad wrote: > Splitting out the ASM-based version from #18690 to push that first under the > JBS (to help backporting). Keeping #18690 open to rebase and follow-up on > this as a subtask. See discussion in that #18690 for more details, d

Re: RFR: 8331187: Optimize MethodTypeDesc and ClassDesc.ofDescriptor for primitive types [v2]

2024-04-26 Thread Claes Redestad
On Fri, 26 Apr 2024 11:27:35 GMT, Jorn Vernee wrote: > Looks like your `MethodTypeDescFactories` benchmark is missing form the PR? > Pre-existing. > Does removing the explicit null checks make that much difference for > performance? They are kind of nice for clarity. > It helps startup at

Re: RFR: 8331187: Optimize MethodTypeDesc and ClassDesc.ofDescriptor for primitive types [v3]

2024-04-26 Thread Claes Redestad
,000*) > :gc.alloc.rate.norm > 520,002 ± 0,000328,001 ± 0,000 B/op 0,63x (p = 0,000*) > MethodTypeDescFactories.ofDescriptor ()[Ljava/lang/String; > 6 35,036 ± 0,351 36,010 ± 3

Re: RFR: 8331187: Optimize MethodTypeDesc and ClassDesc.ofDescriptor for primitive types [v2]

2024-04-26 Thread Claes Redestad
,000*) > :gc.alloc.rate.norm > 520,002 ± 0,000328,001 ± 0,000 B/op 0,63x (p = 0,000*) > MethodTypeDescFactories.ofDescriptor ()[Ljava/lang/String; > 6 35,036 ± 0,351 36,010 ± 3

RFR: 8331187: Optimize MethodTypeDesc and ClassDesc.ofDescriptor for primitive types

2024-04-26 Thread Claes Redestad
This PR makes ClassDesc.ofDescriptor return the shared constant for primitive descriptor strings ("I" etc..), and leverages this further by refactoring `MethodTypeDescImpl.ofDescriptor` to avoid the intermediate substring for primitives. Microbenchmarks results look good with expected

Re: RFR: 8327247: C2 uses up to 2GB of RAM to compile complex string concat in extreme cases [v4]

2024-04-26 Thread Claes Redestad
On Fri, 26 Apr 2024 09:42:06 GMT, Claes Redestad wrote: >> Splitting out the ASM-based version from #18690 to push that first under the >> JBS (to help backporting). Keeping #18690 open to rebase and follow-up on >> this as a subtask. See discussion in that #1869

Re: RFR: 8327247: C2 uses up to 2GB of RAM to compile complex string concat in extreme cases [v3]

2024-04-26 Thread Claes Redestad
On Fri, 26 Apr 2024 08:45:45 GMT, Claes Redestad wrote: >> Splitting out the ASM-based version from #18690 to push that first under the >> JBS (to help backporting). Keeping #18690 open to rebase and follow-up on >> this as a subtask. See discussion in that #1869

Re: RFR: 8327247: C2 uses up to 2GB of RAM to compile complex string concat in extreme cases [v4]

2024-04-26 Thread Claes Redestad
> Splitting out the ASM-based version from #18690 to push that first under the > JBS (to help backporting). Keeping #18690 open to rebase and follow-up on > this as a subtask. See discussion in that #18690 for more details, discussion > and motivation for this. Claes Redestad

Re: RFR: 8327247: C2 uses up to 2GB of RAM to compile complex string concat in extreme cases [v2]

2024-04-26 Thread Claes Redestad
On Thu, 25 Apr 2024 19:53:46 GMT, Claes Redestad wrote: >> Splitting out the ASM-based version from #18690 to push that first under the >> JBS (to help backporting). Keeping #18690 open to rebase and follow-up on >> this as a subtask. See discussion in that #1869

Re: RFR: 8327247: C2 uses up to 2GB of RAM to compile complex string concat in extreme cases [v3]

2024-04-26 Thread Claes Redestad
> Splitting out the ASM-based version from #18690 to push that first under the > JBS (to help backporting). Keeping #18690 open to rebase and follow-up on > this as a subtask. See discussion in that #18690 for more details, discussion > and motivation for this. Claes Redestad

Re: RFR: 8327247: C2 uses up to 2GB of RAM to compile complex string concat in extreme cases [v2]

2024-04-26 Thread Claes Redestad
On Fri, 26 Apr 2024 02:36:22 GMT, Chen Liang wrote: > Also a side note for backport: ClassFileDumper exists only since JDK 21, so > for earlier backports you need to use an alternative dumping method or remove > dumping ability. Yes, original code used ProxyClassDumper, which was

Re: RFR: 8327247: C2 uses up to 2GB of RAM to compile complex string concat in extreme cases [v2]

2024-04-26 Thread Claes Redestad
On Fri, 26 Apr 2024 03:14:54 GMT, Mandy Chung wrote: >> Claes Redestad has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Remove accidental use of java.lang.classfile > > src/java.base/

Re: RFR: 8331134: Port SimpleStringBuilderStrategy to use ClassFile API [v9]

2024-04-26 Thread Claes Redestad
On Fri, 26 Apr 2024 02:20:34 GMT, Mandy Chung wrote: > It's a little confusing for JDK-8327247 to have 2 PRs but it's okay. We can > add a note in JDK-8327247 to clarify. I assume you plan to use PR to convert > to use ClassFile API after you pull from JDK-8327247 once integrated? Yes, this

Re: RFR: 8331114: Further improve performance of MethodTypeDesc::descriptorString [v3]

2024-04-26 Thread Claes Redestad
On Thu, 25 Apr 2024 23:03:58 GMT, Chen Liang wrote: >> src/java.base/share/classes/java/lang/constant/MethodTypeDescImpl.java line >> 181: >> >>> 179: sb.append(argType.descriptorString()); >>> 180: } >>> 181: desc = >>>

Re: RFR: 8331114: Further improve performance of MethodTypeDesc::descriptorString [v3]

2024-04-26 Thread Claes Redestad
On Thu, 25 Apr 2024 23:06:00 GMT, Chen Liang wrote: > For the precise-length approach, do you have the results? I guess if we can > avoid copying the stringbuilder array, we can make this even faster. Not sure what you mean - the latest performance numbers I posted are for the precise length

Re: RFR: 8331114: Further improve performance of MethodTypeDesc::descriptorString [v4]

2024-04-26 Thread Claes Redestad
lied similar approach to `MethodTypeDesc::displayDescriptor`: > while not performance sensitive I think these are so inter-related that it > makes sense to implement them in a similar fashion. Claes Redestad has updated the pull request incrementally with one additional commit since t

Re: RFR: 8331114: Further improve performance of MethodTypeDesc::descriptorString [v3]

2024-04-25 Thread Claes Redestad
lied similar approach to `MethodTypeDesc::displayDescriptor`: > while not performance sensitive I think these are so inter-related that it > makes sense to implement them in a similar fashion. Claes Redestad has updated the pull request incrementally with one additional commit since the la

Re: RFR: 8331114: Further improve performance of MethodTypeDesc::descriptorString [v2]

2024-04-25 Thread Claes Redestad
On Thu, 25 Apr 2024 13:34:50 GMT, Claes Redestad wrote: >> When analyzing (startup) performance of the Classfile API I found this >> opportunity to further improve `MethodTypeDescImpl::descriptorString`. >> >> Performance improves across the board in existing micr

  1   2   3   4   5   6   7   >