Re: RFR: 8356993: ArrayDeque should use Arrays.fill() instead of for() loops [v2]

2025-05-15 Thread Rémi Forax
On Thu, 15 May 2025 17:46:39 GMT, Archie Cobbs wrote: >> Please review this small performance tweak `ArrayDeque`. >> >> `ArrayDeque` has an invariant in which any unused elements in the array must >> be null. In a couple of places, the code is setting contiguous ranges of >> elements to null u

Re: RFR: 8143850: Add indexed get() and set() methods to ArrayDeque

2025-05-13 Thread Rémi Forax
On Mon, 12 May 2025 18:24:27 GMT, Archie Cobbs wrote: > Because it is backed by an array, the `ArrayDeque` class has the ability to > get and replace any element in the list (accessed by index) in constant time. > However, this capability is not exposed in the API. > > Please review this PR wh

Re: RFR: 8354724: BufferedReader readAllLines and readString methods [v14]

2025-05-02 Thread Rémi Forax
On Wed, 23 Apr 2025 22:04:25 GMT, Brian Burkhalter wrote: >> Implement the requested methods and add a test thereof. > > Brian Burkhalter has updated the pull request incrementally with one > additional commit since the last revision: > > 8354724: Fix readAllChars gaffe in Reader returned by

Re: RFR: 8354300: Fields in String are not trusted

2025-04-15 Thread Rémi Forax
On Wed, 16 Apr 2025 00:01:18 GMT, Chen Liang wrote: >> This PR proposes to add the `@Stable` annotation to `j.l.String.hash` and >> `j.l.String.hashIsZero`. This means the VM can trust these fields to never >> change which enables constant folding optimizations. >> >> This PR is tested in tier

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v53]

2025-04-10 Thread Rémi Forax
On Thu, 10 Apr 2025 13:46:17 GMT, Per Minborg wrote: > > > ``` > > > > > > I will take a look at it. > > > ``` > > > > > > As i said in another mail to core-lib this morning, it seems that the field > > storing the hashcode of String is not marked with @stable. That's may be > > the issue. >

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v51]

2025-04-10 Thread Rémi Forax
On Thu, 10 Apr 2025 12:51:43 GMT, Per Minborg wrote: > > ``` > > I will take a look at it. As i said in another mail to core-lib this morning, it seems that the field storing the hashcode of String is not marked with @Stable. That's may be the issue. - PR Comment: h

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v51]

2025-04-09 Thread Rémi Forax
On Mon, 7 Apr 2025 16:00:41 GMT, Per Minborg wrote: >> Implement JEP 502. >> >> The PR passes tier1-tier3 tests. > > Per Minborg has updated the pull request incrementally with one additional > commit since the last revision: > > Fix typo in return type Hello, I do not know if you know but

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v51]

2025-04-09 Thread Rémi Forax
On Mon, 7 Apr 2025 16:00:41 GMT, Per Minborg wrote: >> Implement JEP 502. >> >> The PR passes tier1-tier3 tests. > > Per Minborg has updated the pull request incrementally with one additional > commit since the last revision: > > Fix typo in return type src/java.base/share/classes/java/lang

Re: RFR: 8339916: AIOOBE due to Math.abs(Integer.MIN_VALUE) in tests

2024-11-22 Thread Rémi Forax
On Thu, 21 Nov 2024 17:21:07 GMT, Andrew Haley wrote: > Test bug. > > Another bug caused by the result of `Math.abs()` being negative. I also tried > `floorMod()`, which would have been cleaner, but it increased the runtime of > this extremely time-sensitive benchmark. Let say that the defini

Re: RFR: 8342863: Use pattern matching for instanceof in equals methods of wrapper classes

2024-10-23 Thread Rémi Forax
On Wed, 23 Oct 2024 15:36:08 GMT, Joe Darcy wrote: >> src/java.base/share/classes/java/lang/Boolean.java line 259: >> >>> 257: public boolean equals(Object obj) { >>> 258: if (obj instanceof Boolean b) { >>> 259: return value == b.booleanValue(); >> >> I would go even a

Re: RFR: 8342863: Use pattern matching for instanceof in equals methods of wrapper classes

2024-10-22 Thread Rémi Forax
On Wed, 23 Oct 2024 02:06:20 GMT, Joe Darcy wrote: > Noticed this refactoring opportunity while doing some other work in the area. src/java.base/share/classes/java/lang/Boolean.java line 259: > 257: public boolean equals(Object obj) { > 258: if (obj instanceof Boolean b) { > 259:

Re: RFR: 8335480: Only deoptimize threads if needed when closing shared arena [v3]

2024-07-15 Thread Rémi Forax
On Mon, 15 Jul 2024 11:33:30 GMT, Jorn Vernee wrote: >> This PR limits the number of cases in which we deoptimize frames when >> closing a shared Arena. The initial intent of this was to improve the >> performance of shared arena closure in cases where a lot of threads are >> accessing and clo

Re: RFR: 8335480: Only deoptimize threads if needed when closing shared arena [v2]

2024-07-15 Thread Rémi Forax
On Mon, 15 Jul 2024 10:50:34 GMT, Jorn Vernee wrote: > This is what I was thinking of as well. close() on a shared arena can be > called by any thread, so it would be possible to have an executor service > with 1-n threads that is dedicated to closing memory. This delays both the closing of th

Re: RFR: 8335480: Only deoptimize threads if needed when closing shared arena [v2]

2024-07-13 Thread Rémi Forax
On Fri, 12 Jul 2024 20:59:26 GMT, Jorn Vernee wrote: >> This PR limits the number of cases in which we deoptimize frames when >> closing a shared Arena. The initial intent of this was to improve the >> performance of shared arena closure in cases where a lot of threads are >> accessing and clo

Re: RFR: 8335480: Only deoptimize threads if needed when closing shared arena [v2]

2024-07-13 Thread Rémi Forax
On Fri, 12 Jul 2024 20:59:26 GMT, Jorn Vernee wrote: >> This PR limits the number of cases in which we deoptimize frames when >> closing a shared Arena. The initial intent of this was to improve the >> performance of shared arena closure in cases where a lot of threads are >> accessing and clo

Re: RFR: 8333265: De-duplicate method references in java.util.stream.FindOps

2024-05-30 Thread Rémi Forax
On Thu, 30 May 2024 12:50:36 GMT, Claes Redestad wrote: > Extracting duplicate method references to static field reduce proxy class > spinning and loading. In this case 2 less classes loaded when using > `findAny()` on each type of stream. For constant method reference, the solution is to use

Re: RFR: 8330465: Stable Values and Collections (Internal) [v4]

2024-05-15 Thread Rémi Forax
On Wed, 15 May 2024 11:27:04 GMT, ExE Boss wrote: >>> Maybe export this interface to `jdk.unsupported`? >> >> I don't we should do that. In general, we need jdk.unsupported to go away in >> the long term. Also integrity of the platform depends on java.base being >> very stingy and not exportin

Re: RFR: 8305457: Implement java.io.IO [v3]

2024-05-07 Thread Rémi Forax
On Tue, 7 May 2024 16:09:08 GMT, Pavel Rappo wrote: >> I do not think the step to "standardise" a preview feature exists ? When a >> preview feature becomes a released feature, the code is very lightly edited, >> at least it this is my experience. >> >> You can change both readln and readLine

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

2024-05-07 Thread Rémi Forax
On Tue, 7 May 2024 11:00:52 GMT, Pavel Rappo wrote: >> src/java.base/share/classes/jdk/internal/io/JdkConsoleImpl.java line 74: >> >>> 72: >>> 73: @Override >>> 74: public String readln(String prompt) { >> >> this code can be simplified using an early return (and the body of the >> tr

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

2024-05-06 Thread Rémi Forax
On Mon, 6 May 2024 21:45:12 GMT, Pavel Rappo wrote: > Please review this PR which introduces the `java.io.IO` top-level class and > three methods to `java.io.Console` for [Implicitly Declared Classes and > Instance Main Methods (Third Preview)]. > > This PR has been obtained as `git merge --sq

