RFR: 8307911: javadoc for MemorySegment::reinterpret has duplicate restricted method paragraph

2023-05-11 Thread Maurizio Cimadamore
As the title says, this patch fixes an issue with `MemorySegment::reinterpet`, which reports the customary "restricted method" section twice. I also fixed some wrong capitalization in the text of the factories in `Linker.Option`. - Commit messages: - Initial push Changes:

Integrated: 8307610: Linker::nativeLinker should not be restricted (mainline)

2023-05-11 Thread Maurizio Cimadamore
On Mon, 8 May 2023 11:10:36 GMT, Maurizio Cimadamore wrote: > Port of: https://git.openjdk.org/panama-foreign/pull/831 This pull request has now been integrated. Changeset: ba9714d4 Author: Maurizio Cimadamore URL: https://git.openjdk.org/jdk/com

Re: RFR: 8307610: Linker::nativeLinker should not be restricted (mainline) [v3]

2023-05-10 Thread Maurizio Cimadamore
> Port of: https://git.openjdk.org/panama-foreign/pull/831 Maurizio Cimadamore has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains four commits: - Merge branch 'master' into linker_restricted - Address review comment - Cleanup code

Re: RFR: 8305990: Stripping debug info of ASM 9.5 fails [v13]

2023-05-09 Thread Maurizio Cimadamore
On Tue, 9 May 2023 11:11:36 GMT, Adam Sotona wrote: >> Classfile API didn't handle transformations of class files version 50 and >> below correctly. >> >> Proposed fix have two parts: >> 1. Inflation of branch targets does not depend on StackMapTable attribute >> presence for class file

Re: RFR: 8305990: Stripping debug info of ASM 9.5 fails [v13]

2023-05-09 Thread Maurizio Cimadamore
On Tue, 9 May 2023 11:11:36 GMT, Adam Sotona wrote: >> Classfile API didn't handle transformations of class files version 50 and >> below correctly. >> >> Proposed fix have two parts: >> 1. Inflation of branch targets does not depend on StackMapTable attribute >> presence for class file

Re: RFR: 8305990: Stripping debug info of ASM 9.5 fails [v13]

2023-05-09 Thread Maurizio Cimadamore
On Tue, 9 May 2023 11:11:36 GMT, Adam Sotona wrote: >> Classfile API didn't handle transformations of class files version 50 and >> below correctly. >> >> Proposed fix have two parts: >> 1. Inflation of branch targets does not depend on StackMapTable attribute >> presence for class file

Integrated: 8307411: Test java/foreign/channels/TestAsyncSocketChannels.java failed: IllegalStateException: Already closed

2023-05-09 Thread Maurizio Cimadamore
On Mon, 8 May 2023 13:46:55 GMT, Maurizio Cimadamore wrote: > This is a tricky intermittent failure on one of our async file channel test. > > While the logic of the test is a bit hard to follow, I believe the test is > supposed to work as follows: > > * in the main

Integrated: 8307629: FunctionDescriptor::toMethodType should allow sequence layouts (mainline)

2023-05-09 Thread Maurizio Cimadamore
On Mon, 8 May 2023 16:10:37 GMT, Maurizio Cimadamore wrote: > This is a port of: https://git.openjdk.org/panama-foreign/pull/830 This pull request has now been integrated. Changeset: 7a3bea1f Author: Maurizio Cimadamore URL: https://git.openjdk.org/jdk/com

RFR: 8307629: FunctionDescriptor::toMethodType should allow sequence layouts (mainline)

2023-05-08 Thread Maurizio Cimadamore
This is a port of: https://git.openjdk.org/panama-foreign/pull/830 - Commit messages: - Initial push Changes: https://git.openjdk.org/jdk/pull/13869/files Webrev: https://webrevs.openjdk.org/?repo=jdk=13869=00 Issue: https://bugs.openjdk.org/browse/JDK-8307629 Stats: 75 lines

Re: RFR: 8307615: Linker::nativeLinker should not be restricted (mainline) [v2]

2023-05-08 Thread Maurizio Cimadamore
> Port of: https://git.openjdk.org/panama-foreign/pull/831 Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision: Address review comment - Changes: - all: https://git.openjdk.org/jdk/pull/13863/files - new: ht

Re: RFR: 8307615: Linker::nativeLinker should not be restricted (mainline) [v2]

2023-05-08 Thread Maurizio Cimadamore
On Mon, 8 May 2023 12:17:44 GMT, Jorn Vernee wrote: >> Maurizio Cimadamore has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Address review comment > > src/java.base/share/classes/jdk/internal/foreign/abi/

RFR: 8307615: Linker::nativeLinker should not be restricted (mainline)

