Re: RFR: 8321400: java/foreign/TestStubAllocFailure.java fails with code cache exhaustion

2023-12-12 Thread Maurizio Cimadamore
On Mon, 11 Dec 2023 13:01:25 GMT, Jorn Vernee wrote: > Improve the test by being more lenient to related code cache exhaustion > errors. The important thing is that we don't terminate with a fatal error, > which the new code now checks for explicitly. The check for that is based on > what is

Re: RFR: 8321786: SegmentAllocator:allocateFrom(ValueLayout, MemorySegment,ValueLayout,long,long) spec mismatch in exception scenario

2023-12-12 Thread Maurizio Cimadamore
On Tue, 12 Dec 2023 11:49:17 GMT, Per Minborg wrote: >> True. But we will get the wrong type of exception. > > We could change the exception type to `ArithmeticException` in this case and > get performance and correctness at the same time. I simply don't think we should be using

Re: RFR: 8321786: SegmentAllocator:allocateFrom(ValueLayout, MemorySegment,ValueLayout,long,long) spec mismatch in exception scenario

2023-12-12 Thread Maurizio Cimadamore
On Tue, 12 Dec 2023 10:02:00 GMT, Per Minborg wrote: > This PR proposes to change the specification for some methods that take > `long` offsets so that they will throw an `IllegalArgumentException` rather > than an `IndexOutOfBoundsException` for negative values. > > The PR also proposes to

Re: [jdk22] RFR: 8321387: SegmentAllocator:allocateFrom(AddressLayout, MemorySegment) does not throw stated UnsupportedOperationException

2023-12-11 Thread Maurizio Cimadamore
On Mon, 11 Dec 2023 16:26:52 GMT, Per Minborg wrote: > This PR is a backport of https://github.com/openjdk/jdk/pull/16993 Looks good (already approved in master) - Marked as reviewed by mcimadamore (Reviewer). PR Review:

Integrated: 8321467: MemorySegment.setString(long, String, Charset) throws IAE(Misaligned access)

2023-12-07 Thread Maurizio Cimadamore
On Wed, 6 Dec 2023 16:49:30 GMT, Maurizio Cimadamore wrote: > This PR fixes a couple of aligned accesses when reading/writing strings. Such > aligned accesses crept in when we optimized string read/write operations to > work in bulk. As a result, depending on the maximum alignment co

Re: RFR: 8321387: SegmentAllocator:allocateFrom(AddressLayout, MemorySegment) does not throw stated UnsupportedOperationException [v5]

2023-12-07 Thread Maurizio Cimadamore
On Thu, 7 Dec 2023 09:00:46 GMT, Per Minborg wrote: >> This PR proposes to change the exception type for exceptions thrown for >> certain methods with a parameter of type `MemorySegment` when it is >> `MemorySegment::isReadOnly`. Previously an `UnsupportedOperationException` >> was specified

Re: RFR: 8321467: MemorySegment.setString(long, String, Charset) throws IAE(Misaligned access) [v2]

2023-12-06 Thread Maurizio Cimadamore
his reason, I think the best way to > fix this is to use unaligned operations when reading/writing the string. Maurizio Cimadamore has updated the pull request incrementally with two additional commits since the last revision: - Make test more robust - Simplify test - Chang

RFR: 8321467: MemorySegment.setString(long, String, Charset) throws IAE(Misaligned access)

2023-12-06 Thread Maurizio Cimadamore
This PR fixes a couple of aligned accesses when reading/writing strings. Such aligned accesses crept in when we optimized string read/write operations to work in bulk. As a result, depending on the maximum alignment constraints supported by the heap segment, some string operations might fail.

Re: RFR: 8321387: SegmentAllocator:allocateFrom(AddressLayout, MemorySegment) does not throw stated UnsupportedOperationException [v3]

2023-12-06 Thread Maurizio Cimadamore
On Wed, 6 Dec 2023 15:32:54 GMT, Per Minborg wrote: >> This PR proposes to change the exception type for exceptions thrown for >> certain methods with a parameter of type `MemorySegment` when it is >> `MemorySegment::isReadOnly`. Previously an `UnsupportedOperationException` >> was specified

Re: RFR: 8321387: SegmentAllocator:allocateFrom(AddressLayout, MemorySegment) does not throw stated UnsupportedOperationException [v3]

2023-12-06 Thread Maurizio Cimadamore
On Wed, 6 Dec 2023 15:32:54 GMT, Per Minborg wrote: >> This PR proposes to change the exception type for exceptions thrown for >> certain methods with a parameter of type `MemorySegment` when it is >> `MemorySegment::isReadOnly`. Previously an `UnsupportedOperationException` >> was specified

Re: RFR: 8321248: ClassFile API ClassModel::verify is inconsistent with the rest of the API [v2]

2023-12-06 Thread Maurizio Cimadamore
On Wed, 6 Dec 2023 10:40:51 GMT, Adam Sotona wrote: >> ClassFile API `ClassModel::verify` accepts `ClassHierarchyResolver` as an >> optional argument and does not respect >> `ClassFile.ClassHierarchyResolverOption` of the actual context. >> Parsing, building and transforming take options from

Re: RFR: 8321387: SegmentAllocator:allocateFrom(AddressLayout, MemorySegment) does not throw stated UnsupportedOperationException

