Re: RFR: 8308753: Class-File API transition to Preview [v3]

2023-10-02 Thread Maurizio Cimadamore
On Mon, 2 Oct 2023 08:34:19 GMT, Adam Sotona wrote: >> Classfile API is an internal library under package `jdk.internal.classfile`  >> in JDK 21. >> This pull request turns the Classfile API into a preview feature and moves >> it into `java.lang.classfile`. >> It repackages all uses across JDK a

Re: RFR: 8303374: Compiler Implementation for Primitive types in patterns, instanceof, and switch (Preview) [v3]

2023-10-02 Thread Maurizio Cimadamore
On Mon, 2 Oct 2023 14:47:59 GMT, Aggelos Biboudis wrote: >> This is the first draft of a patch for Primitive types in patterns, >> instanceof, and switch (Preview). >> >> Draft spec here: >> https://cr.openjdk.org/~abimpoudis/instanceof/instanceof-20230913/specs/instanceof-jls.html > > Aggelo

Re: RFR: 8303374: Compiler Implementation for Primitive types in patterns, instanceof, and switch (Preview) [v3]

2023-10-02 Thread Maurizio Cimadamore
On Mon, 2 Oct 2023 14:47:59 GMT, Aggelos Biboudis wrote: >> This is the first draft of a patch for Primitive types in patterns, >> instanceof, and switch (Preview). >> >> Draft spec here: >> https://cr.openjdk.org/~abimpoudis/instanceof/instanceof-20230913/specs/instanceof-jls.html > > Aggelo

Re: RFR: 8303374: Compiler Implementation for Primitive types in patterns, instanceof, and switch (Preview) [v3]

2023-10-02 Thread Maurizio Cimadamore
On Mon, 2 Oct 2023 14:47:59 GMT, Aggelos Biboudis wrote: >> This is the first draft of a patch for Primitive types in patterns, >> instanceof, and switch (Preview). >> >> Draft spec here: >> https://cr.openjdk.org/~abimpoudis/instanceof/instanceof-20230913/specs/instanceof-jls.html > > Aggelo

Re: RFR: 8303374: Compiler Implementation for Primitive types in patterns, instanceof, and switch (Preview) [v3]

2023-10-03 Thread Maurizio Cimadamore
On Mon, 2 Oct 2023 17:42:39 GMT, Maurizio Cimadamore wrote: >> Aggelos Biboudis 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: 8303374: Compiler Implementation for Primitive types in patterns, instanceof, and switch (Preview) [v3]

2023-10-03 Thread Maurizio Cimadamore
On Mon, 2 Oct 2023 14:47:59 GMT, Aggelos Biboudis wrote: >> This is the first draft of a patch for Primitive types in patterns, >> instanceof, and switch (Preview). >> >> Draft spec here: >> https://cr.openjdk.org/~abimpoudis/instanceof/instanceof-20230913/specs/instanceof-jls.html > > Aggelo

Re: RFR: 8303374: Compiler Implementation for Primitive types in patterns, instanceof, and switch (Preview) [v3]

2023-10-03 Thread Maurizio Cimadamore
On Mon, 2 Oct 2023 14:47:59 GMT, Aggelos Biboudis wrote: >> This is the first draft of a patch for Primitive types in patterns, >> instanceof, and switch (Preview). >> >> Draft spec here: >> https://cr.openjdk.org/~abimpoudis/instanceof/instanceof-20230913/specs/instanceof-jls.html > > Aggelo

Re: RFR: 8303374: Compiler Implementation for Primitive types in patterns, instanceof, and switch (Preview) [v3]

2023-10-03 Thread Maurizio Cimadamore
On Tue, 3 Oct 2023 08:58:55 GMT, Maurizio Cimadamore wrote: >> Aggelos Biboudis 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: 8303374: Compiler Implementation for Primitive types in patterns, instanceof, and switch (Preview) [v3]