2023-05-08 Thread Maurizio Cimadamore
Port of: https://git.openjdk.org/panama-foreign/pull/831 - Commit messages: - Cleanup code so that restricted method check is shared - Initial push Changes: https://git.openjdk.org/jdk/pull/13863/files Webrev: https://webrevs.openjdk.org/?repo=jdk=13863=00 Issue:

Re: RFR: 8307615: Linker::nativeLinker should not be restricted (mainline)

2023-05-08 Thread Maurizio Cimadamore
On Mon, 8 May 2023 11:10:36 GMT, Maurizio Cimadamore wrote: > Port of: https://git.openjdk.org/panama-foreign/pull/831 src/java.base/share/classes/jdk/internal/foreign/abi/AbstractLinker.java line 86: > 84: } > 85: > 86: private final MethodHandle downcallHandle0(Class

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

2023-05-08 Thread Maurizio Cimadamore
On Mon, 8 May 2023 09:32:31 GMT, Maurizio Cimadamore wrote: >> Chen Liang has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Remove assertion, no longer true with teleport definition in MHP > > src/java.base/

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

2023-05-08 Thread Maurizio Cimadamore
On Sun, 7 May 2023 13:34:54 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: The introduction of Sequenced collections is not a source compatible change

2023-05-05 Thread Maurizio Cimadamore
Another way to help inference, in cases like this would be to break up the method chain - as follows: final Stream> stream = Stream.of(nestedDequeue, nestedList); final List> list = stream.toList(); In the above rewriting, now the target type Stream> "drives" inference for Stream::of -

Integrated: 8307375: Alignment check on layouts used as sequence element is not correct

2023-05-05 Thread Maurizio Cimadamore
On Wed, 3 May 2023 17:44:55 GMT, Maurizio Cimadamore wrote: > This patch fixes `Utils::checkElementAlignment` to do the right thing for > _all_ layouts. > > The current implementation is broken, as it only works correctly when the > input layout is a value layout. > Since

Re: RFR: 8291065: Creating a VarHandle for a static field triggers class initialization

2023-05-05 Thread Maurizio Cimadamore
On Fri, 5 May 2023 13:08:33 GMT, Chen Liang wrote: >> Also, perhaps @PaulSandoz knows more history on this one (I believe this >> code predates FFM). > > Eh? I am not sure what you mean here. This is the essence of the patch, where > the "TODO" above is fixed: lookup.findStaticVarHandle now

Re: RFR: 8291065: Creating a VarHandle for a static field triggers class initialization