2023-12-06 Thread Maurizio Cimadamore
On Wed, 6 Dec 2023 14:09:31 GMT, Maurizio Cimadamore wrote: >> src/java.base/share/classes/java/lang/invoke/X-VarHandleSegmentView.java.template >> line 153: >> >>> 151: static void set(VarHandle ob, Object obb, long base, $type$ value) >>> { >&

Re: RFR: 8321387: SegmentAllocator:allocateFrom(AddressLayout, MemorySegment) does not throw stated UnsupportedOperationException

2023-12-06 Thread Maurizio Cimadamore
On Wed, 6 Dec 2023 14:06:00 GMT, Maurizio Cimadamore wrote: >> This PR proposes to change the exception type for exceptions thrown for >> certain methods with a parameter of type `MemorySegment` when it is >> `MemorySegment::isReadOnly`. Previously an `Unsupported

Re: RFR: 8321387: SegmentAllocator:allocateFrom(AddressLayout, MemorySegment) does not throw stated UnsupportedOperationException

2023-12-06 Thread Maurizio Cimadamore
On Wed, 6 Dec 2023 13:52:37 GMT, Per Minborg wrote: > This PR proposes to change the exception type for exceptions thrown for > certain methods with a parameter of type `MemorySegment` when it is > `MemorySegment::isReadOnly`. Previously an `UnsupportedOperationException` > was specified but

Re: RFR: 8321387: SegmentAllocator:allocateFrom(AddressLayout, MemorySegment) does not throw stated UnsupportedOperationException

2023-12-06 Thread Maurizio Cimadamore
On Wed, 6 Dec 2023 13:52:37 GMT, Per Minborg wrote: > This PR proposes to change the exception type for exceptions thrown for > certain methods with a parameter of type `MemorySegment` when it is > `MemorySegment::isReadOnly`. Previously an `UnsupportedOperationException` > was specified but

Re: RFR: 8321248: ClassFile API ClassModel::verify is inconsistent with the rest of the API

2023-12-06 Thread Maurizio Cimadamore
On Mon, 4 Dec 2023 11:12:37 GMT, Adam Sotona wrote: > ClassFile API `ClassModel::verify` accepts `ClassHierarchyResolver` as an > optional argument and does not respect > `ClassFile.ClassHierarchyResolverOption` of the actual context. > Parsing, building and transforming take options from the

Re: RFR: 8321159: SymbolLookup.libraryLookup(Path, Arena) Assumes default Filesystem [v5]

2023-12-05 Thread Maurizio Cimadamore
On Tue, 5 Dec 2023 12:02:59 GMT, Per Minborg wrote: >> This PR proposes to reject paths provided to the >> `SymbolLookup.libraryLookup(Path path, Arena arena)` method if a path is not >> in the default file system. > > Per Minborg has updated the pull request incrementally with one additional

Re: RFR: 8321159: SymbolLookup.libraryLookup(Path, Arena) Assumes default Filesystem [v4]

2023-12-05 Thread Maurizio Cimadamore
On Tue, 5 Dec 2023 07:16:49 GMT, Per Minborg wrote: >> This PR proposes to reject paths provided to the >> `SymbolLookup.libraryLookup(Path path, Arena arena)` method if a path is not >> in the default file system. > > Per Minborg has updated the pull request incrementally with one additional

Re: RFR: 8321223: Implementation of Scoped Values (Second Preview)

2023-12-05 Thread Maurizio Cimadamore
On Sun, 3 Dec 2023 08:46:07 GMT, Alan Bateman wrote: > This API is sitting out JDK 22, meaning no API/implementation changes in this > PR. Some small API changes are likely for JDK 23. > > For now, we just need to bump JEP number/title that shows up in the preview > section of the javadoc.

Re: RFR: 8321159: SymbolLookup.libraryLookup(Path, Arena) Assumes default Filesystem [v4]

2023-12-05 Thread Maurizio Cimadamore
On Tue, 5 Dec 2023 07:16:49 GMT, Per Minborg wrote: >> This PR proposes to reject paths provided to the >> `SymbolLookup.libraryLookup(Path path, Arena arena)` method if a path is not >> in the default file system. > > Per Minborg has updated the pull request incrementally with one additional

Re: RFR: 8321130: Microbenchmarks do not build any more after 8254693 on 32 bit platforms

2023-11-30 Thread Maurizio Cimadamore
On Thu, 30 Nov 2023 20:59:01 GMT, Jorn Vernee wrote: > Need to use `jlong_to_ptr` instead of raw cast. > > I've also fixed another latent issue in `CLayouts` where we were initializing > `C_LONG_LONG` with the `long` layout. This was resulting in a class cast > exception when running the

Re: RFR: 8318586: Explicitly handle upcall stub allocation failure [v6]

2023-11-30 Thread Maurizio Cimadamore
On Thu, 2 Nov 2023 23:19:24 GMT, Jorn Vernee wrote: >> Explicitly handle UpcallStub allocation failures by terminating. We >> currently might try to use the returned `nullptr` which would fail sooner or >> later. This patch just makes the termination explicit. > > Jorn Vernee has updated the

Re: RFR: 8320440: Implementation of Structured Concurrency (Second Preview)

2023-11-28 Thread Maurizio Cimadamore
On Mon, 20 Nov 2023 19:48:20 GMT, Alan Bateman wrote: > This API is sitting out JDK 22, meaning no API/implementation changes in this > PR. We expect this API to do a third preview in JDK 23 with some API changes. > > So for now, we just need to bump JEP number/title that shows up in the >

Re: RFR: 8310644: Make panama memory segment close use async handshakes [v5]

2023-11-27 Thread Maurizio Cimadamore
On Fri, 24 Nov 2023 18:30:17 GMT, Erik Ă–sterlund wrote: >> The current logic for closing memory in panama today is susceptible to live >> lock if we have a closing thread that wants to close the memory in a loop >> that keeps failing, and a bunch of accessing threads that want to perform >>

Integrated: 8319928: Exceptions thrown by cleanup actions should be handled correctly

2023-11-20 Thread Maurizio Cimadamore
On Fri, 10 Nov 2023 16:34:11 GMT, Maurizio Cimadamore wrote: > This simplePR tweaks the factory which wraps custom cleanup actions passed to > `MemorySegment::reinterpret`, so that any exception thrown by the custom > cleanup is swallowed when the arena is closed. > &

Re: RFR: 8319928: Exceptions thrown by cleanup actions should be handled correctly [v6]

2023-11-20 Thread Maurizio Cimadamore
icit > session (as implicit sessions are backed by a `Cleaner`, there is no way for > cleanup exception to bubble up). Maurizio Cimadamore 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 m

Re: RFR: JDK-8315458 Implement JEP 463: Implicitly Declared Classes and Instance Main Method (Second Preview) [v21]

2023-11-20 Thread Maurizio Cimadamore
On Mon, 20 Nov 2023 11:53:35 GMT, Maurizio Cimadamore wrote: >> Jim Laskey has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Allow nested class of same name as file >> >> Since it doesn't c

Re: RFR: JDK-8315458 Implement JEP 463: Implicitly Declared Classes and Instance Main Method (Second Preview) [v21]

2023-11-20 Thread Maurizio Cimadamore
On Fri, 17 Nov 2023 13:56:13 GMT, Jim Laskey wrote: >> Address changes from JEP 445 to JEP 463. >> >> - Move from a SYNTHETIC unnamed class to a MANDATED implicit class. >> >> - Don't mark class on read. >> >> - Remove reflection and annotation processing related to unnamed classes. >> >> -

Re: RFR: 8318966: Some methods make promises about Java array element alignment that are too strong

2023-11-16 Thread Maurizio Cimadamore
On Thu, 16 Nov 2023 17:34:40 GMT, Paul Sandoz wrote: >> See the JBS issue for an extended problem description. >> >> This patch changes the specification and implementation of >> `MethodHandles::byteArrayViewVarHandle`, >> `MethodHandles::byteBufferViewVarHandle`, `ByteBuffer::alignedSlice`,

Re: RFR: 8318966: Some methods make promises about Java array element alignment that are too strong

2023-11-16 Thread Maurizio Cimadamore
On Thu, 16 Nov 2023 19:15:25 GMT, Jorn Vernee wrote: >> But... surely if I'm just accessing bytes the access cannot possibly be >> mis-aligned? > > Right. I think there is a difference between 'unaligned' and 'misaligned'. > Unaligned means there is no effort made to align the access (so it

Re: RFR: 8319928: Exceptions thrown by cleanup actions should be handled correctly [v5]

2023-11-16 Thread Maurizio Cimadamore
icit > session (as implicit sessions are backed by a `Cleaner`, there is no way for > cleanup exception to bubble up). Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision: Add test to check for self-suppression --

Re: RFR: 8319928: Exceptions thrown by cleanup actions should be handled correctly [v3]

2023-11-16 Thread Maurizio Cimadamore
On Thu, 16 Nov 2023 18:27:36 GMT, Jorn Vernee wrote: >> Maurizio Cimadamore has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Address CSR comments > > src/java.base/share/classes/jdk/internal/foreign/Memo

Re: RFR: 8319928: Exceptions thrown by cleanup actions should be handled correctly [v4]

2023-11-16 Thread Maurizio Cimadamore
icit > session (as implicit sessions are backed by a `Cleaner`, there is no way for > cleanup exception to bubble up). Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision: Drop unused import - Changes: - all: ht

Re: RFR: 8319928: Exceptions thrown by cleanup actions should be handled correctly [v3]

2023-11-16 Thread Maurizio Cimadamore
On Thu, 16 Nov 2023 18:24:44 GMT, Maurizio Cimadamore wrote: >> This simplePR tweaks the factory which wraps custom cleanup actions passed >> to `MemorySegment::reinterpret`, so that any exception thrown by the custom >> cleanup is swallowed when the arena is closed.

Re: RFR: 8319928: Exceptions thrown by cleanup actions should be handled correctly [v3]

2023-11-16 Thread Maurizio Cimadamore
icit > session (as implicit sessions are backed by a `Cleaner`, there is no way for > cleanup exception to bubble up). Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision: Address CSR comments - Ch

Re: RFE: support safely wrapping restricted FFM calls

2023-11-16 Thread Maurizio Cimadamore
On 16/11/2023 16:54, Rob Spoor wrote: Hi Maurizio, I don't think you understand what my module is doing. For instance, it's not specifying the downcall method handles themselves, it's just making it easy to define them. Maybe a small example would show what I'm doing. Consider the

Re: RFE: support safely wrapping restricted FFM calls

2023-11-15 Thread Maurizio Cimadamore
Hi Rob, honestly I think this all looks ok (as in: I don't think you need to do anything in particular). You are writing a library that will need to create some downcall method handles and dereference some pointers. You need unsafe access, so users of your library will need to pass your

Re: RFR: 8319928: Exceptions thrown by cleanup actions should be handled correctly

2023-11-13 Thread Maurizio Cimadamore
On Mon, 13 Nov 2023 16:05:08 GMT, Maurizio Cimadamore wrote: > After some offline discussions, I've decided to add a new exception > (Arena.CleanupException) which is used to wrap custom cleanup action > exceptions and rethrow them on close. To be clear, the reasons as to why the

Re: RFR: 8319928: Exceptions thrown by cleanup actions passed to reinterpreted segments should be ignored

2023-11-13 Thread Maurizio Cimadamore
On Fri, 10 Nov 2023 16:34:11 GMT, Maurizio Cimadamore wrote: > This simplePR tweaks the factory which wraps custom cleanup actions passed to > `MemorySegment::reinterpret`, so that any exception thrown by the custom > cleanup is swallowed when the arena is closed. > &

Re: RFR: 8319928: Exceptions thrown by cleanup actions passed to reinterpreted segments should be ignored [v2]

2023-11-13 Thread Maurizio Cimadamore
icit > session (as implicit sessions are backed by a `Cleaner`, there is no way for > cleanup exception to bubble up). Maurizio Cimadamore has updated the pull request incrementally with three additional commits since the last revision: - More javadoc tweaks - Tweak javadoc - Catch

Re: RFR: 8319928: Exceptions thrown by cleanup actions passed to reinterpreted segments should be ignored

2023-11-13 Thread Maurizio Cimadamore
On Mon, 13 Nov 2023 08:35:21 GMT, Jorn Vernee wrote: > Not sure whether always swallowing the exceptions is the right move... it > seems like an advantage that explicit arenas _can_ report exceptions thrown > by cleanup actions. Silently ignoring exceptions seems bad, but something > that is

Re: RFR: 8319928: Exceptions thrown by cleanup actions passed to reinterpreted segments should be ignored

2023-11-10 Thread Maurizio Cimadamore
On Fri, 10 Nov 2023 16:59:09 GMT, Alan Bateman wrote: > @tprinzing This may be an area that you want to look at sometime to see if a > JFR event might make sense. Might make sense - I suggest that should be done also for Cleaner - as that's using same mechanism (and no JFR events)

RFR: 8319928: Exceptions thrown by cleanup actions passed to reinterpreted segments should be ignored

2023-11-10 Thread Maurizio Cimadamore
This simplePR tweaks the factory which wraps custom cleanup actions passed to `MemorySegment::reinterpret`, so that any exception thrown by the custom cleanup is swallowed when the arena is closed. This aligns the behavior of confined/shared session with that of implicit session (as implicit

Re: RFR: 8319820: Use unnamed variables in the FFM implementation

2023-11-10 Thread Maurizio Cimadamore
On Fri, 10 Nov 2023 07:19:42 GMT, Per Minborg wrote: > This PR proposes to use unnamed variables now that they have become available > in Java. > > There is also a cosmetic cleanup making a switch rake smaller and where > variables are pre-calculated rather than spreading expressions around.

Re: RFR: 8319882: SequenceLayout::toString throws ArithmeticException

2023-11-10 Thread Maurizio Cimadamore
On Fri, 10 Nov 2023 09:31:29 GMT, Per Minborg wrote: > This PR proposes to fix a problem where a sequence layout contains an element > of `byteSize()` zero. Marked as reviewed by mcimadamore (Reviewer). src/java.base/share/classes/jdk/internal/foreign/layout/SequenceLayoutImpl.java line 182:

Re: RFR: 8254693: Add Panama feature to pass heap segments to native code [v12]

2023-11-09 Thread Maurizio Cimadamore
On Thu, 9 Nov 2023 15:34:38 GMT, Jorn Vernee wrote: >> src/java.base/share/classes/java/lang/foreign/Linker.java line 792: >> >>> 790: * @param allowHeapAccess whether the linked function should >>> allow access to the Java heap. >>> 791: */ >>> 792: static Option

Re: RFR: 8319324: FFM: Reformat javadocs [v13]

2023-11-09 Thread Maurizio Cimadamore
On Thu, 9 Nov 2023 14:21:57 GMT, Per Minborg wrote: >> This PR proposes to reformat all the JavaDocs for the FFM API. This would >> bring the FFM API docs more in line with the existing Java documentation >> (see below). Occasional drive-by fixes are also included in this PR (such >> as

Re: RFR: 8319324: FFM: Reformat javadocs [v12]

2023-11-09 Thread Maurizio Cimadamore
On Thu, 9 Nov 2023 13:07:24 GMT, Per Minborg wrote: >> This PR proposes to reformat all the JavaDocs for the FFM API. This would >> bring the FFM API docs more in line with the existing Java documentation >> (see below). Occasional drive-by fixes are also included in this PR (such >> as

Re: RFR: 8319324: FFM: Reformat javadocs [v11]

2023-11-09 Thread Maurizio Cimadamore
On Thu, 9 Nov 2023 12:31:16 GMT, Per Minborg wrote: >> This PR proposes to reformat all the JavaDocs for the FFM API. This would >> bring the FFM API docs more in line with the existing Java documentation >> (see below). Occasional drive-by fixes are also included in this PR (such >> as

Re: RFR: 8319324: FFM: Reformat javadocs [v11]

2023-11-09 Thread Maurizio Cimadamore
On Thu, 9 Nov 2023 12:31:16 GMT, Per Minborg wrote: >> This PR proposes to reformat all the JavaDocs for the FFM API. This would >> bring the FFM API docs more in line with the existing Java documentation >> (see below). Occasional drive-by fixes are also included in this PR (such >> as

Re: RFR: 8319324: FFM: Reformat javadocs [v10]

2023-11-08 Thread Maurizio Cimadamore
On Wed, 8 Nov 2023 09:03:12 GMT, Per Minborg wrote: >> This PR proposes to reformat all the JavaDocs for the FFM API. This would >> bring the FFM API docs more in line with the existing Java documentation >> (see below). Occasional drive-by fixes are also included in this PR (such >> as

Re: RFR: 8319556: Harmonize interface formatting in the FFM API [v3]

2023-11-07 Thread Maurizio Cimadamore
On Tue, 7 Nov 2023 16:32:43 GMT, Per Minborg wrote: >> This PR proposes to remove two `permits` declarations where the line >> overflows the stipulated maximum column with. Also, it proposes to harmonize >> the layout of `permit` formatting so they are the the same throughout the >> API. >>

Re: RFR: 8319556: Harmonize interface formatting in the FFM API [v2]

2023-11-07 Thread Maurizio Cimadamore
On Tue, 7 Nov 2023 15:11:25 GMT, Per Minborg wrote: > Hrmm. I reformatted all classes of the same category where at least one of > them needed reformatting to make it more consistent. For example: `OfBoolean` > overflows but not `OfByte`. So, all of the of* were consistently reformatted. >

Re: RFR: 8319556: Harmonize interface formatting in the FFM API [v2]

2023-11-07 Thread Maurizio Cimadamore
On Tue, 7 Nov 2023 11:41:06 GMT, Per Minborg wrote: >> This PR proposes to remove two `permits` declarations where the line >> overflows the stipulated maximum column with. Also, it proposes to harmonize >> the layout of `permit` formatting so they are the the same throughout the >> API. >>

Re: RFR: 8319563: Reformat code in the FFM API

2023-11-07 Thread Maurizio Cimadamore
On Mon, 6 Nov 2023 21:07:22 GMT, Per Minborg wrote: > This PR proposes to reformat a small number of code line for better > appearance. Marked as reviewed by mcimadamore (Reviewer). - PR Review: https://git.openjdk.org/jdk/pull/16529#pullrequestreview-1717461495

Re: RFR: 8319556: Harmonize interface formatting in the FFM API

2023-11-07 Thread Maurizio Cimadamore
On Mon, 6 Nov 2023 21:05:58 GMT, Per Minborg wrote: > This PR proposes to remove two `permits` declarations where the line > overflows the stipulated maximum column with. Also, it proposes to harmonize > the layout of `permit` formatting so they are the the same throughout the API. > > This

Re: RFR: 8319560: Reformat method parameters in the FFM API

2023-11-07 Thread Maurizio Cimadamore
On Mon, 6 Nov 2023 21:00:10 GMT, Per Minborg wrote: > This PR proposes to reformat some method parameters in the FFM API. The > proposed changes are a bit opinion based eve though there are some underlying > principles. Marked as reviewed by mcimadamore (Reviewer). - PR Review:

Re: RFR: 8319607: FFM: Review the language in the FFM documentation [v2]

2023-11-07 Thread Maurizio Cimadamore
On Tue, 7 Nov 2023 11:23:58 GMT, Per Minborg wrote: >> This PR proposes to improve the language used in the FFM specification. >> There is a relatively small number of corrections. >> >> One peculiarity with the English language is the distinction between "that" >> (to be used in a

Re: RFR: 8319607: FFM: Review the language in the FFM documentation

2023-11-07 Thread Maurizio Cimadamore
On Tue, 7 Nov 2023 09:31:11 GMT, Per Minborg wrote: > This PR proposes to improve the language used in the FFM specification. There > is a relatively small number of corrections. > > One peculiarity with the English language is the distinction between "that" > (to be used in a restrictive

Re: RFR: 8319607: FFM: Review the language in the FFM documentation

2023-11-07 Thread Maurizio Cimadamore
On Tue, 7 Nov 2023 09:31:11 GMT, Per Minborg wrote: > This PR proposes to improve the language used in the FFM specification. There > is a relatively small number of corrections. > > One peculiarity with the English language is the distinction between "that" > (to be used in a restrictive

Re: RFR: 8319324: FFM: Reformat javadocs [v9]

2023-11-06 Thread Maurizio Cimadamore
On Mon, 6 Nov 2023 20:08:45 GMT, Per Minborg wrote: >> This PR proposes to reformat all the JavaDocs for the FFM API. This would >> bring the FFM API docs more in line with the existing Java documentation >> (see below). Occasional drive-by fixes are also included in this PR (such >> as

Re: RFR: 8319324: FFM: Reformat javadocs [v8]

2023-11-06 Thread Maurizio Cimadamore
On Mon, 6 Nov 2023 17:35:31 GMT, Per Minborg wrote: >> This PR proposes to reformat all the JavaDocs for the FFM API. This would >> bring the FFM API docs more in line with the existing Java documentation >> (see below). Occasional drive-by fixes are also included in this PR (such >> as

Re: RFR: 8319324: FFM: Reformat javadocs [v8]

2023-11-06 Thread Maurizio Cimadamore
On Mon, 6 Nov 2023 17:35:31 GMT, Per Minborg wrote: >> This PR proposes to reformat all the JavaDocs for the FFM API. This would >> bring the FFM API docs more in line with the existing Java documentation >> (see below). Occasional drive-by fixes are also included in this PR (such >> as

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

2023-11-06 Thread Maurizio Cimadamore
On Fri, 3 Nov 2023 12:40:48 GMT, Jim Laskey wrote: >> Address changes from JEP 445 to JEP 463. >> >> - Move from a SYNTHETIC unnamed class to a MANDATED implicit class. >> >> - Don't mark class on read. >> >> - Remove reflection and annotation processing related to unnamed classes. >> >> -

Re: RFR: 8319324: FFM: Reformat javadocs [v3]

2023-11-06 Thread Maurizio Cimadamore
On Mon, 6 Nov 2023 10:10:41 GMT, Per Minborg wrote: >> This PR proposes to reformat all the JavaDocs for the FFM API. This would >> bring the FFM API docs more in line with the existing Java documentation >> (see below). Occasional drive-by fixes are also included in this PR (such >> as

Re: RFR: 8319324: FFM: Reformat javadocs [v2]

2023-11-06 Thread Maurizio Cimadamore
On Mon, 6 Nov 2023 08:08:34 GMT, Per Minborg wrote: >> This PR proposes to reformat all the JavaDocs for the FFM API. This would >> bring the FFM API docs more in line with the existing Java documentation >> (see below). Occasional drive-by fixes are also included in this PR (such >> as

Re: RFR: 8319324: FFM: Reformat javadocs [v2]

2023-11-06 Thread Maurizio Cimadamore
On Mon, 6 Nov 2023 08:08:34 GMT, Per Minborg wrote: >> This PR proposes to reformat all the JavaDocs for the FFM API. This would >> bring the FFM API docs more in line with the existing Java documentation >> (see below). Occasional drive-by fixes are also included in this PR (such >> as

Re: RFR: 8319324: FFM: Reformat javadocs [v2]

2023-11-06 Thread Maurizio Cimadamore
On Mon, 6 Nov 2023 08:53:55 GMT, Maurizio Cimadamore wrote: >> Per Minborg 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 contai

Re: RFR: 8319324: FFM: Reformat javadocs [v2]

2023-11-06 Thread Maurizio Cimadamore
On Mon, 6 Nov 2023 08:08:34 GMT, Per Minborg wrote: >> This PR proposes to reformat all the JavaDocs for the FFM API. This would >> bring the FFM API docs more in line with the existing Java documentation >> (see below). Occasional drive-by fixes are also included in this PR (such >> as

Re: RFR: 8319316: Clarify text around which layouts a linker supports [v3]

2023-11-03 Thread Maurizio Cimadamore
mit since the last revision: > > Add 'strict' > > Co-authored-by: Maurizio Cimadamore > <54672762+mcimadam...@users.noreply.github.com> Marked as reviewed by mcimadamore (Reviewer). - PR Review: https://git.openjdk.org/jdk/pull/16485#pullrequestreview-1713318415

Re: RFR: 8319316: Clarify text around which layouts a linker supports [v2]

2023-11-03 Thread Maurizio Cimadamore
On Fri, 3 Nov 2023 16:35:18 GMT, Jorn Vernee wrote: >> - Add linker note about packed structs. >> - Relax language a bit to avoid implying that only listed layouts are >> supported. > > Jorn Vernee has updated the pull request incrementally with one additional > commit since the last revision:

Re: RFR: 8319316: Clarify text around which layouts a linker supports

2023-11-03 Thread Maurizio Cimadamore
On Fri, 3 Nov 2023 00:10:48 GMT, Jorn Vernee wrote: > - Add linker note about packed structs. > - Relax language a bit to avoid implying that only listed layouts are > supported. src/java.base/share/classes/java/lang/foreign/Linker.java line 247: > 245: * > 246: * > 247: * Linker

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

2023-11-02 Thread Maurizio Cimadamore
On Thu, 2 Nov 2023 12:34:49 GMT, Jim Laskey wrote: >> Why is the test removed? > > Since there is no way to detect an implicit class, the test is no longer > relevant. Right, but the test was still checking useful stuff - e.g. like the fact that the class generated by javac was final, etc (in

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

2023-11-02 Thread Maurizio Cimadamore
On Thu, 2 Nov 2023 11:53:09 GMT, Jim Laskey wrote: >> src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java >> line 4057: >> >>> 4055: Name name = names.fromString(simplename); >>> 4056: JCModifiers implicitMods = F.at(Position.NOPOS) >>> 4057:

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

2023-11-02 Thread Maurizio Cimadamore
On Thu, 2 Nov 2023 11:55:17 GMT, Jim Laskey wrote: >> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java line 442: >> >>> 440: Errors.ClassPublicShouldBeInFile(topElement, >>> tree.name)); >>> 441: } >>> 442: if

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

2023-11-02 Thread Maurizio Cimadamore
On Thu, 2 Nov 2023 11:57:09 GMT, Jim Laskey wrote: >> test/langtools/tools/javac/processing/model/element/TestUnnamedClass.java >> line 1: >> >>> 1: /* >> >> Is the implicit class no longer discoverable through annotation processing? > > The class is discoverable but only as a regular class.

Re: RFR: 8319166: Typos in the JavaDocs for MemorySegment

2023-11-02 Thread Maurizio Cimadamore
On Thu, 2 Nov 2023 07:40:52 GMT, Per Minborg wrote: > This PR proposes to fix a number of JavaDoc typos in the > `MemorySegment::getAtIndex` and `::setAtIndex`. Marked as reviewed by mcimadamore (Reviewer). - PR Review:

Re: RFR: 8319166: Typos in the JavaDocs for MemorySegment

2023-11-02 Thread Maurizio Cimadamore
On Thu, 2 Nov 2023 11:50:13 GMT, Per Minborg wrote: >> This PR proposes to fix a number of JavaDoc typos in the >> `MemorySegment::getAtIndex` and `::setAtIndex`. > > src/java.base/share/classes/java/lang/foreign/MemorySegment.java line 2014: > >> 2012: * @throws IllegalArgumentException

Re: RFR: 8319166: Typos in the JavaDocs for MemorySegment

2023-11-02 Thread Maurizio Cimadamore
On Thu, 2 Nov 2023 07:40:52 GMT, Per Minborg wrote: > This PR proposes to fix a number of JavaDoc typos in the > `MemorySegment::getAtIndex` and `::setAtIndex`. src/java.base/share/classes/java/lang/foreign/MemorySegment.java line 1997: > 1995: * @throws IndexOutOfBoundsException if

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

2023-11-02 Thread Maurizio Cimadamore
On Wed, 1 Nov 2023 19:14:22 GMT, Jim Laskey wrote: >> Address changes from JEP 445 to JEP 463. >> >> - Move from a SYNTHETIC unnamed class to a MANDATED implicit class. >> >> - Don't mark class on read. >> >> - Remove reflection and annotation processing related to unnamed classes. >> >> -

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

2023-11-02 Thread Maurizio Cimadamore
On Wed, 1 Nov 2023 19:14:22 GMT, Jim Laskey wrote: >> Address changes from JEP 445 to JEP 463. >> >> - Move from a SYNTHETIC unnamed class to a MANDATED implicit class. >> >> - Don't mark class on read. >> >> - Remove reflection and annotation processing related to unnamed classes. >> >> -

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

2023-11-02 Thread Maurizio Cimadamore
On Wed, 1 Nov 2023 19:14:22 GMT, Jim Laskey wrote: >> Address changes from JEP 445 to JEP 463. >> >> - Move from a SYNTHETIC unnamed class to a MANDATED implicit class. >> >> - Don't mark class on read. >> >> - Remove reflection and annotation processing related to unnamed classes. >> >> -

Integrated: 8319211: Regression in LoopOverNonConstantFP

2023-11-01 Thread Maurizio Cimadamore
On Wed, 1 Nov 2023 14:10:10 GMT, Maurizio Cimadamore wrote: > This PR fixes an inexact var handle call that sneaked in as part of > https://git.openjdk.org/jdk/pull/16224. > > As some default methods were moved from `MemorySegment` to > `AbstractMemorySegmentImpl`, the typ

RFR: 8319211: Regression in LoopOverNonConstantFP

2023-11-01 Thread Maurizio Cimadamore
This PR fixes an inexact var handle call that sneaked in as part of https://git.openjdk.org/jdk/pull/16224. As some default methods were moved from `MemorySegment` to `AbstractMemorySegmentImpl`, the type of `this` has changed, and this made all the var handle calls in the memory segment

Re: RFR: 8318586: Explicitly handle upcall stub allocation failure [v3]

2023-10-27 Thread Maurizio Cimadamore
On Fri, 27 Oct 2023 04:54:04 GMT, David Holmes wrote: >> src/java.base/share/classes/java/lang/foreign/Linker.java line 532: >> >>> 530: * @throws IllegalArgumentException if an invalid combination of >>> linker options is given. >>> 531: * @throws IllegalCallerException If the

Re: RFR: 8318586: Explicitly handle upcall stub allocation failure [v3]

2023-10-27 Thread Maurizio Cimadamore
On Fri, 27 Oct 2023 04:54:04 GMT, David Holmes wrote: >> src/java.base/share/classes/java/lang/foreign/Linker.java line 532: >> >>> 530: * @throws IllegalArgumentException if an invalid combination of >>> linker options is given. >>> 531: * @throws IllegalCallerException If the

Re: RFR: 8318678: Vector access on heap MemorySegments only works for byte[] [v2]

2023-10-26 Thread Maurizio Cimadamore
On Thu, 26 Oct 2023 09:17:25 GMT, Per Minborg wrote: >> This PR proposes removing the restriction that only heap `MemorySegment` >> wrapping a `byte` array can be accessed by Vectors. Now any array type can >> be used provided the element alignment constraints are respected. > > Per Minborg

Re: RFR: 8318586: Explicitly handle upcall stub allocation failure [v2]

2023-10-25 Thread Maurizio Cimadamore
On Wed, 25 Oct 2023 10:10:57 GMT, Jorn Vernee wrote: >> Explicitly handle UpcallStub allocation failures by terminating. We >> currently might try to use the returned `nullptr` which would fail sooner or >> later. This patch just makes the termination explicit. > > Jorn Vernee has updated the

Re: RFR: 8318678: Vector access on heap MemorySegments only works for byte[]

2023-10-25 Thread Maurizio Cimadamore
On Wed, 25 Oct 2023 13:08:06 GMT, Per Minborg wrote: > This PR proposes removing the restriction that only heap `MemorySegment` > wrapping a `byte` array can be accessed by Vectors. Now any array type can be > used provided the element alignment constraints are respected.

Re: RFR: 8318678: Vector access on heap MemorySegments only works for byte[]

2023-10-25 Thread Maurizio Cimadamore
On Wed, 25 Oct 2023 13:08:06 GMT, Per Minborg wrote: > This PR proposes removing the restriction that only heap `MemorySegment` > wrapping a `byte` array can be accessed by Vectors. Now any array type can be > used provided the element alignment constraints are respected.

Re: RFR: 8318678: Vector access on heap MemorySegments only works for byte[]

2023-10-25 Thread Maurizio Cimadamore
On Wed, 25 Oct 2023 13:08:06 GMT, Per Minborg wrote: > This PR proposes removing the restriction that only heap `MemorySegment` > wrapping a `byte` array can be accessed by Vectors. Now any array type can be > used provided the element alignment constraints are respected.

Re: RFR: 8254693: Add Panama feature to pass heap segments to native code [v12]

2023-10-24 Thread Maurizio Cimadamore
On Tue, 24 Oct 2023 15:09:57 GMT, Jorn Vernee wrote: >> Add the ability to pass heap segments to native code. This requires using >> `Linker.Option.critical(true)` as a linker option. It has the same >> limitations as normal critical calls, namely: upcalls into Java are not >> allowed, and

Re: RFR: 8316046: x64 platforms unecessarily save xmm16-31 when UseAVX >= 3

2023-10-23 Thread Maurizio Cimadamore
On Mon, 23 Oct 2023 11:37:08 GMT, Jorn Vernee wrote: > See JBS issue. We don't need to save xmm16+ on x64 platforms (which are > currently saved in FFM upcall stubs). This is achieved simply by adding these > registers to the volatile register lists of both ABIs. > > Related:

Re: RFR: 8254693: Add Panama feature to pass heap segments to native code [v11]

2023-10-23 Thread Maurizio Cimadamore
On Mon, 23 Oct 2023 11:29:28 GMT, Jorn Vernee wrote: > We could add a line to `donwcallHandle` that says that the returned handle > throws an `IllegalArgumentException` if a heap segment is passed, unless heap > segments are explicitly allowed through the `critical(true)` option. Something

Re: RFR: 8254693: Add Panama feature to pass heap segments to native code [v11]

2023-10-23 Thread Maurizio Cimadamore
On Sat, 21 Oct 2023 12:04:10 GMT, Jorn Vernee wrote: >> Add the ability to pass heap segments to native code. This requires using >> `Linker.Option.critical(true)` as a linker option. It has the same >> limitations as normal critical calls, namely: upcalls into Java are not >> allowed, and

Integrated: 8318601: Remove javadoc text about restricted methods

2023-10-20 Thread Maurizio Cimadamore
On Fri, 20 Oct 2023 13:59:16 GMT, Maurizio Cimadamore wrote: > This simple PR removes the extra verbiage from the javadoc of all the > restricted methods. > Since now javadoc will automatically generate better "bubbles" for restricted > methods, this wording is no longer

RFR: 8318601: Remove javadoc text about restricted methods

2023-10-20 Thread Maurizio Cimadamore
This simple PR removes the extra verbiage from the javadoc of all the restricted methods. Since now javadoc will automatically generate better "bubbles" for restricted methods, this wording is no longer necessary. - Commit messages: - Initial push Changes:

Re: RFR: 8318598: FFM stylistic cleanups

2023-10-20 Thread Maurizio Cimadamore
On Fri, 20 Oct 2023 13:35:59 GMT, Jorn Vernee wrote: > Port over stylistic changes from the panama-foreign repo. The following PRs > are included: > > - https://github.com/openjdk/panama-foreign/pull/863 > - https://github.com/openjdk/panama-foreign/pull/888 > -

Re: RFR: 8318538: Add a way to obtain a strided var handle from a layout [v3]

2023-10-20 Thread Maurizio Cimadamore
od generalizes the old method > in the 21 API, and is implemented in the obvious way, using a combinator (see > above). > > This PR also adds a lot of narrative text to describe how to deal with > variable-length arrays, which should clarify the role of the new method. Maurizio Cimadamor

Integrated: 8318538: Add a way to obtain a strided var handle from a layout

2023-10-20 Thread Maurizio Cimadamore
On Thu, 19 Oct 2023 16:52:53 GMT, Maurizio Cimadamore wrote: > The 21 iteration of the FFM API used to contain a method, namely > `ValueLayout::arrayElementVarHandle`. This var handle factory was useful when > accessing elements in a flat array of variable size. > > In 22,

<    1   2   3   4   5   6   7   8   9   10   >