2023-10-03 Thread Maurizio Cimadamore
On Mon, 2 Oct 2023 14:47:59 GMT, Aggelos Biboudis wrote: >> This is the first draft of a patch for Primitive types in patterns, >> instanceof, and switch (Preview). >> >> Draft spec here: >> https://cr.openjdk.org/~abimpoudis/instanceof/instanceof-20230913/specs/instanceof-jls.html > > Aggelo

Re: RFR: 8303374: Compiler Implementation for Primitive types in patterns, instanceof, and switch (Preview) [v3]

2023-10-03 Thread Maurizio Cimadamore
On Mon, 2 Oct 2023 14:47:59 GMT, Aggelos Biboudis wrote: >> This is the first draft of a patch for Primitive types in patterns, >> instanceof, and switch (Preview). >> >> Draft spec here: >> https://cr.openjdk.org/~abimpoudis/instanceof/instanceof-20230913/specs/instanceof-jls.html > > Aggelo

Re: RFR: 8303374: Compiler Implementation for Primitive types in patterns, instanceof, and switch (Preview) [v3]

2023-10-03 Thread Maurizio Cimadamore
On Mon, 2 Oct 2023 14:47:59 GMT, Aggelos Biboudis wrote: >> This is the first draft of a patch for Primitive types in patterns, >> instanceof, and switch (Preview). >> >> Draft spec here: >> https://cr.openjdk.org/~abimpoudis/instanceof/instanceof-20230913/specs/instanceof-jls.html > > Aggelo

Re: RFR: 8316971: Add Lint warning for restricted method calls [v4]

2023-10-03 Thread Maurizio Cimadamore
ing: [restricted] MemorySegment.reinterpret(long) is a > restricted method. > Arena.ofAuto().allocate(10).reinterpret(100); > ^ > (Restricted methods are unsafe, and, if used incorrectly, they might crash > the JVM or result in memory corruption)

Re: RFR: 8303374: Compiler Implementation for Primitive types in patterns, instanceof, and switch (Preview) [v3]