Re: RFR: 8196106: Support nested infinite or recursive flat mapped streams [v7]

2024-04-13 Thread Rémi Forax
On Fri, 12 Apr 2024 14:53:01 GMT, Viktor Klang wrote: >> This PR implements Gatherer-inspired encoding of `flatMap` that shows that >> it is both competitive performance-wise as well as improve correctness. >> >> Below is the performance of `Stream::flatMap` (for reference types): >> >> Before

Re: RFR: 8196106: Support nested infinite or recursive flat mapped streams [v7]

2024-04-13 Thread Rémi Forax
On Fri, 12 Apr 2024 14:53:01 GMT, Viktor Klang wrote: >> This PR implements Gatherer-inspired encoding of `flatMap` that shows that >> it is both competitive performance-wise as well as improve correctness. >> >> Below is the performance of `Stream::flatMap` (for reference types): >> >> Before

Re: RFR: 8196106: Support nested infinite or recursive flat mapped streams [v7]

2024-04-13 Thread Rémi Forax
On Fri, 12 Apr 2024 14:53:01 GMT, Viktor Klang wrote: >> This PR implements Gatherer-inspired encoding of `flatMap` that shows that >> it is both competitive performance-wise as well as improve correctness. >> >> Below is the performance of `Stream::flatMap` (for reference types): >> >> Before

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

2024-04-12 Thread Rémi Forax
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 an > all-or-noth

Re: RFR: 8322292: Rearrange comparison of fields in Record.equals()

2023-12-19 Thread Rémi Forax
On Tue, 19 Dec 2023 11:01:12 GMT, Hannes Greule wrote: > Isn't Arrays.equals() used under the hood? No, for arrays == is used - PR Comment: https://git.openjdk.org/jdk/pull/17143#issuecomment-1863374656

Re: RFR: 8319123: Implementation of JEP-461: Stream Gatherers (Preview) [v7]