2023-05-05 Thread Maurizio Cimadamore
On Fri, 5 May 2023 13:03:14 GMT, Chen Liang wrote: >> src/java.base/share/classes/java/lang/invoke/IndirectVarHandle.java line 74: >> >>> 72: @Override >>> 73: public boolean isAccessModeSupported(AccessMode accessMode) { >>> 74: var directTarget = this.directTarget; >> >> Why

Re: RFR: 8291065: Creating a VarHandle for a static field triggers class initialization

2023-05-05 Thread Maurizio Cimadamore
On Fri, 5 May 2023 13:01:09 GMT, Maurizio Cimadamore wrote: >> Also fixed the bug with NPE in `IndirectVarHandle::isAccessModeSupported`. >> >> A few implementation-detail methods in VarHandle are now documented with the >> implied constraints to avoid subtle problem

Re: RFR: 8291065: Creating a VarHandle for a static field triggers class initialization

2023-05-05 Thread Maurizio Cimadamore
On Fri, 5 May 2023 04:48:09 GMT, Chen Liang wrote: > Also fixed the bug with NPE in `IndirectVarHandle::isAccessModeSupported`. > > A few implementation-detail methods in VarHandle are now documented with the > implied constraints to avoid subtle problems in the future. Changed >

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

2023-05-04 Thread Maurizio Cimadamore
On Mon, 1 May 2023 13:06:24 GMT, Jim Laskey wrote: >> Add flexible main methods and anonymous main classes to the Java language. > > Jim Laskey has updated the pull request incrementally with two additional > commits since the last revision: > > - Anonymous main classes renamed to unnamed

Re: RFR: 8307375: Alignment check on layouts used as sequence element is not correct [v2]

2023-05-04 Thread Maurizio Cimadamore
it more robust, by > also adding pair-wise combinations of layouts, wrapped in a struct/union. > This does generate illegal layout cases which would not have been detected > w/o this patch. Maurizio Cimadamore has updated the pull request incrementally with one additional commit si

Integrated: 8307181: MemoryLayout.structLayout uses undocumented strict alignment constraints

2023-05-04 Thread Maurizio Cimadamore
On Wed, 3 May 2023 08:31:34 GMT, Maurizio Cimadamore wrote: > This patch adds documentation for the behavior of the > `MemoryLayout::structLayout` factory. > > This factory throws an `IllegalArgumentException` if one of the member > layouts passed to it occurs at an offset wi

Re: RFR: 8307181: MemoryLayout.structLayout uses undocumented strict alignment constraints [v2]

2023-05-03 Thread Maurizio Cimadamore
of this patch, I've also added some api notes on how to use this > factory when unaligned elements are present. Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision: Update src/java.base/share/classes/java/lang/foreign/MemoryL

RFR: 8307375: Alignment check on layouts used as sequence element is not correct

2023-05-03 Thread Maurizio Cimadamore
This patch fixes `Utils::checkElementAlignment` to do the right thing for _all_ layouts. The current implementation is broken, as it only works correctly when the input layout is a value layout. Since value layouts have a size that is a power of two (and size all layouts have alignment that is

Re: RFR: 8307181: MemoryLayout.structLayout uses undocumented strict alignment constraints

2023-05-03 Thread Maurizio Cimadamore
On Wed, 3 May 2023 14:54:26 GMT, Maurizio Cimadamore wrote: > Actually, now that I look at it, it seems that the exception we raise is not > correct. I think we need to throw if the element size is not a multiple of > the alignment. That is, the size determines the stride, so

Re: RFR: 8307181: MemoryLayout.structLayout uses undocumented strict alignment constraints

2023-05-03 Thread Maurizio Cimadamore
On Wed, 3 May 2023 14:26:03 GMT, Jorn Vernee wrote: > > Actually, now that I look at it, it seems that the exception we raise is > > not correct. I think we need to throw if the element size is not a multiple > > of the alignment. That is, the size determines the stride, so that has to > > be

Re: RFR: 8307181: MemoryLayout.structLayout uses undocumented strict alignment constraints

2023-05-03 Thread Maurizio Cimadamore
On Wed, 3 May 2023 14:17:02 GMT, Maurizio Cimadamore wrote: > > Isn't this true also for sequence layouts where, for example, the second > > element might be misaligned for `sequenceLayout(2, structLayout(JAVA_INT, > > JAVA_SHORT))`? Or, is this already covered? > &g

Re: RFR: 8307181: MemoryLayout.structLayout uses undocumented strict alignment constraints

2023-05-03 Thread Maurizio Cimadamore
On Wed, 3 May 2023 13:48:11 GMT, Per Minborg wrote: > Isn't this true also for sequence layouts where, for example, the second > element might be misaligned for `sequenceLayout(2, structLayout(JAVA_INT, > JAVA_SHORT))`? Or, is this already covered? That case already has some javadoc text:

RFR: 8307181: MemoryLayout.structLayout uses undocumented strict alignment constraints

2023-05-03 Thread Maurizio Cimadamore
This patch adds documentation for the behavior of the `MemoryLayout::structLayout` factory. This factory throws an `IllegalArgumentException` if one of the member layouts passed to it occurs at an offset within the struct that is not aligned. As part of this patch, I've also added some api

Re: RFR: 8304888: Add dedicated VMProps for linker and fallback linker [v4]

2023-05-02 Thread Maurizio Cimadamore
On Tue, 2 May 2023 13:07:37 GMT, Jorn Vernee wrote: > I went with the `jdk.CABI -> jdk.foreign.linker` name change. Re-tested. Will > integrate soon. Looks good (if we wanted to be 100% explicit, then it would have been jdk.foreign.system.linker/jdk.foreign.native.linker - but what you picked

Re: RFR: 8304888: Add dedicated VMProps for linker and fallback linker [v4]

2023-05-02 Thread Maurizio Cimadamore
On Mon, 1 May 2023 16:48:30 GMT, Jorn Vernee wrote: >> This patch adds a dedicated jtreg property to check which CABI is being used >> by the JDK, which can be used both to check whether the foreign linker is >> supported, and whether the fallback linker is being used. (and, possibly it >>

Re: RFR: 8304888: Add dedicated VMProps for linker and fallback linker [v4]

2023-05-02 Thread Maurizio Cimadamore
On Mon, 1 May 2023 16:48:30 GMT, Jorn Vernee wrote: >> This patch adds a dedicated jtreg property to check which CABI is being used >> by the JDK, which can be used both to check whether the foreign linker is >> supported, and whether the fallback linker is being used. (and, possibly it >>

Re: RFR: 8307164: TestSegmentCopy times out (mainline)

2023-05-02 Thread Maurizio Cimadamore
On Mon, 1 May 2023 17:02:11 GMT, Jorn Vernee wrote: > Port of: https://github.com/openjdk/panama-foreign/pull/827 Looks good (already reviewed on panama repo) - Marked as reviewed by mcimadamore (Reviewer). PR Review:

Re: RFR: JDK-8306112 Implementation of JEP 445: Flexible Main Methods and Anonymous Main Classes (Preview) [v3]

2023-04-27 Thread Maurizio Cimadamore
On Thu, 27 Apr 2023 18:21:56 GMT, Jim Laskey wrote: >> Add flexible main methods and anonymous main classes to the Java language. > > Jim Laskey has updated the pull request with a new target base due to a merge > or a rebase. The pull request now contains 14 commits: > > - Merge branch

Re: RFR: JDK-8306112 Implementation of JEP 445: Flexible Main Methods and Anonymous Main Classes (Preview) [v2]

2023-04-27 Thread Maurizio Cimadamore
On Thu, 27 Apr 2023 18:28:41 GMT, Jim Laskey wrote: >> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java line 432: >> >>> 430: >>> 431: // Restructure top level to be an top level anonymous class. >>> 432: public static void

Re: RFR: JDK-8306112 Implementation of JEP 445: Flexible Main Methods and Anonymous Main Classes (Preview) [v2]

2023-04-27 Thread Maurizio Cimadamore
On Thu, 27 Apr 2023 13:17:58 GMT, Jim Laskey wrote: >> Add flexible main methods and anonymous main classes to the Java language. > > Jim Laskey has updated the pull request incrementally with one additional > commit since the last revision: > > PreviewFeatures.isEnabled()

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

2023-04-25 Thread Maurizio Cimadamore
On Tue, 25 Apr 2023 10:23:11 GMT, Maurizio Cimadamore wrote: >> test/langtools/tools/javac/patterns/Exhaustiveness.java line 1: >> >>> 1: /* >> >> Isn't `Isn't `testCoversType1` the same as `testExhaustiveStatement3` ? > > Some of the tests called `testE

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

2023-04-25 Thread Maurizio Cimadamore
On Tue, 25 Apr 2023 10:22:40 GMT, Maurizio Cimadamore wrote: >> Jan Lahoda has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Reflecting review changes. > > test/langtools/tools/javac/patterns/Exhau

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

2023-04-25 Thread Maurizio Cimadamore
On Tue, 25 Apr 2023 10:33:33 GMT, Maurizio Cimadamore wrote: >> Some of the tests called `testExhaustiveStatement` do not seem to test >> statements at all > > In the two `testXYZExhaustiveIntersection` the class hierarchy seems the same > - can we reuse it across multi

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

2023-04-25 Thread Maurizio Cimadamore
On Mon, 24 Apr 2023 15:16:18 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

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

2023-04-25 Thread Maurizio Cimadamore
On Mon, 24 Apr 2023 15:16:18 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

Re: RFR: 8305093: Linker cache should not take layout names into account [v2]

2023-04-24 Thread Maurizio Cimadamore
On Fri, 21 Apr 2023 01:03:57 GMT, Jorn Vernee wrote: >> Strip names from the function descriptors used in linkage requests. The >> names are not important for classification, and this will allow the cached >> MethodHandle/UpcallStubFactory to be shared across linkage request with the >> same

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

2023-04-24 Thread Maurizio Cimadamore
On Mon, 24 Apr 2023 12:53:59 GMT, Jan Lahoda wrote: > In this case, as long as the union type could only be present at the top > level (as opposed to e.g. a type of a record component), we could simply > require all components to be covered for union types for exhaustiveness in >

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

2023-04-24 Thread Maurizio Cimadamore
On Mon, 24 Apr 2023 09:05:56 GMT, Rémi Forax wrote: > > I believe the exhaustiveness algorithm needs rules for union types, both in > > javac and in the JLS: > > ... > > I would expect the above switch to be exhaustive, since it covers all > > possible components of the union type. In other

Re: RFR: 8305201: Improve error message for GroupLayouts that are too large on SysV

2023-04-24 Thread Maurizio Cimadamore
On Fri, 21 Apr 2023 14:25:26 GMT, Jorn Vernee wrote: > Using for instance a struct layout that contains an unbounded array will > produce the exception from the JBS issue. > > This patch checks for the case where a GroupLayout is too large more > explicitly, and reports the issue using a more

Re: RFR: 8305093: Linker cache should not take layout names into account [v2]

2023-04-24 Thread Maurizio Cimadamore
On Fri, 21 Apr 2023 01:03:57 GMT, Jorn Vernee wrote: >> Strip names from the function descriptors used in linkage requests. The >> names are not important for classification, and this will allow the cached >> MethodHandle/UpcallStubFactory to be shared across linkage request with the >> same

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

2023-04-24 Thread Maurizio Cimadamore
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

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

2023-04-21 Thread Maurizio Cimadamore
On Fri, 21 Apr 2023 15:34:32 GMT, Rémi Forax wrote: > > Which compiles correctly, but it doesn't look exhaustive to me (because of > > F) ? > > Can you expand a little more, because for me a Z either implement C or D or > both C and D. Please see my latest comment above. I was confused by

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

2023-04-21 Thread Maurizio Cimadamore
On Fri, 21 Apr 2023 10:56:55 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

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

2023-04-21 Thread Maurizio Cimadamore
On Fri, 21 Apr 2023 15:17:37 GMT, Maurizio Cimadamore wrote: >> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java line 915: >> >>> 913: */ >>> 914: private List reduceBindingPatterns(Type >>> selectorType, Li

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

2023-04-21 Thread Maurizio Cimadamore
On Fri, 21 Apr 2023 10:56:55 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

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

2023-04-21 Thread Maurizio Cimadamore
On Fri, 21 Apr 2023 15:16:03 GMT, Maurizio Cimadamore wrote: >> Jan Lahoda has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Replacing use of mutable callsite with a mutable state. > > src/jdk.compiler/sha

Re: RFR: 8303002: Reject packed structs from linker [v6]

2023-04-20 Thread Maurizio Cimadamore
On Thu, 20 Apr 2023 01:12:44 GMT, Jorn Vernee wrote: >> This patch adds checks in AbstractLinker to reject packed structs and >> structs with excess padding (e.g. unnamed bitfields), since both of those >> are currently not supported, and the ABI/spec seems too vague to base >> support on. >

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

2023-04-19 Thread Maurizio Cimadamore
On Tue, 18 Apr 2023 09:13:01 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

Re: RFR: 8303002: Reject packed structs from linker [v5]

2023-04-18 Thread Maurizio Cimadamore
On Tue, 18 Apr 2023 13:45:57 GMT, Jorn Vernee wrote: >> This patch adds checks in AbstractLinker to reject packed structs and >> structs with excess padding (e.g. unnamed bitfields), since both of those >> are currently not supported, and the ABI/spec seems too vague to base >> support on. >

Re: RFR: 8303002: Reject packed structs from linker [v5]

2023-04-18 Thread Maurizio Cimadamore
On Tue, 18 Apr 2023 22:25:09 GMT, Maurizio Cimadamore wrote: >> Jorn Vernee 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 contain

Re: RFR: 8303002: Reject packed structs from linker [v5]

2023-04-18 Thread Maurizio Cimadamore
On Tue, 18 Apr 2023 13:45:57 GMT, Jorn Vernee wrote: >> This patch adds checks in AbstractLinker to reject packed structs and >> structs with excess padding (e.g. unnamed bitfields), since both of those >> are currently not supported, and the ABI/spec seems too vague to base >> support on. >

Re: RFR: 8303002: Reject packed structs from linker [v5]

2023-04-18 Thread Maurizio Cimadamore
On Tue, 18 Apr 2023 13:45:57 GMT, Jorn Vernee wrote: >> This patch adds checks in AbstractLinker to reject packed structs and >> structs with excess padding (e.g. unnamed bitfields), since both of those >> are currently not supported, and the ABI/spec seems too vague to base >> support on. >

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

2023-04-18 Thread Maurizio Cimadamore
On Tue, 18 Apr 2023 14:31:30 GMT, Maurizio Cimadamore wrote: >> Jan Lahoda has updated the pull request incrementally with six additional >> commits since the last revision: >> >> - Fixing infinite loop where a binding pattern is replaced with a binding >

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

2023-04-18 Thread Maurizio Cimadamore
On Tue, 18 Apr 2023 09:13:01 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

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

2023-04-18 Thread Maurizio Cimadamore
On Tue, 18 Apr 2023 09:13:01 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

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

2023-04-18 Thread Maurizio Cimadamore
On Tue, 18 Apr 2023 13:54:52 GMT, Maurizio Cimadamore wrote: > I've also found an infinite loop with this: I believe this has to do with the fact that the list of pattern is not a set - so we can end up adding the same pattern descriptions over and over. - PR Review Comm

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

2023-04-18 Thread Maurizio Cimadamore
On Tue, 18 Apr 2023 13:43:17 GMT, Maurizio Cimadamore wrote: >> Jan Lahoda has updated the pull request incrementally with six additional >> commits since the last revision: >> >> - Fixing infinite loop where a binding pattern is replaced with a binding >

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

2023-04-18 Thread Maurizio Cimadamore
On Tue, 18 Apr 2023 09:13:01 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

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

2023-04-18 Thread Maurizio Cimadamore
On Tue, 18 Apr 2023 09:13:01 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

Re: RFR: 8300543 Compiler Implementation for Pattern Matching for switch

2023-04-17 Thread Maurizio Cimadamore
On Fri, 17 Mar 2023 12:15:58 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: 8304265: Implementation of Foreign Function and Memory API (Third Preview) [v16]

2023-03-31 Thread Maurizio Cimadamore
borg/panama/21/v1/javadoc/java.base/module-summary.html > > Per Minborg has updated the pull request incrementally with two additional > commits since the last revision: > > - Update src/java.base/share/classes/java/lang/foreign/MemorySegment.java > >Co-authored-by: Mauriz

Re: RFR: 8301703: java.base jdk.internal.foreign.abi.BindingSpecializer uses ASM to generate classes [v2]

2023-03-31 Thread Maurizio Cimadamore
On Thu, 30 Mar 2023 19:55:15 GMT, Jorn Vernee wrote: >> Rewrite BindingSpecializer to use the new class file API. >> >> Note: There is a big try/catch/finally block generated in the `specialize` >> method that currently uses labels. I looked at replacing this with a call to >>

Re: RFR: 8301703: java.base jdk.internal.foreign.abi.BindingSpecializer uses ASM to generate classes [v2]

2023-03-31 Thread Maurizio Cimadamore
On Fri, 31 Mar 2023 03:24:22 GMT, Jorn Vernee wrote: >> Classfile API does have some sort of error reporting mechanism in >> verification; at least it tracks the error context. >>

Re: RFR: 8301703: java.base jdk.internal.foreign.abi.BindingSpecializer uses ASM to generate classes [v2]

2023-03-31 Thread Maurizio Cimadamore
On Thu, 30 Mar 2023 19:55:15 GMT, Jorn Vernee wrote: >> Rewrite BindingSpecializer to use the new class file API. >> >> Note: There is a big try/catch/finally block generated in the `specialize` >> method that currently uses labels. I looked at replacing this with a call to >>

Re: RFR: 8304265: Implementation of Foreign Function and Memory API (Third Preview) [v15]

2023-03-29 Thread Maurizio Cimadamore
On Wed, 29 Mar 2023 08:55:08 GMT, Per Minborg wrote: >> API changes for the FFM API (third preview) >> >> Specdiff: >> https://cr.openjdk.org/~pminborg/panama/21/v1/specdiff/overview-summary.html >> >> Javadoc: >>

Re: RFR: 8304265: Implementation of Foreign Function and Memory API (Third Preview) [v15]

2023-03-29 Thread Maurizio Cimadamore
On Wed, 29 Mar 2023 22:32:20 GMT, Paul Sandoz wrote: >> I've updated the specs as per how I interpret the comments above. Let me >> know your thoughts on this. > > This is much clearer. Are the names of the struct members guaranteed to be > symbols that can be found up via the linker's default

Re: RFR: 8304265: Implementation of Foreign Function and Memory API (Third Preview) [v15]

2023-03-29 Thread Maurizio Cimadamore
On Wed, 29 Mar 2023 08:55:08 GMT, Per Minborg wrote: >> API changes for the FFM API (third preview) >> >> Specdiff: >> https://cr.openjdk.org/~pminborg/panama/21/v1/specdiff/overview-summary.html >> >> Javadoc: >>

Re: RFR: 8304265: Implementation of Foreign Function and Memory API (Third Preview) [v10]

2023-03-28 Thread Maurizio Cimadamore
On Tue, 28 Mar 2023 13:09:45 GMT, Per Minborg wrote: >> > src="https://user-images.githubusercontent.com/7457876/228246205-ff2730cb-610f-4673-aa30-d110845a34fc.png;> >> >> It belongs to the opening brace for `{@return`. Hard to see with other curls >> in between. > > I would have written: > >

Re: RFR: 8304265: Implementation of Foreign Function and Memory API (Third Preview) [v10]

2023-03-28 Thread Maurizio Cimadamore
On Tue, 28 Mar 2023 10:56:07 GMT, Per Minborg wrote: >> API changes for the FFM API (third preview) >> >> Specdiff: >> https://cr.openjdk.org/~pminborg/panama/21/v1/specdiff/overview-summary.html >> >> Javadoc: >>

Re: RFR: 8303524: Check FunctionDescriptor byte order when linking

2023-03-27 Thread Maurizio Cimadamore
On Mon, 27 Mar 2023 15:09:57 GMT, Jorn Vernee wrote: > > The code changes look good, but the javadoc should be updated to reflect > > the new constraints. > > We currently have this: > > ``` > @throws IllegalArgumentException if the provided function descriptor is not > supported by this

Re: RFR: 8303524: Check FunctionDescriptor byte order when linking

2023-03-27 Thread Maurizio Cimadamore
On Thu, 23 Mar 2023 16:47:08 GMT, Jorn Vernee wrote: > Linkers are strongly tied to a particular byte order, because they are tied > to a particular platform. So, the linker should reject layouts that have > another byte order. This patch implements that check. The code changes look good, but

Re: RFR: 8303002: Reject packed structs from linker

2023-03-27 Thread Maurizio Cimadamore
On Thu, 23 Mar 2023 18:11:18 GMT, Jorn Vernee wrote: > This patch adds checks in AbstractLinker to reject packed structs and structs > with excess padding (e.g. unnamed bitfields), since both of those are > currently not supported, and the ABI/spec seems too vague to base support on.

Re: RFD: Should jextract be extracted from the JDK?

2023-03-26 Thread Maurizio Cimadamore
Hi, not sure I understand your question correctly. But if you are referring to the fact that jextract should *not* be part of the JDK, please note that the FFM API does _not_ include jextract. The jextract tool is instead made available in a standalone repository:

Re: RFR: 8304265: Implementation of Foreign Function and Memory API (Third Preview) [v8]

2023-03-23 Thread Maurizio Cimadamore
On Thu, 23 Mar 2023 10:28:23 GMT, Maurizio Cimadamore wrote: >> Yes - although there is a distinction between passed by value and by ref. I >> wouldn't be surprised if we just threw NPE for by-value. > > Just did a test with jshell: > > > jshell> Linke

Re: RFR: 8304265: Implementation of Foreign Function and Memory API (Third Preview) [v8]

2023-03-23 Thread Maurizio Cimadamore
On Wed, 22 Mar 2023 20:07:01 GMT, Maurizio Cimadamore wrote: >> Ah. True. This is true about all the MS parameters as well. > > Yes - although there is a distinction between passed by value and by ref. I > wouldn't be surprised if we just threw NPE for by-value. Just did a t

Re: RFR: 8304265: Implementation of Foreign Function and Memory API (Third Preview) [v8]

2023-03-22 Thread Maurizio Cimadamore
On Wed, 22 Mar 2023 19:25:05 GMT, Jorn Vernee wrote: >> Note: this text was just copied/adapted from toplevel javadoc and moved >> here. I think we have to say something about `null` as the text refers to >> `null` being passed as parameter to the returned MH, which is NOT covered by >> the

Re: RFR: 8304265: Implementation of Foreign Function and Memory API (Third Preview) [v8]

2023-03-22 Thread Maurizio Cimadamore
On Wed, 22 Mar 2023 18:04:15 GMT, Jorn Vernee wrote: >> Per Minborg has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Improve javadocs for Linker::captureStateLayout > > src/java.base/share/classes/java/lang/foreign/MemorySegment.java

Re: RFR: 8304265: Implementation of Foreign Function and Memory API (Third Preview) [v8]

2023-03-22 Thread Maurizio Cimadamore
On Wed, 22 Mar 2023 17:34:36 GMT, Jorn Vernee wrote: >> Per Minborg has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Improve javadocs for Linker::captureStateLayout > > src/java.base/share/classes/java/lang/foreign/Linker.java line 492:

Re: RFR: 8304265: Implementation of Foreign Function and Memory API (Third Preview) [v8]

2023-03-22 Thread Maurizio Cimadamore
On Wed, 22 Mar 2023 15:57:16 GMT, Per Minborg wrote: >> src/java.base/share/classes/java/lang/foreign/MemoryLayout.java line 697: >> >>> 695: */ >>> 696: static PaddingLayout paddingLayout(long bitSize) { >>> 697: if (bitSize <= 0) { >> >> While this does the right thing, I

Re: RFR: 8304265: Implementation of Foreign Function and Memory API (Third Preview) [v8]

2023-03-22 Thread Maurizio Cimadamore
On Wed, 22 Mar 2023 14:09:07 GMT, Per Minborg wrote: >> API changes for the FFM API (third preview) >> >> Specdiff: >> https://cr.openjdk.org/~pminborg/panama/21/v1/specdiff/overview-summary.html >> >> Javadoc: >>

Re: RFR: 8304265: Implementation of Foreign Function and Memory API (Third Preview) [v5]

2023-03-22 Thread Maurizio Cimadamore
On Tue, 21 Mar 2023 09:02:29 GMT, Per Minborg wrote: >> API changes for the FFM API (third preview) >> >> Specdiff: >> https://cr.openjdk.org/~pminborg/panama/21/v1/specdiff/overview-summary.html >> >> Javadoc: >>

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

2023-03-21 Thread Maurizio Cimadamore
On Tue, 21 Mar 2023 13:31:37 GMT, Maurizio Cimadamore wrote: >> Jim Laskey has updated the pull request incrementally with two additional >> commits since the last revision: >> >> - Tidy javadoc >> - Rename StringTemplate classes > > src/java.base/share/c

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

2023-03-21 Thread Maurizio Cimadamore
On Mon, 20 Mar 2023 20:31:46 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

Re: RFR: 8304265: Implementation of Foreign Function and Memory API (Third Preview) [v5]

2023-03-21 Thread Maurizio Cimadamore
On Tue, 21 Mar 2023 00:54:10 GMT, Paul Sandoz wrote: >> Per Minborg has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Add example for Option::captureStateLayout > > src/java.base/share/classes/java/lang/foreign/Linker.java line 621: > >>

Re: RFR: 8304265: Implementation of Foreign Function and Memory API (Third Preview) [v5]

2023-03-21 Thread Maurizio Cimadamore
On Tue, 21 Mar 2023 11:58:28 GMT, Per Minborg wrote: >> I'm not sure about this. Honestly, the example probably doesn't help much if >> somebody didn't get the idea of what the layout might be. I think it might >> be better to say something like, `on Windows/x64 the returned layout might >>

Re: RFR: 8304265: Implementation of Foreign Function and Memory API (Third Preview) [v5]

2023-03-21 Thread Maurizio Cimadamore
On Tue, 21 Mar 2023 09:02:29 GMT, Per Minborg wrote: >> API changes for the FFM API (third preview) >> >> Specdiff: >> https://cr.openjdk.org/~pminborg/panama/21/v1/specdiff/overview-summary.html >> >> Javadoc: >>

Re: RFR: 8304265: Implementation of Foreign Function and Memory API (Third Preview) [v5]

2023-03-21 Thread Maurizio Cimadamore
On Tue, 21 Mar 2023 08:57:42 GMT, Per Minborg wrote: >> src/java.base/share/classes/java/lang/foreign/Linker.java line 621: >> >>> 619: * to a downcall handle linked with {@link >>> #captureCallState(String...)}} >>> 620: * >>> 621: * @see

Re: RFR: 8304265: Implementation of Foreign Function and Memory API (Third Preview) [v5]

2023-03-21 Thread Maurizio Cimadamore
On Tue, 21 Mar 2023 00:35:40 GMT, Paul Sandoz wrote: >> Per Minborg has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Add example for Option::captureStateLayout > > src/java.base/share/classes/java/lang/foreign/Linker.java line 479: > >>

Re: RFR: 8304283: Modernize the switch statements in jdk.internal.foreign

2023-03-15 Thread Maurizio Cimadamore
On Wed, 15 Mar 2023 18:10:29 GMT, Per Minborg wrote: > This PR proposes changing old-type switch statements to newer forms of switch. Overall looks good. I've added a couple of optional comments for your consideration.

Re: RFR: 8303001: Add test for re-entrant upcalls

2023-03-09 Thread Maurizio Cimadamore
On Wed, 8 Mar 2023 15:51:05 GMT, Jorn Vernee wrote: > Add a test that tests re-entrant upcalls, which is a use-case that is > uncovered by testing until now. Nice test! - Marked as reviewed by mcimadamore (Reviewer). PR: https://git.openjdk.org/jdk/pull/12927

Re: RFR: 8303684: Lift upcall sharing mechanism to AbstractLinker (mainline)

2023-03-08 Thread Maurizio Cimadamore
On Mon, 6 Mar 2023 18:40:47 GMT, Jorn Vernee wrote: > Port of: https://github.com/openjdk/panama-foreign/pull/791 which lifts the > sharing mechanism for upcall stubs to AbstractLinker. > > This also speeds up upcall stub linking: Looks good (already reviewed on Panama repo) -

Re: RFR: 8294982: Implementation of Classfile API [v49]

2023-03-07 Thread Maurizio Cimadamore
On Tue, 7 Mar 2023 14:48:43 GMT, Adam Sotona wrote: >> src/java.base/share/classes/jdk/internal/classfile/impl/EntryMap.java line >> 194: >> >>> 192: return (int)s; >>> 193: } >>> 194: } >> >> newline! > > Here I'm also not sure I understand, the long line has bee wrapped. I mean

<    2   3   4   5   6   7   8   9   10   >