2023-10-03 Thread Maurizio Cimadamore
On Tue, 3 Oct 2023 13:19:18 GMT, Aggelos Biboudis wrote: >> src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java line 5052: >> >>> 5050: >>> 5051: return (source.isPrimitive() && target.isPrimitive()) && >>> 5052: ((source.hasTag(BYTE) && !target.hasTag(CH

Integrated: 8316971: Add Lint warning for restricted method calls

2023-10-04 Thread Maurizio Cimadamore
On Thu, 28 Sep 2023 13:13:31 GMT, Maurizio Cimadamore wrote: > This patch adds a new lint warning category, namely `-Xlint:restricted` to > enable warnings on restricted method calls. > > The patch is relatively straightforward: javac marks methods that are marked > with t

Re: RFR: 8303374: Compiler Implementation for Primitive types in patterns, instanceof, and switch (Preview) [v8]

2023-10-05 Thread Maurizio Cimadamore
On Thu, 5 Oct 2023 08:20:58 GMT, Aggelos Biboudis wrote: >> This is the first draft of a patch for Primitive types in patterns, >> instanceof, and switch (Preview). >> >> Draft spec here: >> https://cr.openjdk.org/~abimpoudis/instanceof/instanceof-20230913/specs/instanceof-jls.html > > Aggelo

Re: RFR: 8303374: Compiler Implementation for Primitive types in patterns, instanceof, and switch (Preview) [v8]

2023-10-05 Thread Maurizio Cimadamore
On Thu, 5 Oct 2023 08:20:58 GMT, Aggelos Biboudis wrote: >> This is the first draft of a patch for Primitive types in patterns, >> instanceof, and switch (Preview). >> >> Draft spec here: >> https://cr.openjdk.org/~abimpoudis/instanceof/instanceof-20230913/specs/instanceof-jls.html > > Aggelo

Re: RFR: 8303374: Compiler Implementation for Primitive types in patterns, instanceof, and switch (Preview) [v8]

2023-10-05 Thread Maurizio Cimadamore
On Thu, 5 Oct 2023 08:20:58 GMT, Aggelos Biboudis wrote: >> This is the first draft of a patch for Primitive types in patterns, >> instanceof, and switch (Preview). >> >> Draft spec here: >> https://cr.openjdk.org/~abimpoudis/instanceof/instanceof-20230913/specs/instanceof-jls.html > > Aggelo

Re: RFR: 8303374: Compiler Implementation for Primitive types in patterns, instanceof, and switch (Preview) [v3]

2023-10-06 Thread Maurizio Cimadamore
On Wed, 4 Oct 2023 10:08:31 GMT, Aggelos Biboudis wrote: >> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java line 3001: >> >>> 2999: } >>> 3000: >>> 3001: static class TypePairs { >> >> I believe this could be a record between two TypeSymbols? Then you could >> have

Re: RFR: 8303374: Compiler Implementation for Primitive types in patterns, instanceof, and switch (Preview) [v3]

2023-10-06 Thread Maurizio Cimadamore
On Thu, 5 Oct 2023 14:00:12 GMT, Aggelos Biboudis wrote: >> Refactoring attempt No. 1 complete. I need to recheck the completeness of >> `checkUnconditionallyExact`. In a following commit. > > `checkUnconditionallyExact` and dominance for constants were adjusted > accordingly in > https://git

Re: RFR: 8308753: Class-File API transition to Preview [v19]

2023-10-12 Thread Maurizio Cimadamore
On Wed, 11 Oct 2023 07:17:04 GMT, Adam Sotona wrote: >> Classfile API is an internal library under package `jdk.internal.classfile`  >> in JDK 21. >> This pull request turns the Classfile API into a preview feature and moves >> it into `java.lang.classfile`. >> It repackages all uses across JDK

Re: RFR: 8317824: Beef up javadoc for base offset in var handles derived from layouts (mainline)

2023-10-12 Thread Maurizio Cimadamore
On Tue, 10 Oct 2023 17:58:12 GMT, Jorn Vernee wrote: > Port of: https://github.com/openjdk/panama-foreign/pull/901 > > Original PR body: > >> This PR adds more javadoc to explain how base offsets in var handles >> obtained from layouts can be used. >> >> First, a number of examples in the mai

Re: RFR: 8318072: DonwcallLinker does not acquire/release segments in interpreter

2023-10-13 Thread Maurizio Cimadamore
On Fri, 13 Oct 2023 08:00:07 GMT, Jorn Vernee wrote: > Implement missing by-reference argument acquire/release functionality in > DowncallLinker::invokeInterpBindings. > > I've also simplified the related code a bit: > - `retIndexMap` was not used. I've removed it > - `BindingInterpreter.StoreF

Re: RFR: 8317837: Leftover FFM implementation-only changes [v2]

2023-10-13 Thread Maurizio Cimadamore
On Fri, 13 Oct 2023 11:32:09 GMT, Jorn Vernee wrote: >> Port of miscellaneous leftover implementation-only changes from the >> panama-foreign repo: >> >> These four related to improving the performance of the internal `strlen` >> implementation: >> >> - https://github.com/openjdk/panama-for

RFR: 8317819: Scope should reflect lifetime of underying resource (mainline)

2023-10-13 Thread Maurizio Cimadamore
This PR is based on a port of: openjdk/panama-foreign#898 Some additional changes are contained in this PR: * instead of using a different "always alive" scope for zero-length memory segments, we now use the global scope * the javadoc for `MemorySegment::ofArray`, `MemorySegment::ofBuffer` and

Re: RFR: 8317837: Leftover FFM implementation-only changes [v2]

2023-10-13 Thread Maurizio Cimadamore
On Fri, 13 Oct 2023 12:18:59 GMT, Jorn Vernee wrote: >> Port of miscellaneous leftover implementation-only changes from the >> panama-foreign repo: >> >> These four related to improving the performance of the internal `strlen` >> implementation: >> >> - https://github.com/openjdk/panama-for

Re: RFR: 8317837: Leftover FFM implementation-only changes [v2]

2023-10-13 Thread Maurizio Cimadamore
On Fri, 13 Oct 2023 12:18:59 GMT, Jorn Vernee wrote: >> Port of miscellaneous leftover implementation-only changes from the >> panama-foreign repo: >> >> These four related to improving the performance of the internal `strlen` >> implementation: >> >> - https://github.com/openjdk/panama-for

Re: RFR: 8317819: Scope should reflect lifetime of underying resource (mainline) [v2]

2023-10-13 Thread Maurizio Cimadamore
gment::ofArray`, `MemorySegment::ofBuffer` and > `SymbolLookup::loaderLookup` is tweaked to say that the scope associated to > the returned segments is an automatic scope > * the javadoc for `MemorySegment.Scope` defines the concepts of global and > automatic scope, which are then r

RFR: 8317514: Ensure MemorySegment is initialized before touching NativeMemorySegmentImpl

2023-10-13 Thread Maurizio Cimadamore
This PR makes sure that `MemorySegment` is initialized *before* any of its subclasses. This is done by centralizing all the memory segment factories in a single implementation class (`SegmentFactories`). Doing so addresses a possible deadlock condition when using multiple threads. -

Re: RFR: 8317837: Leftover FFM implementation-only changes [v2]

2023-10-13 Thread Maurizio Cimadamore
On Fri, 13 Oct 2023 12:18:59 GMT, Jorn Vernee wrote: >> Port of miscellaneous leftover implementation-only changes from the >> panama-foreign repo: >> >> These four related to improving the performance of the internal `strlen` >> implementation: >> >> - https://github.com/openjdk/panama-for

Re: RFR: 8317819: Scope should reflect lifetime of underying resource (mainline) [v3]

2023-10-13 Thread Maurizio Cimadamore
gment::ofArray`, `MemorySegment::ofBuffer` and > `SymbolLookup::loaderLookup` is tweaked to say that the scope associated to > the returned segments is an automatic scope > * the javadoc for `MemorySegment.Scope` defines the concepts of global and > automatic scope, which are then r

Re: RFR: 8317819: Scope should reflect lifetime of underying resource (mainline) [v3]

2023-10-13 Thread Maurizio Cimadamore
On Fri, 13 Oct 2023 17:10:48 GMT, Maurizio Cimadamore wrote: >> This PR is based on a port of: openjdk/panama-foreign#898 >> >> Some additional changes are contained in this PR: >> >> * instead of using a different "always alive" scope for zero-le

Re: RFR: 8317514: Ensure MemorySegment is initialized before touching NativeMemorySegmentImpl [v2]

2023-10-13 Thread Maurizio Cimadamore
ultiple threads. Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision: Address review comments - Changes: - all: https://git.openjdk.org/jdk/pull/16187/files - new: https://git.openjdk.org/jdk/pull/16187/files/2aad11cf..b9

Integrated: 8317514: Ensure MemorySegment is initialized before touching NativeMemorySegmentImpl

2023-10-13 Thread Maurizio Cimadamore
On Fri, 13 Oct 2023 15:37:00 GMT, Maurizio Cimadamore wrote: > This PR makes sure that `MemorySegment` is initialized *before* any of its > subclasses. > This is done by centralizing all the memory segment factories in a single > implementation class (`SegmentFactories`). > Doi

Re: RFR: 8317545: AIX PPC64: Implementation of Foreign Function & Memory API [v3]

2023-10-16 Thread Maurizio Cimadamore
On Mon, 16 Oct 2023 13:57:11 GMT, Martin Doerr wrote: >> Err, actually using `member.equals(C_DOUBLE)` in the above doesn't work >> since it still checks alignment. What you have with checking for >> `ValueLayout` and `carrier() == double.class` is better, but the byte order >> should also be

RFR: 8318180: Memory model reference from foreign package-info is broken

2023-10-16 Thread Maurizio Cimadamore
This PR fixes a wrong reference to the JLS memory model section. - Commit messages: - Initial push Changes: https://git.openjdk.org/jdk/pull/16204/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=16204&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8318180 Stats: 2 l

Re: RFR: 8318180: Memory model reference from foreign package-info is broken

2023-10-16 Thread Maurizio Cimadamore
On Mon, 16 Oct 2023 16:19:41 GMT, Maurizio Cimadamore wrote: > This PR fixes a wrong reference to the JLS memory model section. The broken reference seems to have originated from a bogus [edit](https://github.com/openjdk/panama-foreign/pull/751/files/4c4928d6c891132face4b78e702bbb611f6a6

Integrated: 8318180: Memory model reference from foreign package-info is broken

2023-10-17 Thread Maurizio Cimadamore
On Mon, 16 Oct 2023 16:19:41 GMT, Maurizio Cimadamore wrote: > This PR fixes a wrong reference to the JLS memory model section. This pull request has now been integrated. Changeset: b2b8db65 Author: Maurizio Cimadamore URL: https://git.openjdk.org/jdk/com

RFR: 8318295: Update launcher help for enable-native-access

2023-10-17 Thread Maurizio Cimadamore
This simple PR updates the description of the `enable-native-access` option in the launcher properties file. - Commit messages: - Initial push Changes: https://git.openjdk.org/jdk/pull/16217/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=16217&range=00 Issue: https://bug

Integrated: 8318295: Update launcher help for enable-native-access

2023-10-17 Thread Maurizio Cimadamore
On Tue, 17 Oct 2023 11:38:17 GMT, Maurizio Cimadamore wrote: > This simple PR updates the description of the `enable-native-access` option > in the launcher properties file. This pull request has now been integrated. Changeset: 39e2b7a6 Author:Maurizio Cimadamore URL:

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

2023-10-18 Thread Maurizio Cimadamore
On Wed, 18 Oct 2023 04:44:26 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 the

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

2023-10-18 Thread Maurizio Cimadamore
On Wed, 18 Oct 2023 04:44:26 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 the

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

2023-10-18 Thread Maurizio Cimadamore
On Wed, 18 Oct 2023 04:44:26 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 the

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

2023-10-18 Thread Maurizio Cimadamore
On Wed, 18 Oct 2023 04:44:26 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 the

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

2023-10-18 Thread Maurizio Cimadamore
On Wed, 18 Oct 2023 04:44:26 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 the

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

2023-10-18 Thread Maurizio Cimadamore
On Wed, 18 Oct 2023 09:25:49 GMT, Jorn Vernee wrote: >> src/java.base/share/classes/java/lang/foreign/Linker.java line 795: >> >>> 793: * memory segments as addresses, where normally only off-heap >>> memory segments would be allowed. The memory region >>> 794: * inside the Ja

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

2023-10-18 Thread Maurizio Cimadamore
On Wed, 18 Oct 2023 09:57:25 GMT, Maurizio Cimadamore wrote: >> I'm not sure what to write to make this clearer. The address that is exposed >> to the native target function is indeed a temporary address that is >> constructed from the oop and offset. It is temp

Re: RFR: 8318363: Foreign benchmarks fail to build on some platforms [v2]

2023-10-18 Thread Maurizio Cimadamore
On Wed, 18 Oct 2023 08:30:37 GMT, Aleksey Shipilev wrote: >> Recent regression, see bug. The fix is to use the proper `jlong <-> ptr` >> converters. >> >> Additional testing: >> - [x] Build now passes on ARM32 >> - [x] Two affected JMH benchmarks still run > > Aleksey Shipilev has updated the

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

2023-10-18 Thread Maurizio Cimadamore
On Wed, 18 Oct 2023 10:48:58 GMT, Jorn Vernee wrote: >> Good point. I made this benchmark a while ago, before we had the more >> optimized allocate variants > > This had a pretty big impact, actually. Especially on the larger sizes: > > > Benchmark (size) Mode Cnt S

RFR: 8318324: Drop redundant default methods from FFM API

2023-10-18 Thread Maurizio Cimadamore
This PR moves turns default methods in `MemorySegment` and `MemoryLayout` into ordinary abstract methods. These interfaces cannot be subclasses by developers (they are sealed), so there is no reson for having default methods there. Also, default methods can have some detrimental effects, as they

Re: RFR: 8318324: Drop redundant default methods from FFM API

2023-10-18 Thread Maurizio Cimadamore
On Wed, 18 Oct 2023 04:06:17 GMT, Jorn Vernee wrote: >> This PR moves turns default methods in `MemorySegment` and `MemoryLayout` >> into ordinary abstract methods. >> These interfaces cannot be subclasses by developers (they are sealed), so >> there is no reson for having default methods there

Re: RFR: 8318324: Drop redundant default methods from FFM API [v2]

2023-10-18 Thread Maurizio Cimadamore
ome detrimental effects, as they cause the interfaces to be initialized > more eagerly. Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision: Address review comments - Changes: - all: https://git.openjdk.org/jdk/pull/1

RFR: 8318458: Update javac and java manpages with restricted method options

2023-10-18 Thread Maurizio Cimadamore
This PR updates the man pages for `javac` and `java` to document: * the new `javac` warning for restricted methods (`-Xlint:restricted`) * the `java` option to allow access to restricted methods without warnings (`--enable-native-access`) - Commit messages: - Initial push Changes:

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

2023-10-18 Thread Maurizio Cimadamore
On Wed, 18 Oct 2023 14:29:01 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 the

Integrated: 8318458: Update javac and java manpages with restricted method options

2023-10-18 Thread Maurizio Cimadamore
On Wed, 18 Oct 2023 15:32:34 GMT, Maurizio Cimadamore wrote: > This PR updates the man pages for `javac` and `java` to document: > * the new `javac` warning for restricted methods (`-Xlint:restricted`) > * the `java` option to allow access to restricted methods without warnings >

Re: RFR: 8317993: Add capturing factories to classes in java.util.function package [v5]

2023-10-18 Thread Maurizio Cimadamore
On Wed, 18 Oct 2023 09:00:09 GMT, Per Minborg wrote: >> This PR proposes to add a number of "capturing factories" in classes in the >> `java.util.function` package. >> >> The PR additionally (an optionally) proposes to add a new function >> `UnaryOperator::andThenUnary` to allow composition wh

Re: RFR: 8317993: Add capturing factories to classes in java.util.function package [v5]

2023-10-18 Thread Maurizio Cimadamore
On Wed, 18 Oct 2023 09:00:09 GMT, Per Minborg wrote: >> This PR proposes to add a number of "capturing factories" in classes in the >> `java.util.function` package. >> >> The PR additionally (an optionally) proposes to add a new function >> `UnaryOperator::andThenUnary` to allow composition wh

Re: RFR: 8318364: Add an FFM-based implementation of harfbuzz OpenType layout

2023-10-18 Thread Maurizio Cimadamore
On Tue, 29 Aug 2023 22:04:40 GMT, Phil Race wrote: > 8318364: Add an FFM-based implementation of harfbuzz OpenType layout src/java.desktop/share/classes/sun/font/HBShaper.java line 425: > 423: float startY = (float)startPt.getY(); > 424: > 425: MemorySegment mat

Re: RFR: 8318364: Add an FFM-based implementation of harfbuzz OpenType layout

2023-10-18 Thread Maurizio Cimadamore
On Tue, 29 Aug 2023 22:04:40 GMT, Phil Race wrote: > 8318364: Add an FFM-based implementation of harfbuzz OpenType layout src/java.desktop/share/classes/sun/font/HBShaper.java line 110: > 108: > 109: private static VarHandle getVarHandle(StructLayout struct, String > name) { > 110:

Re: RFR: 8318454: TestLayoutPaths broken on Big Endian platforms after JDK-8317837

2023-10-19 Thread Maurizio Cimadamore
On Thu, 19 Oct 2023 06:18:18 GMT, Per Minborg wrote: > This PR suggests a fix for a failing test on platforms with big endian. > > The PR also contains a drive-by removal of an unused import. @TheRealMDoerr can you please check this? - PR Comment: https://git.openjdk.org/jdk/pull/

Re: RFR: 8318454: TestLayoutPaths broken on Big Endian platforms after JDK-8317837

2023-10-19 Thread Maurizio Cimadamore
On Thu, 19 Oct 2023 06:18:18 GMT, Per Minborg wrote: > This PR suggests a fix for a failing test on platforms with big endian. > > The PR also contains a drive-by removal of an unused import. Marked as reviewed by mcimadamore (Reviewer). - PR Review: https://git.openjdk.org/jdk/pu

Integrated: 8318324: Drop redundant default methods from FFM API

2023-10-19 Thread Maurizio Cimadamore
On Tue, 17 Oct 2023 17:31:30 GMT, Maurizio Cimadamore wrote: > This PR moves turns default methods in `MemorySegment` and `MemoryLayout` > into ordinary abstract methods. > These interfaces cannot be subclasses by developers (they are sealed), so > there is no reson for having def

Re: RFR: 8318364: Add an FFM-based implementation of harfbuzz OpenType layout

2023-10-19 Thread Maurizio Cimadamore
On Wed, 18 Oct 2023 23:56:17 GMT, Maurizio Cimadamore wrote: >> 8318364: Add an FFM-based implementation of harfbuzz OpenType layout > > src/java.desktop/share/classes/sun/font/HBShaper.java line 110: > >> 108: >> 109: private static VarHandle getVarHandle(

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

2023-10-19 Thread Maurizio Cimadamore
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, this method has been removed because: * It was not general enough (it only worked with value

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

2023-10-19 Thread Maurizio Cimadamore
ralizes 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 Cimadamore has

Re: RFR: 8317819: Scope should reflect lifetime of underying resource (mainline) [v4]

2023-10-20 Thread Maurizio Cimadamore
gment::ofArray`, `MemorySegment::ofBuffer` and > `SymbolLookup::loaderLookup` is tweaked to say that the scope associated to > the returned segments is an automatic scope > * the javadoc for `MemorySegment.Scope` defines the concepts of global and > automatic scope, which are then r

Integrated: 8317819: Scope should reflect lifetime of underying resource (mainline)

2023-10-20 Thread Maurizio Cimadamore
On Fri, 13 Oct 2023 14:21:49 GMT, Maurizio Cimadamore wrote: > This PR is based on a port of: openjdk/panama-foreign#898 > > Some additional changes are contained in this PR: > > * instead of using a different "always alive" scope for zero-length memory > seg

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,

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

2023-10-20 Thread Maurizio Cimadamore
ralizes 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 Cimadamore has

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 > - https://github.com/openjdk/panam

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: https://git.openjdk.org/

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

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 the

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 lik

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: https://github.co

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 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. src/jdk.incubator.vec

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. test/jdk/jdk/incubato

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. src/jdk.incubator.vec

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 p

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 has

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 caller

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 caller

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 access

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

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. >> >> - Si

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. >> >> - Si

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. >> >> - Si

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 {@cod

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 i

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: https://git.openjdk.org/jdk/pull/16469#pullrequestreview-1710

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: 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 ((tree.mods.flags

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) [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: 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 implement

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 [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: 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 spell

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 spell

<    3   4   5   6   7   8   9   10   11   >