2023-11-14 Thread Rémi Forax
On Tue, 14 Nov 2023 07:51:42 GMT, Viktor Klang wrote: >> This Pull-Request implements [JEP-461](https://openjdk.org/jeps/461) > > Viktor Klang has updated the pull request incrementally with one additional > commit since the last revision: > > Addressing last review feedback Hello, the relat

Re: RFR: JDK-8319123 : Implementation of JEP-461: Stream Gatherers (Preview)

2023-11-08 Thread Rémi Forax
On Mon, 30 Oct 2023 15:38:35 GMT, Viktor Klang wrote: > This Pull-Request implements [JEP-461](https://openjdk.org/jeps/461) src/java.base/share/classes/java/util/stream/Gatherers.java line 64: > 62: *needlessly > 63: * 3. allows for more efficient composition and evaluation > 64:

Re: RFR: JDK-8319123 : Implementation of JEP-461: Stream Gatherers (Preview)

2023-11-08 Thread Rémi Forax
On Mon, 30 Oct 2023 15:38:35 GMT, Viktor Klang wrote: > This Pull-Request implements [JEP-461](https://openjdk.org/jeps/461) src/java.base/share/classes/java/util/stream/GathererOp.java line 232: > 230: */ > 231: @SuppressWarnings("unchecked") > 232: private GathererOp(Gatherer gat

Re: RFR: JDK-8319123 : Implementation of JEP-461: Stream Gatherers (Preview)

2023-11-08 Thread Rémi Forax
On Mon, 30 Oct 2023 15:38:35 GMT, Viktor Klang wrote: > This Pull-Request implements [JEP-461](https://openjdk.org/jeps/461) src/java.base/share/classes/java/util/stream/GathererOp.java line 448: > 446: private final long targetSize; > 447: private final Hybrid leftPrede

Re: RFR: JDK-8319123 : Implementation of JEP-461: Stream Gatherers (Preview)

2023-11-08 Thread Rémi Forax
On Mon, 30 Oct 2023 15:38:35 GMT, Viktor Klang wrote: > This Pull-Request implements [JEP-461](https://openjdk.org/jeps/461) src/java.base/share/classes/java/util/stream/GathererOp.java line 180: > 178: finisher.accept(state, this); > 179: sink.end(); > 180:

Re: RFR: JDK-8319123 : Implementation of JEP-461: Stream Gatherers (Preview)

2023-11-08 Thread Rémi Forax
On Mon, 30 Oct 2023 15:38:35 GMT, Viktor Klang wrote: > This Pull-Request implements [JEP-461](https://openjdk.org/jeps/461) src/java.base/share/classes/java/util/stream/GathererOp.java line 95: > 93: public void accept(X x) { > 94: final var b = rightMost; > 95:

Re: RFR: JDK-8319123 : Implementation of JEP-461: Stream Gatherers (Preview)

2023-11-08 Thread Rémi Forax
On Mon, 30 Oct 2023 15:38:35 GMT, Viktor Klang wrote: > This Pull-Request implements [JEP-461](https://openjdk.org/jeps/461) src/java.base/share/classes/java/util/stream/GathererOp.java line 50: > 48: */ > 49: final class GathererOp extends ReferencePipeline { > 50: @SuppressWarnings("unch

Re: RFR: JDK-8319123 : Implementation of JEP-461: Stream Gatherers (Preview)

2023-11-08 Thread Rémi Forax
On Wed, 8 Nov 2023 17:22:05 GMT, Rémi Forax wrote: >> This Pull-Request implements [JEP-461](https://openjdk.org/jeps/461) > > src/java.base/share/classes/java/util/stream/Gatherer.java line 490: > >> 488: * more elements sent to it, {@code false

Re: RFR: JDK-8319123 : Implementation of JEP-461: Stream Gatherers (Preview)

2023-11-08 Thread Rémi Forax
On Mon, 30 Oct 2023 15:38:35 GMT, Viktor Klang wrote: > This Pull-Request implements [JEP-461](https://openjdk.org/jeps/461) src/java.base/share/classes/java/util/stream/Gatherer.java line 444: > 442: */ > 443: static Gatherer of( > 444: Supplier initializer, wildcards ar

Re: RFR: JDK-8319123 : Implementation of JEP-461: Stream Gatherers (Preview)

2023-11-08 Thread Rémi Forax
On Wed, 8 Nov 2023 15:17:57 GMT, Viktor Klang wrote: >> It's still possible to have a situation where PECS signature could be >> useful, and I don't see any downsides. A user may want to reuse the same >> static integrator instead of creating several identical lambdas just because >> the targe

Re: RFR: JDK-8319123 : Implementation of JEP-461: Stream Gatherers (Preview)

2023-11-08 Thread Rémi Forax
On Sun, 5 Nov 2023 16:18:52 GMT, Tagir F. Valeev wrote: >> This Pull-Request implements [JEP-461](https://openjdk.org/jeps/461) > > src/java.base/share/classes/java/util/stream/Gatherer.java line 330: > >> 328: static Gatherer ofSequential( >> 329: Integrator integrator, >> 330:

Re: RFR: JDK-8319123 : Implementation of JEP-461: Stream Gatherers (Preview)

2023-11-08 Thread Rémi Forax
On Wed, 8 Nov 2023 17:10:05 GMT, Tagir F. Valeev wrote: >> Has this proven to be a problem for things like >> [Collectors.mapping(…)](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/stream/Collectors.html#mapping(java.util.function.Function,java.util.stream.Collector)) >>

Re: RFR: JDK-8319123 : Implementation of JEP-461: Stream Gatherers (Preview)

2023-11-08 Thread Rémi Forax
On Tue, 31 Oct 2023 13:19:30 GMT, Viktor Klang wrote: >> This Pull-Request implements [JEP-461](https://openjdk.org/jeps/461) > > src/java.base/share/classes/java/util/stream/AbstractPipeline.java line 242: > >> 240: } >> 241: >> 242: // Terminal evaluation methods > > This is needed i

Re: RFR: JDK-8319123 : Implementation of JEP-461: Stream Gatherers (Preview)

2023-11-08 Thread Rémi Forax
On Fri, 3 Nov 2023 16:51:34 GMT, Viktor Klang wrote: >> Since stream facilities are package-private, we can just use no access >> modifier and remove all new `protected` access modifier (on methods, fields, >> constructors) in this PR. > > @liach We could do that, yet I'm not sure that is stric

Re: RFR: JDK-8319123 : Implementation of JEP-461: Stream Gatherers (Preview)

2023-11-08 Thread Rémi Forax
On Mon, 30 Oct 2023 15:38:35 GMT, Viktor Klang wrote: > This Pull-Request implements [JEP-461](https://openjdk.org/jeps/461) src/java.base/share/classes/java/util/stream/AbstractPipeline.java line 223: > 221: * consumed > 222: */ > 223: protected AbstractPipeline(AbstractPipeline

Re: RFR: 8319220: Pattern matching switch with a lot of cases is unduly slow [v3]

2023-11-03 Thread Rémi Forax
On Fri, 3 Nov 2023 16:43:30 GMT, Jan Lahoda wrote: >> Consider code like: >> >> void test(Object o) { >> switch (o) { >> case X1 -> {} >> case X2 -> {} >> ...(about 100 cases) >> ``` >> >> javac will compile the switch into a switch whose selector is an indy >> invocation

Re: RFR: 8319220: Pattern matching switch with a lot of cases is unduly slow [v2]

2023-11-03 Thread Rémi Forax
On Fri, 3 Nov 2023 15:32:34 GMT, Jan Lahoda wrote: >> Consider code like: >> >> void test(Object o) { >> switch (o) { >> case X1 -> {} >> case X2 -> {} >> ...(about 100 cases) >> ``` >> >> javac will compile the switch into a switch whose selector is an indy >> invocation

Re: RFR: 8319220: Pattern matching switch with a lot of cases is unduly slow

2023-11-03 Thread Rémi Forax
On Fri, 3 Nov 2023 15:29:05 GMT, Jan Lahoda wrote: > Thanks for all the comments so far - I think I've either reflected them, or > wrote a comment to each of them. Please let me know if there's something > else, or if I've forgotten something. You idea to use an extra array is clever. Using an

Re: RFR: 8319220: Pattern matching switch with a lot of cases is unduly slow [v2]

2023-11-03 Thread Rémi Forax
On Fri, 3 Nov 2023 15:32:34 GMT, Jan Lahoda wrote: >> Consider code like: >> >> void test(Object o) { >> switch (o) { >> case X1 -> {} >> case X2 -> {} >> ...(about 100 cases) >> ``` >> >> javac will compile the switch into a switch whose selector is an indy >> invocation

Re: RFR: 8319220: Pattern matching switch with a lot of cases is unduly slow [v2]

2023-11-03 Thread Rémi Forax
On Fri, 3 Nov 2023 15:32:34 GMT, Jan Lahoda wrote: >> Consider code like: >> >> void test(Object o) { >> switch (o) { >> case X1 -> {} >> case X2 -> {} >> ...(about 100 cases) >> ``` >> >> javac will compile the switch into a switch whose selector is an indy >> invocation

Re: RFR: 8319220: Pattern matching switch with a lot of cases is unduly slow

2023-11-03 Thread Rémi Forax
On Fri, 3 Nov 2023 08:41:12 GMT, Jan Lahoda wrote: > Consider code like: > > void test(Object o) { > switch (o) { > case X1 -> {} > case X2 -> {} > ...(about 100 cases) > ``` > > javac will compile the switch into a switch whose selector is an indy > invocation to `SwitchB

Re: RFR: 8319220: Pattern matching switch with a lot of cases is unduly slow

2023-11-03 Thread Rémi Forax
On Fri, 3 Nov 2023 08:41:12 GMT, Jan Lahoda wrote: > Consider code like: > > void test(Object o) { > switch (o) { > case X1 -> {} > case X2 -> {} > ...(about 100 cases) > ``` > > javac will compile the switch into a switch whose selector is an indy > invocation to `SwitchB

Re: RFR: 8319220: Pattern matching switch with a lot of cases is unduly slow

2023-11-03 Thread Rémi Forax
On Fri, 3 Nov 2023 08:41:12 GMT, Jan Lahoda wrote: > Consider code like: > > void test(Object o) { > switch (o) { > case X1 -> {} > case X2 -> {} > ...(about 100 cases) > ``` > > javac will compile the switch into a switch whose selector is an indy > invocation to `SwitchB

Re: RFR: JDK-8315458 Implementation of Implicitly Declared Classes and Instance Main Method (Second Preview) [v2]

2023-11-02 Thread Rémi Forax
On Thu, 2 Nov 2023 12:24:31 GMT, Jim Laskey wrote: >> Uhmm. In the spec I see implicit classes named here: >> >> >> For reference, the following constructs are declared implicitly in source >> code, but are not marked as mandated because only formal parameters and >> modules can be so marked

Re: RFR: 8315850: Improve AbstractMap anonymous Iterator classes [v3]

2023-09-08 Thread Rémi Forax
On Fri, 8 Sep 2023 18:55:29 GMT, altrisi wrote: >> Per Minborg has updated the pull request incrementally with two additional >> commits since the last revision: >> >> - Fix additional formating issue >> - Don't use polymorphism and reformat code > > With the recent changes this ends up just

Re: RFR: 8315850: Improve AbstractMap anonymous Iterator classes

2023-09-07 Thread Rémi Forax
On Thu, 7 Sep 2023 18:05:51 GMT, Stuart Marks wrote: >> Hello, >> In Java, sharing code may have a runtime cost (or not) depending on the >> shape of the code, because the VM may have to speculate on the class of some >> value at runtime. >> Here, in hasNext() and remove(), the VM has to find t

Re: RFR: 8315850: Improve AbstractMap anonymous Iterator classes

2023-09-07 Thread Rémi Forax
On Thu, 7 Sep 2023 11:48:51 GMT, Per Minborg wrote: > This PR proposes to slightly improve some iterators of `AbstractMap`: > > * Code reuse > * A field declared `final` > * Add missing `@Override` annotations Hello, In Java, sharing code may have a runtime cost (or not) depending on the shape

Re: RFR: 8268829: Provide an optimized way to walk the stack with Class object only [v6]

2023-08-26 Thread Rémi Forax
On Fri, 25 Aug 2023 22:22:43 GMT, Mandy Chung wrote: >> 8268829: Provide an optimized way to walk the stack with Class object only >> >> `StackWalker::walk` creates one `StackFrame` per frame and the current >> implementation >> allocates one `StackFrameInfo` and one `MemberName` objects per fr

Re: RFR: 8268829: Provide an optimized way to walk the stack with Class object only [v6]

2023-08-26 Thread Rémi Forax
On Fri, 25 Aug 2023 22:22:43 GMT, Mandy Chung wrote: >> 8268829: Provide an optimized way to walk the stack with Class object only >> >> `StackWalker::walk` creates one `StackFrame` per frame and the current >> implementation >> allocates one `StackFrameInfo` and one `MemberName` objects per fr

Re: RFR: 8268829: Provide an optimized way to walk the stack with Class object only [v6]

2023-08-26 Thread Rémi Forax
On Fri, 25 Aug 2023 22:22:43 GMT, Mandy Chung wrote: >> 8268829: Provide an optimized way to walk the stack with Class object only >> >> `StackWalker::walk` creates one `StackFrame` per frame and the current >> implementation >> allocates one `StackFrameInfo` and one `MemberName` objects per fr

Re: RFR: 8266571: Sequenced Collections [v12]

2023-07-21 Thread Rémi Forax
On Fri, 21 Jul 2023 16:19:35 GMT, Hollis Waite wrote: > a SequencedCollection is backed by a doubly linked list. It's up to the user > to understand performance implications. Beware of this kind of thinking, implementations of collections in the JDK change. Many hashtable implementations in o

Re: RFR: 8266571: Sequenced Collections [v12]

2023-07-21 Thread Rémi Forax
On Fri, 21 Jul 2023 11:16:11 GMT, Hollis Waite wrote: >> Stuart Marks has updated the pull request with a new target base due to a >> merge or a rebase. The pull request now contains 96 commits: >> >> - Merge branch 'master' into JDK-8266571-SequencedCollections >> - Optimizations for Reverse

Re: RFR: 8306647: Implementation of Structured Concurrency (Preview) [v2]

2023-05-30 Thread Rémi Forax
On Thu, 25 May 2023 08:21:39 GMT, Alan Bateman wrote: >> This is the implementation of: >> >> - JEP 453: Structured Concurrency (Preview) >> - JEP 446: Scoped Values (Preview) >> >> For the most part, this is just moving code and tests. StructuredTaskScope >> moves to j.u.concurrent as a prev

Re: RFR: JDK-8306112 Implementation of JEP 445: Unnamed Classes and Instance Main Methods (Preview) [v20]

2023-05-25 Thread Rémi Forax
On Fri, 26 May 2023 06:07:05 GMT, Joe Darcy wrote: >> Jim Laskey has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Improving error recovery in presence of less important syntactic errors in >> top-level methods and fields. >> >> Auth

Re: RFR: 6983726: Reimplement MethodHandleProxies.asInterfaceInstance [v16]

2023-05-08 Thread Rémi Forax
On Mon, 8 May 2023 10:46:34 GMT, Maurizio Cimadamore wrote: >> src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java line >> 342: >> >>> 340: >>> 341: // individual handle fields >>> 342: clb.withField(ORIGINAL_TARGET_NAME, CD_MethodHandle, >>> ACC_PRI

Re: RFR: JDK-8306112 Implementation of JEP 445: Unnamed Classes and Instance Main Methods (Preview) [v9]

2023-05-05 Thread Rémi Forax
On Fri, 5 May 2023 17:35:33 GMT, Vicente Romero wrote: >> `Flags.MANDATED` on a class is currently enough to know if it's a unnamed >> class or not, but it's not enough for classes not produced by javac. > > good point Just to be clear, here, Flags.UNNAMED_CLASS is needed because an an unnamed

Re: RFR: JDK-8306112 Implementation of JEP 445: Unnamed Classes and Instance Main Methods (Preview) [v9]

2023-05-05 Thread Rémi Forax
On Fri, 5 May 2023 17:08:35 GMT, Vicente Romero wrote: >> Jim Laskey has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Recommended changes #2 > > src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java > line 3999: > >

Re: RFR: 6983726: Reimplement MethodHandleProxies.asInterfaceInstance [v12]

2023-05-02 Thread Rémi Forax
On Tue, 2 May 2023 21:22:16 GMT, Chen Liang wrote: >> As John Rose has pointed out in this issue, the current j.l.r.Proxy based >> implementation of MethodHandleProxies.asInterface has a few issues: >> 1. Exposes too much information via Proxy supertype (and WrapperInstance >> interface) >> 2.

Re: RFR: 8291966: SwitchBootstrap.typeSwitch could be faster [v2]

2023-05-02 Thread Rémi Forax
On Tue, 17 Jan 2023 15:55:40 GMT, Jan Lahoda wrote: >> The pattern matching switches are using a bootstrap method >> `SwitchBootstrap.typeSwitch` to implement the jumps in the switch. >> Basically, for a switch like: >> >> switch (obj) { >> case String s when s.isEmpty() -> {} >> case

Re: RFR: 6983726: Reimplement MethodHandleProxies.asInterfaceInstance [v11]

2023-05-02 Thread Rémi Forax
On Mon, 1 May 2023 14:56:27 GMT, Chen Liang wrote: >> As John Rose has pointed out in this issue, the current j.l.r.Proxy based >> implementation of MethodHandleProxies.asInterface has a few issues: >> 1. Exposes too much information via Proxy supertype (and WrapperInstance >> interface) >> 2.

Re: RFR: 8291966: SwitchBootstrap.typeSwitch could be faster [v2]

2023-04-30 Thread Rémi Forax
On Tue, 17 Jan 2023 15:55:40 GMT, Jan Lahoda wrote: >> The pattern matching switches are using a bootstrap method >> `SwitchBootstrap.typeSwitch` to implement the jumps in the switch. >> Basically, for a switch like: >> >> switch (obj) { >> case String s when s.isEmpty() -> {} >> case

Re: RFR: 8300543 Compiler Implementation for Pattern Matching for switch [v5]

2023-04-24 Thread Rémi Forax
On Fri, 21 Apr 2023 16:25:04 GMT, Jan Lahoda wrote: >> This is the first draft of a patch for JEP 440 and JEP 441. Changes included: >> >> - the pattern matching for switch and record patterns features are made >> final, together with updates to tests. >> - parenthesized patterns are removed.

Re: RFR: 8300543 Compiler Implementation for Pattern Matching for switch [v4]

2023-04-21 Thread Rémi Forax
On Fri, 21 Apr 2023 15:30:24 GMT, Maurizio Cimadamore wrote: >> Also, surprisingly, if I make C and D classes (instead of interfaces): >> >> class Test { >> sealed interface I permits C, D { } >> final class C implements I { } >> final class D implements I { } >> >> interface F

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v8]

2023-04-06 Thread Rémi Forax
On Thu, 6 Apr 2023 18:33:29 GMT, Chen Liang wrote: >> As John Rose has pointed out in this issue, the current j.l.r.Proxy based >> implementation of MethodHandleProxies.asInterface has a few issues: >> 1. Exposes too much information via Proxy supertype (and WrapperInstance >> interface) >> 2.

Re: RFR: JDK-8285932 Implementation of JEP 430 String Templates (Preview) [v53]

2023-04-04 Thread Rémi Forax
On Tue, 4 Apr 2023 15:16:19 GMT, Jim Laskey wrote: >> Enhance the Java programming language with string templates, which are >> similar to string literals but contain embedded expressions. A string >> template is interpreted at run time by replacing each expression with the >> result of evalua

Re: RFR: JDK-8285932 Implementation of JEP 430 String Templates (Preview) [v53]

2023-04-04 Thread Rémi Forax
On Tue, 4 Apr 2023 15:16:19 GMT, Jim Laskey wrote: >> Enhance the Java programming language with string templates, which are >> similar to string literals but contain embedded expressions. A string >> template is interpreted at run time by replacing each expression with the >> result of evalua

Re: RFR: 8304846: Provide a shared utility to dump generated classes defined via Lookup API [v6]

2023-04-03 Thread Rémi Forax
On Mon, 3 Apr 2023 20:24:56 GMT, Mandy Chung wrote: >> This implements a shared utility to dump generated classes defined as >> normal/hidden classes via `Lookup` API. This replaces the implementation >> in `LambdaMetaFactory` and method handle implementation that dumps the >> hidden class b

Re: RFR: 8266571: Sequenced Collections [v4]

2023-03-29 Thread Rémi Forax
On Wed, 29 Mar 2023 20:54:15 GMT, Chen Liang wrote: >> Yes, >> The spec says :"Changes to the underlying collection might or might not be >> visible in this reversed view, depending upon the implementation." so i >> believe the default implementation i proposed is a valid implementation > > In

Re: RFR: 8266571: Sequenced Collections [v4]

2023-03-29 Thread Rémi Forax
On Wed, 29 Mar 2023 19:54:48 GMT, Tagir F. Valeev wrote: >> In the same spirit, `reversed()` should also have a default implementation >> equivalent to >> >> >> Collections.unmodifiableSequenceCollection(Arrays.asList(this.toArray())).reversed() > > @forax but this would not be a view: chang

Re: RFR: 8266571: Sequenced Collections [v4]

2023-03-29 Thread Rémi Forax
On Wed, 29 Mar 2023 19:06:20 GMT, Chen Liang wrote: >> Stuart Marks has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Simplify handling of cached keySet, values, and entrySet views. > > src/java.base/share/classes/java/util/SequencedCollec

Re: RFR: 8266571: Sequenced Collections [v4]

2023-03-29 Thread Rémi Forax
On Tue, 28 Mar 2023 02:37:22 GMT, Stuart Marks wrote: >> PR for Sequenced Collections implementation. > > Stuart Marks has updated the pull request incrementally with one additional > commit since the last revision: > > Simplify handling of cached keySet, values, and entrySet views. This is

Re: RFR: 8266571: Sequenced Collections [v4]

2023-03-29 Thread Rémi Forax
On Tue, 28 Mar 2023 02:37:22 GMT, Stuart Marks wrote: >> PR for Sequenced Collections implementation. > > Stuart Marks has updated the pull request incrementally with one additional > commit since the last revision: > > Simplify handling of cached keySet, values, and entrySet views. Hi Erik,

Re: RFR: 8266571: Sequenced Collections [v2]

2023-03-29 Thread Rémi Forax
On Wed, 29 Mar 2023 06:52:35 GMT, ExE Boss wrote: > There is SortedMap, yes, but no sorted "collection". An interface with a special semantic for set, map or list do not have the same impact in term of number of lines to maintain than a collection with a special semantics. And java.util.Colle

Re: RFR: 8266571: Sequenced Collections [v2]

2023-03-28 Thread Rémi Forax
On Tue, 28 Mar 2023 00:01:27 GMT, Stuart Marks wrote: >> This change is absolutely massive, implementing reversed() basically doubles >> the number of implementations which means multiple years of debugging / spec >> fixing. >> >> Reversing a List makes sense, reversing a LinkedHashSet/LinkedH

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion

2023-03-28 Thread Rémi Forax
On Mon, 27 Mar 2023 23:34:52 GMT, Chen Liang wrote: > As John Rose has pointed out in this issue, the current j.l.r.Proxy based > implementation of MethodHandleProxies.asInterface has a few issues: > 1. Exposes too much information via Proxy supertype (and WrapperInstance > interface) > 2. Does

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion

2023-03-28 Thread Rémi Forax
On Mon, 27 Mar 2023 23:34:52 GMT, Chen Liang wrote: > As John Rose has pointed out in this issue, the current j.l.r.Proxy based > implementation of MethodHandleProxies.asInterface has a few issues: > 1. Exposes too much information via Proxy supertype (and WrapperInstance > interface) > 2. Does

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion

2023-03-28 Thread Rémi Forax
On Mon, 27 Mar 2023 23:34:52 GMT, Chen Liang wrote: > As John Rose has pointed out in this issue, the current j.l.r.Proxy based > implementation of MethodHandleProxies.asInterface has a few issues: > 1. Exposes too much information via Proxy supertype (and WrapperInstance > interface) > 2. Does

Re: RFR: 8266571: Sequenced Collections [v2]

2023-03-25 Thread Rémi Forax
On Sat, 25 Mar 2023 03:54:23 GMT, Stuart Marks wrote: >> PR for Sequenced Collections implementation. > > Stuart Marks has updated the pull request incrementally with two additional > commits since the last revision: > > - More specification tweaks. > - Add simple overrides to ArrayList. Thi

Re: RFR: 8266571: Sequenced Collections [v2]

2023-03-25 Thread Rémi Forax
On Sat, 25 Mar 2023 03:54:23 GMT, Stuart Marks wrote: >> PR for Sequenced Collections implementation. > > Stuart Marks has updated the pull request incrementally with two additional > commits since the last revision: > > - More specification tweaks. > - Add simple overrides to ArrayList. src

Re: RFR: 8266571: Sequenced Collections [v2]

2023-03-25 Thread Rémi Forax
On Sat, 25 Mar 2023 03:54:23 GMT, Stuart Marks wrote: >> PR for Sequenced Collections implementation. > > Stuart Marks has updated the pull request incrementally with two additional > commits since the last revision: > > - More specification tweaks. > - Add simple overrides to ArrayList. src

Re: RFR: 8266571: Sequenced Collections [v2]

2023-03-25 Thread Rémi Forax
On Sat, 25 Mar 2023 03:54:23 GMT, Stuart Marks wrote: >> PR for Sequenced Collections implementation. > > Stuart Marks has updated the pull request incrementally with two additional > commits since the last revision: > > - More specification tweaks. > - Add simple overrides to ArrayList. src

Re: RFR: JDK-8285932 Implementation of JEP 430 String Templates (Preview) [v46]

2023-03-23 Thread Rémi Forax
On Thu, 23 Mar 2023 12:17:55 GMT, Jim Laskey wrote: >> src/java.base/share/classes/java/lang/runtime/TemplateRuntime.java line 204: >> >>> 202: Object[] values >>> 203: ) throws Throwable { >>> 204: List asList = Collections.unmodifiableList(new >>> ArrayList<>(Arrays.as

Re: RFR: JDK-8285932 Implementation of JEP 430 String Templates (Preview) [v46]

2023-03-23 Thread Rémi Forax
On Thu, 23 Mar 2023 15:49:37 GMT, Jim Laskey wrote: >> On the flip side, for those that don't use `var`; >> >> >> Processor simple = Processor.of(st-> new >> JSONObject(st.interpolate())); >> Processor string = >> Processor.of(StringTemplate::interpolate); >> >> >> vs. >> >> >> SimpleProc

Re: RFR: 8302154: Hidden classes created by LambdaMetaFactory can't be unloaded [v2]

2023-02-22 Thread Rémi Forax
On Wed, 22 Feb 2023 17:05:00 GMT, Kasper Nielsen wrote: >> Volker Simonis has updated the pull request incrementally with two >> additional commits since the last revision: >> >> - Remove assertions which insist on Lambda proxy classes being strongly >> linked to their class loader >> - Remo

Re: RFR: 8302154: Hidden classes created by LambdaMetaFactory can't be unloaded [v2]

2023-02-22 Thread Rémi Forax
On Thu, 9 Feb 2023 18:11:18 GMT, Volker Simonis wrote: >> Prior to >> [JDK-8239384](https://bugs.openjdk.org/browse/JDK-8239384)/[JDK-8238358](https://bugs.openjdk.org/browse/JDK-8238358) >> LambdaMetaFactory has created VM-anonymous classes which could easily be >> unloaded once they were not

Re: RFR: 8302154: Hidden classes created by LambdaMetaFactory can't be unloaded [v2]

2023-02-17 Thread Rémi Forax
On Thu, 9 Feb 2023 18:11:18 GMT, Volker Simonis wrote: >> Prior to >> [JDK-8239384](https://bugs.openjdk.org/browse/JDK-8239384)/[JDK-8238358](https://bugs.openjdk.org/browse/JDK-8238358) >> LambdaMetaFactory has created VM-anonymous classes which could easily be >> unloaded once they were not

Re: RFR: 8301220: Return value of toArray() of Сollection types from java.base should be trusted [v2]

2023-01-28 Thread Rémi Forax
On Fri, 27 Jan 2023 13:53:45 GMT, Glavo wrote: >> I checked the `java.base` module, and all the `Collection#toArray()` method >> of collections be implemented correctly. >> >> Their return values can be trusted, so many unnecessary array duplication >> can be eliminated. > > Glavo has updated

Re: RFR: 8301220: Return value of toArray() of Сollection types from java.base should be trusted [v2]

2023-01-27 Thread Rémi Forax
On Fri, 27 Jan 2023 13:53:45 GMT, Glavo wrote: >> I checked the `java.base` module, and all the `Collection#toArray()` method >> of collections be implemented correctly. >> >> Their return values can be trusted, so many unnecessary array duplication >> can be eliminated. > > Glavo has updated

Re: RFR: 8299444 java.util.Set.copyOf allocates needlessly for empty input collections [v2]

2023-01-24 Thread Rémi Forax
On Tue, 24 Jan 2023 13:40:37 GMT, Viktor Klang wrote: >> `coll instanceof ListN list` should work. > > @forax @stuart-marks Yeah, that works. It's unfortunate that it's not > possible to match on the actual (generic) type, as then both sides of the || > could use type unification to avoid havin

Re: RFR: 8299444 java.util.Set.copyOf allocates needlessly for empty input collections [v2]

2023-01-24 Thread Rémi Forax
On Tue, 24 Jan 2023 10:23:14 GMT, Viktor Klang wrote: >> src/java.base/share/classes/java/util/ImmutableCollections.java line 169: >> >>> 167: @SuppressWarnings("unchecked") >>> 168: static List listCopy(Collection coll) { >>> 169: if (coll instanceof List12 || (coll instanceof

Re: RFR: 8300237: Minor improvements in MethodHandles [v5]

2023-01-18 Thread Rémi Forax
On Wed, 18 Jan 2023 07:32:58 GMT, Sergey Tsypanov wrote: >> - `MethodType.ptypes()` can be used instead of `MethodType.parameterList()` >> when we don't need a copy >> - comparison of two lists can be done without `Stream.reduce()` > > Sergey Tsypanov has updated the pull request incrementally w

Re: RFR: 8300237: Minor improvements in MethodHandles [v3]

2023-01-17 Thread Rémi Forax
On Tue, 17 Jan 2023 18:07:37 GMT, Sergey Tsypanov wrote: >> - `MethodType.ptypes()` can be used instead of `MethodType.parameterList()` >> when we don't need a copy >> - comparison of two lists can be done without `Stream.reduce()` > > Sergey Tsypanov has updated the pull request incrementally w

Re: RFR: 8300237: Minor improvements in MethodHandles [v2]

2023-01-17 Thread Rémi Forax
On Tue, 17 Jan 2023 10:18:42 GMT, Claes Redestad wrote: >> Using lambdas inside MethodHandles is quite dangerous given that lambdas are >> initialized using method handles. It may work now because >> longuestParameterList() is not called when initializing a lambda but it may >> make any change

Re: RFR: 8300237: Minor improvements in MethodHandles

2023-01-17 Thread Rémi Forax
On Tue, 17 Jan 2023 09:51:31 GMT, Claes Redestad wrote: >> - `MethodType.ptypes()` can be used instead of `MethodType.parameterList()` >> when we don't need a copy >> - comparison of two lists can be done without `Stream.reduce()` > > src/java.base/share/classes/java/lang/invoke/MethodHandles.ja

Re: RFR: 8299576: Reimplement java.io.Bits using VarHandle access [v7]

2023-01-17 Thread Rémi Forax
On Mon, 9 Jan 2023 09:22:25 GMT, Per Minborg wrote: >> Currently, `java.io.Bits` is using explicit logic to read/write various >> primitive types to/from byte arrays. Switching to the use of `VarHandle` >> access would provide better performance and less code. >> >> Also, using a standard API

  1   2   >