Re: RFR: 8308031: Linkers should promote variadic arguments [v7]

2023-06-02 Thread Jorn Vernee
n mac/aarch64 with the fallback linker to verify the > correctness of the fallback linker changes. Jorn Vernee has updated the pull request incrementally with one additional commit since the last revision: address review comment - Changes: - all: https://git.openjdk.org/jdk/pu

Re: RFR: 8308031: Linkers should promote variadic arguments [v6]

2023-06-02 Thread Jorn Vernee
On Fri, 2 Jun 2023 15:52:06 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 cont

Re: RFR: 8308031: Linkers should promote variadic arguments [v6]

2023-06-02 Thread Jorn Vernee
On Fri, 2 Jun 2023 15:47:05 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 cont

Re: RFR: 8308031: Linkers should reject unpromoted variadic parameters [v6]

2023-06-02 Thread Jorn Vernee
- tier1-3 + jdk-tier5 (ongoing) > - manual test run on mac/aarch64 with the fallback linker to verify the > correctness of the fallback linker changes. Jorn Vernee has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelate

Re: RFR: 8308031: Linkers should reject unpromoted variadic parameters [v4]

2023-06-02 Thread Jorn Vernee
On Thu, 1 Jun 2023 15:28:33 GMT, Jorn Vernee wrote: >> In C, arguments smaller than `int` are promoted to (`unsigned`) `int`, and >> `float` is promoted to `double`, when being passed as variadic argument (see >> e.g. >> https://en.cppreference.com

Re: RFR: 8308031: Linkers should reject unpromoted variadic parameters [v5]

2023-06-02 Thread Jorn Vernee
- tier1-3 + jdk-tier5 (ongoing) > - manual test run on mac/aarch64 with the fallback linker to verify the > correctness of the fallback linker changes. Jorn Vernee has updated the pull request incrementally with one additional commit since the last revision: automatically apply variadic p

Re: RFR: 8308645: Javadoc of FFM API needs to be refreshed [v4]

2023-06-02 Thread Jorn Vernee
On Fri, 2 Jun 2023 11:07:42 GMT, Maurizio Cimadamore wrote: >> Yeah - I meant what you said - but now that you said it, I also saw how what >> I've written can be prone to an alternate (and wrong) interpretation. I'll >> clarify. > > Actually, looking back at this I'm not sure it's correct? We

Re: RFR: 8308645: Javadoc of FFM API needs to be refreshed [v4]

2023-06-01 Thread Jorn Vernee
On Thu, 1 Jun 2023 20:57:25 GMT, Maurizio Cimadamore wrote: >> On a related note: should we even allow sequences of padding layouts? > > I let sequence of padding slide on the basis that groups of padding are > allowed. But it's a somewhat arbitrary line. That said, we do use stuff like > that

Re: RFR: 8308645: Javadoc of FFM API needs to be refreshed [v4]

2023-06-01 Thread Jorn Vernee
On Thu, 1 Jun 2023 21:00:33 GMT, Maurizio Cimadamore wrote: >> src/java.base/share/classes/java/lang/foreign/MemoryLayout.java line 470: >> >>> 468: * @throws IllegalArgumentException if the layout path contains >>> one or more dereference path elements. >>> 469: * @throws IllegalArg

Re: RFR: 8308645: Javadoc of FFM API needs to be refreshed [v4]

2023-06-01 Thread Jorn Vernee
On Thu, 1 Jun 2023 21:04:42 GMT, Maurizio Cimadamore wrote: >> the idea behind this is to connect with the javadoc of `SymbolLookup` which >> defines and then uses symbol all over the place. > > Maybe a linkplan could help? Okay, but `SymbolLookup` also says this: "A symbol lookup retrieves t

Re: RFR: 8308645: Javadoc of FFM API needs to be refreshed [v4]

2023-06-01 Thread Jorn Vernee
On Thu, 1 Jun 2023 19:24:35 GMT, Jorn Vernee wrote: >> Maurizio Cimadamore has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Fix wrong link in layout well-formedness doc > > src/java.base/share/classes/java/

Re: RFR: 8308645: Javadoc of FFM API needs to be refreshed [v4]

2023-06-01 Thread Jorn Vernee
On Thu, 1 Jun 2023 13:06:15 GMT, Alan Bateman wrote: >> Maurizio Cimadamore has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Fix wrong link in layout well-formedness doc > > src/java.base/share/classes/java/lang/foreign/FunctionDescriptor

Re: RFR: 8308645: Javadoc of FFM API needs to be refreshed [v4]

2023-06-01 Thread Jorn Vernee
On Mon, 29 May 2023 10:53:52 GMT, Maurizio Cimadamore wrote: >> As the FFM API evolved over time, some parts of the javadoc went out of >> sync. Now that most of the API is stable, it is a good time to look again at >> the javadoc as a whole, and bring some more consistency. >> >> While most

Re: RFR: 8308031: Linkers should reject unpromoted variadic parameters [v4]

2023-06-01 Thread Jorn Vernee
On Thu, 1 Jun 2023 15:28:33 GMT, Jorn Vernee wrote: >> In C, arguments smaller than `int` are promoted to (`unsigned`) `int`, and >> `float` is promoted to `double`, when being passed as variadic argument (see >> e.g. >> https://en.cppreference.com

Re: RFR: 8308031: Linkers should reject unpromoted variadic parameters [v3]

2023-06-01 Thread Jorn Vernee
On Thu, 1 Jun 2023 15:19:48 GMT, Maurizio Cimadamore wrote: >> Jorn Vernee has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Rework javadoc > > src/java.base/share/classes/java/lang/foreign/Linker.java l

Re: RFR: 8308031: Linkers should reject unpromoted variadic parameters [v4]

2023-06-01 Thread Jorn Vernee
- tier1-3 + jdk-tier5 (ongoing) > - manual test run on mac/aarch64 with the fallback linker to verify the > correctness of the fallback linker changes. Jorn Vernee has updated the pull request incrementally with one additional commit since the last revision: move prototype-less name ---

Re: RFR: 8308031: Linkers should reject unpromoted variadic parameters [v2]

2023-06-01 Thread Jorn Vernee
On Wed, 31 May 2023 23:57:01 GMT, Jorn Vernee wrote: >> Also, should we say somewhere that, for prototype-less functions, >> `firstVariadicArg` should always have an index of 0 (e.g. any other value is >> illegal, trivially). It's not super important, just one of those

Re: RFR: 8308031: Linkers should reject unpromoted variadic parameters [v3]

2023-06-01 Thread Jorn Vernee
- tier1-3 + jdk-tier5 (ongoing) > - manual test run on mac/aarch64 with the fallback linker to verify the > correctness of the fallback linker changes. Jorn Vernee has updated the pull request incrementally with one additional commit since the last revision: Rework javadoc --

Re: RFR: 8308031: Linkers should reject unpromoted variadic parameters [v2]

2023-05-31 Thread Jorn Vernee
On Wed, 31 May 2023 23:41:25 GMT, Maurizio Cimadamore wrote: >> Jorn Vernee has updated the pull request incrementally with one additional >> commit since the last revision: >> >> review comments > > src/java.base/share/classes/java/lang/foreign/Linker.jav

Re: RFR: 8308031: Linkers should reject unpromoted variadic parameters [v2]

2023-05-31 Thread Jorn Vernee
On Wed, 31 May 2023 23:36:33 GMT, Maurizio Cimadamore wrote: >> src/java.base/share/classes/java/lang/foreign/Linker.java line 368: >> >>> 366: * Variadic functions >>> 367: * >>> 368: * Variadic functions (e.g. a C function declared with a trailing >>> ellipses {@code ...} at the end of th

Re: RFR: 8308031: Linkers should reject unpromoted variadic parameters [v2]

2023-05-31 Thread Jorn Vernee
On Wed, 31 May 2023 15:37:57 GMT, Maurizio Cimadamore wrote: >> Jorn Vernee has updated the pull request incrementally with one additional >> commit since the last revision: >> >> review comments > > src/java.base/share/classes/java/lang/foreign/Linker.java lin

Re: RFR: 8308031: Linkers should reject unpromoted variadic parameters [v2]

2023-05-31 Thread Jorn Vernee
- tier1-3 + jdk-tier5 (ongoing) > - manual test run on mac/aarch64 with the fallback linker to verify the > correctness of the fallback linker changes. Jorn Vernee has updated the pull request incrementally with one additional commit since the last revision: review comments --

Re: RFR: 8308031: Linkers should reject unpromoted variadic parameters

2023-05-31 Thread Jorn Vernee
On Wed, 31 May 2023 15:39:54 GMT, Maurizio Cimadamore wrote: >> test/jdk/java/foreign/StdLibTest.java line 386: >> >>> 384: return arena.allocateUtf8String("str"); >>> 385: }, "str"), >>> 386: CHAR(int.class, C_INT, "%c", arena -> (int) 'h', (int) 'h'), >>> // promo

RFR: 8308031: Linkers should reject unpromoted variadic parameters

2023-05-31 Thread Jorn Vernee
In C, arguments smaller than `int` are promoted to (`unsigned`) `int`, and `float` is promoted to `double`, when being passed as variadic argument (see e.g. https://en.cppreference.com/w/c/language/conversion#Default_argument_promotions). This patch restricts the layouts that can be used as var

Integrated: 8308992: New test TestHFA fails with zero

2023-05-30 Thread Jorn Vernee
On Tue, 30 May 2023 12:17:00 GMT, Jorn Vernee wrote: > The issue is that the fallback linker uses `copyFrom` when copying a by-value > struct argument to an internal buffer, without first adjusting the size of > the argument segment. This means that if the argument segment is &

RFR: 8308992: New test TestHFA fails with zero

2023-05-30 Thread Jorn Vernee
The issue is that the fallback linker uses `copyFrom` when copying a by-value struct argument to an internal buffer, without first adjusting the size of the argument segment. This means that if the argument segment is 'too large' (i.e. larger than the layout it was linked with) we fail with an e

Re: RFR: 8309042: MemorySegment::reinterpret cleanup action is not called for all overloads

2023-05-29 Thread Jorn Vernee
On Mon, 29 May 2023 10:39:19 GMT, Maurizio Cimadamore wrote: > There's an obvious bug in `AbstractMemorySegmentImpl::reinterpret(long, > Arena, Consumer)`: this method does not pass the consumer down to the > internal implementation method (it just passes `null`). As a result, the > cleanup i

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

2023-05-12 Thread Jorn Vernee
On Thu, 11 May 2023 10:00:39 GMT, Maurizio Cimadamore wrote: > 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 > `Linke

Re: RFR: 8307961: java/foreign/enablenativeaccess/TestEnableNativeAccess.java fails with ShouldNotReachHere

2023-05-11 Thread Jorn Vernee
On Thu, 11 May 2023 21:29:51 GMT, Maurizio Cimadamore wrote: > This patch fixes the JNI test for the enable native access flag, which was > updated incorrectly as part of https://git.openjdk.org/jdk/pull/13863. > > The problem is that the test doesn't make global references out of the local >

Re: RFR: 8303040: linux PPC64le: Implementation of Foreign Function & Memory API (Preview) [v22]

2023-05-10 Thread Jorn Vernee
On Wed, 10 May 2023 13:53:53 GMT, Stefan Karlsson wrote: >> I just figured it out. It was introduced by >> https://bugs.openjdk.org/browse/JDK-8203172 (on aarch64) which mentions >> Shenandoah and future GCs. However, the Shenandoah comment says >> "non-reference load, no additional barrier is

Re: RFR: 8303040: linux PPC64le: Implementation of Foreign Function & Memory API (Preview) [v24]

2023-05-10 Thread Jorn Vernee
On Wed, 10 May 2023 11:23:04 GMT, Martin Doerr wrote: >> src/hotspot/cpu/ppc/upcallLinker_ppc.cpp line 236: >> >>> 234: __ block_comment("{ receiver "); >>> 235: __ load_const_optimized(R3_ARG1, (intptr_t)receiver, R0); >>> 236: __ resolve_jobject(R3_ARG1, tmp, R31, >>> MacroAssembler::PR

Re: RFR: 8303040: linux PPC64le: Implementation of Foreign Function & Memory API (Preview) [v22]

2023-05-10 Thread Jorn Vernee
On Wed, 10 May 2023 11:13:14 GMT, Martin Doerr wrote: > It does the same but with a more complicated API. AFAIK It depends on the GC that's being used. `access_load_at` will make sure the right GC barriers are inserted (mostly for concurrent GCs). - PR Review Comment: https://git.

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

2023-05-08 Thread Jorn Vernee
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 (already reviewed in the panama-foreign repo) - Marked as reviewed by jvernee (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/13869#pullrequest

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

2023-05-08 Thread Jorn Vernee
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 thread, we submit an initi

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

2023-05-08 Thread Jorn Vernee
On Mon, 8 May 2023 14:23:10 GMT, Maurizio Cimadamore wrote: >> 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 Marked as reviewed by j

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

2023-05-08 Thread Jorn Vernee
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 78: > 76: SharedUtils.checkSymbol(symbol); > 77: return downcallHandle(function,

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

2023-05-04 Thread Jorn Vernee
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 value layouts have a

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

2023-05-03 Thread Jorn Vernee
On Wed, 3 May 2023 14:20:22 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 that has to be a

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

2023-05-03 Thread Jorn Vernee
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 within the struct t

Re: RFR: 8303040: linux PPC64le: Implementation of Foreign Function & Memory API (Preview) [v25]

2023-05-02 Thread Jorn Vernee
On Tue, 2 May 2023 14:35:22 GMT, Martin Doerr wrote: > Do you have for more changes to wait for or would you prefer to have this PR > integrated soon? I don't have anything else in the pipeline at the moment. > Off topic: I have read parts of the Big Endian ABI and we will need a > solution f

Re: RFR: 8303040: linux PPC64le: Implementation of Foreign Function & Memory API (Preview) [v25]

2023-05-02 Thread Jorn Vernee
On Tue, 2 May 2023 09:51:47 GMT, Martin Doerr wrote: >> Implementation of "Foreign Function & Memory API" for linux on Power (Little >> Endian) according to "Power Architecture 64-Bit ELF V2 ABI Specification". >> >> This PR does not include code for VaList support because it's supposed to >>

Re: RFR: 8303040: linux PPC64le: Implementation of Foreign Function & Memory API (Preview) [v24]

2023-05-02 Thread Jorn Vernee
On Thu, 27 Apr 2023 12:59:33 GMT, Martin Doerr wrote: >> Martin Doerr has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Revert unintended formatting changes. Fix comment. > > Adapted for JDK21, now. All tests have passed. My IDE had change

Integrated: 8304888: Add dedicated VMProps for linker and fallback linker

2023-05-02 Thread Jorn Vernee
On Tue, 11 Apr 2023 17:28:06 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

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

2023-05-02 Thread Jorn Vernee
package, `--add-exports` flags are added as javac flags and VM flags for the > extra prop definitions class. Jorn Vernee has updated the pull request incrementally with one additional commit since the last revision: jdk.CABI -> jdk.foreign.linker - Changes: - all

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

2023-05-02 Thread Jorn Vernee
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.

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

2023-05-02 Thread Jorn Vernee
On Tue, 2 May 2023 10:16:17 GMT, Maurizio Cimadamore wrote: >> Jorn Vernee has updated the pull request with a new target base due to a >> merge or a rebase. The pull request now contains 46 commits: >> >> - UNKNOWN -> UNSUPPORTED + fix TestLinker on FALLBACK >&

Integrated: 8307164: TestSegmentCopy times out (mainline)

2023-05-02 Thread Jorn Vernee
On Mon, 1 May 2023 17:02:11 GMT, Jorn Vernee wrote: > Port of: https://github.com/openjdk/panama-foreign/pull/827 This pull request has now been integrated. Changeset: 1532a1b0 Author: Jorn Vernee URL: https://git.openjdk.org/jdk/commit/1532a1b0bd72f37b77540af51368271ef80e17d2 St

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

2023-05-01 Thread Jorn Vernee
On Mon, 1 May 2023 22:25:31 GMT, Jorn Vernee wrote: > Type profiling works for the HC type we define, we inline `HC::foo`, and find > that: hey, in HC::foo's implementation, the target MH is constant, so we can > inline through that as well. Giving us once again, optimal perform

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

2023-05-01 Thread Jorn Vernee
On Mon, 1 May 2023 21:00:40 GMT, John R Rose wrote: > HC fields are supposed to fold up; if they don’t we can help them in this > case. (That is, constant folding of the MH pointer should not be a roadblock; > that’s on the JIT to fix by adjusting the TrustFinalFields logic.) The issue with th

RFR: 8307164: TestSegmentCopy times out (mainline)

2023-05-01 Thread Jorn Vernee
Port of: https://github.com/openjdk/panama-foreign/pull/827 - Commit messages: - 8303831: TestSegmentCopy times out Changes: https://git.openjdk.org/jdk/pull/13741/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=13741&range=00 Issue: https://bugs.openjdk.org/browse/JDK-830

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

2023-05-01 Thread Jorn Vernee
On Fri, 28 Apr 2023 12:59:26 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.

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

2023-05-01 Thread Jorn Vernee
package, `--add-exports` flags are added as javac flags and VM flags for the > extra prop definitions class. Jorn Vernee has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 46 commits: - UNKNOWN -> UNSUPPORTED + fix TestLinker on F

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

2023-05-01 Thread Jorn Vernee
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 iss

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

2023-05-01 Thread Jorn Vernee
> 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 informative exception. Jorn Vernee

Integrated: 8305093: Linker cache should not take layout names into account

2023-05-01 Thread Jorn Vernee
On Thu, 20 Apr 2023 17:23:08 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 th

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

2023-05-01 Thread Jorn Vernee
ode is not very performance sensitive, > so I instead went with a simpler approach in this patch. Jorn Vernee has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 47 commits: - Merge branch 'master' into NoNameCache2 - Use o

Integrated: 8301703: java.base jdk.internal.foreign.abi.BindingSpecializer uses ASM to generate classes

2023-05-01 Thread Jorn Vernee
On Thu, 30 Mar 2023 17:11:44 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 > `Code

Integrated: 8303002: Reject packed structs from linker

2023-05-01 Thread Jorn Vernee
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

Re: RFR: 8156916: intrinsify MethodHandles.arrayConstructor()

2023-04-30 Thread Jorn Vernee
On Sun, 30 Apr 2023 06:14:28 GMT, Chen Liang wrote: > Try to intrinsify MethodHandles.arrayConstructor for java.lang, > java.lang.invoke, and java.util types, which InvokerBytecodeGenerator can > refer to directly in a class constant. > > In fact, the performance difference of Array.newInstanc

Re: RFR: 8303796: Optionally build fully statically linked JDK image

2023-04-30 Thread Jorn Vernee
On Sun, 30 Apr 2023 18:34:12 GMT, Alan Bateman wrote: > A possible direction on this is for the build to create a set of packaged > modules with the .a files, then have an alternative image builder in jlink > that integrates with the native linker. Combined with other parts in > Jiangli's slid

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

2023-04-28 Thread Jorn Vernee
package, `--add-exports` flags are added as javac flags and VM flags for the > extra prop definitions class. Jorn Vernee has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 44 commits: - Merge branch 'master' into VMProps

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

2023-04-27 Thread Jorn Vernee
lly block as is, using labels. > > The current implementation could also use `CheckClassAdapter` to do > additional verification on the generated bytecode (ahead of the VM's > verifier). I'm not sure if the new API has a replacement for that? Jorn Vernee has updated the pull request wit

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

2023-04-27 Thread Jorn Vernee
> 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. Jorn Vernee has updated the pull request with a new ta

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

2023-04-27 Thread Jorn Vernee
ode is not very performance sensitive, > so I instead went with a simpler approach in this patch. Jorn Vernee has updated the pull request incrementally with one additional commit since the last revision: Use orElseGet Co-authored-by: ExE Boss <3889017+exe-b...@users.noreply.gi

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

2023-04-27 Thread Jorn Vernee
> 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 informative exception. Jorn Vernee

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

2023-04-27 Thread Jorn Vernee
ode is not very performance sensitive, > so I instead went with a simpler approach in this patch. Jorn Vernee has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 45 commits: - Undo changes to MemberDeleted.java - Merge branch '

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

2023-04-27 Thread Jorn Vernee
> 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 informative exception. Jorn Vernee

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

2023-04-27 Thread Jorn Vernee
package, `--add-exports` flags are added as javac flags and VM flags for the > extra prop definitions class. Jorn Vernee has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 43 commits: - use only jdk.CABI property - use extra props to c

Withdrawn: 8304986: Upcall stubs should support capureCallState

2023-04-24 Thread Jorn Vernee
On Fri, 21 Apr 2023 18:25:32 GMT, Jorn Vernee wrote: > Implement captureCallState support for upcall stubs. > > The method handle of an upcall stub linked with this linker option has an > additional leading memory segment parameter into which the capture state > (e.g. errno) sh

Re: RFR: 8304986: Upcall stubs should support capureCallState

2023-04-24 Thread Jorn Vernee
On Fri, 21 Apr 2023 18:25:32 GMT, Jorn Vernee wrote: > Implement captureCallState support for upcall stubs. > > The method handle of an upcall stub linked with this linker option has an > additional leading memory segment parameter into which the capture state > (e.g. errno) sh

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

2023-04-24 Thread Jorn Vernee
On Mon, 24 Apr 2023 11:46:57 GMT, Maurizio Cimadamore wrote: >> Jorn Vernee has updated the pull request incrementally with one additional >> commit since the last revision: >> >> use al instead of ValueLayout.ADDRESS > > src/java.base/share/cl

RFR: 8304888: Add dedicated VMProps for linker and fallback linker

2023-04-24 Thread Jorn Vernee
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 can also be use to check for a particular ABI in case we want to add

Re: RFR: 8304986: Upcall stubs should support capureCallState

2023-04-23 Thread Jorn Vernee
On Fri, 21 Apr 2023 18:25:32 GMT, Jorn Vernee wrote: > Implement captureCallState support for upcall stubs. > > The method handle of an upcall stub linked with this linker option has an > additional leading memory segment parameter into which the capture state > (e.g. errno) sh

RFR: 8304986: Upcall stubs should support capureCallState

2023-04-23 Thread Jorn Vernee
Implement captureCallState support for upcall stubs. The method handle of an upcall stub linked with this linker option has an additional leading memory segment parameter into which the capture state (e.g. errno) should be written. After returning from Java, this value is then actually written

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

2023-04-23 Thread Jorn Vernee
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 informative exception. - Depends on: https://git.op

Re: RFR: 8306075: Micro-optimize Enum.hashCode [v6]

2023-04-20 Thread Jorn Vernee
On Mon, 17 Apr 2023 16:42:38 GMT, olivergillespie wrote: >> Improve the speed of Enum.hashCode by caching the identity hashcode on first >> use. I've seen an application where Enum.hashCode is a hot path, and this is >> fairly simple speedup. The memory overhead is low; in enums with no extra

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

2023-04-20 Thread Jorn Vernee
ode is not very performance sensitive, > so I instead went with a simpler approach in this patch. Jorn Vernee has updated the pull request incrementally with one additional commit since the last revision: use al instead of ValueLayout.ADDRESS - Changes: - all: https://git.op

RFR: 8305093: Linker cache should not take layout names into account

2023-04-20 Thread Jorn Vernee
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 structure, but with layouts that have different names. I also have

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

2023-04-20 Thread Jorn Vernee
On Thu, 20 Apr 2023 19:29:40 GMT, ExE Boss 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 stru

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

2023-04-20 Thread Jorn Vernee
On Thu, 20 Apr 2023 09:27:40 GMT, Maurizio Cimadamore wrote: >> Jorn Vernee has updated the pull request incrementally with four additional >> commits since the last revision: >> >> - restrictions -> characteristics >> - polish pt. 2 >> - polish wordi

Re: RFR: 8306075: Micro-optimize Enum.hashCode [v6]

2023-04-20 Thread Jorn Vernee
On Mon, 17 Apr 2023 16:42:38 GMT, olivergillespie wrote: >> Improve the speed of Enum.hashCode by caching the identity hashcode on first >> use. I've seen an application where Enum.hashCode is a hot path, and this is >> fairly simple speedup. The memory overhead is low; in enums with no extra

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

2023-04-19 Thread Jorn Vernee
On Thu, 20 Apr 2023 00:40:44 GMT, Jorn Vernee wrote: >> Also, isn't it the case that, for structs, we want the size of the layout to >> be a multiple of its alignment constraint? > > The third item in the list is for group size needing to be a multiple of the > align

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

2023-04-19 Thread Jorn Vernee
> 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. Jorn Vernee has updated the pull request increment

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

2023-04-19 Thread Jorn Vernee
On Tue, 18 Apr 2023 22:32:17 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-19 Thread Jorn Vernee
On Tue, 18 Apr 2023 22:26:03 GMT, Maurizio Cimadamore wrote: >> src/java.base/share/classes/java/lang/foreign/Linker.java line 202: >> >>> 200: * Due to limited ABI specification coverage, all the native linker >>> implementations limit the function >>> 201: * descriptors that they support t

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

2023-04-19 Thread Jorn Vernee
On Tue, 18 Apr 2023 22:17:02 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 Jorn Vernee
> 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. Jorn Vernee has updated the pull request with a new ta

Re: RFR: 8306075: Micro-optimize Enum.hashCode [v2]

2023-04-17 Thread Jorn Vernee
On Mon, 17 Apr 2023 13:40:02 GMT, Claes Redestad wrote: > > > Why isn't `Enum::hashCode` simply doing `return ordinal;`? > > > > > > See https://bugs.openjdk.org/browse/JDK-8050217 > > Thanks! If there are apps where `Enum::hashCode` is performance sensitive > then run-to-run stability may be

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

2023-04-12 Thread Jorn Vernee
On Tue, 11 Apr 2023 17:59:32 GMT, Vladimir Ivanov wrote: >> Per Minborg has updated the pull request incrementally with two additional >> commits since the last revision: >> >> - 8305369: Issues in zero-length memory segment javadoc section >> - 8305087: MemoryLayout API checks should be more

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

2023-04-11 Thread Jorn Vernee
On Thu, 6 Apr 2023 10:54:18 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: >> https://cr.openjdk.org/~pminborg/panama/21/v1/javadoc/java.base/module-summary.htm

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

2023-04-07 Thread Jorn Vernee
On Thu, 6 Apr 2023 17:50:58 GMT, Chen Liang wrote: >> It looks like Proxy forcibly adds reads and exports edges from the module of >> the target interface to the module that defines the proxy: >> https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/lang/reflect/Proxy.java

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

2023-04-06 Thread Jorn Vernee
On Thu, 6 Apr 2023 17:56:23 GMT, Mandy Chung wrote: >> src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java line >> 213: >> >>> 211: .defineClassAsLookup(true, List.of(mhs)); >>> 212: proxy = lookup.findConstructor(lookup.lookupClass(), >>> meth

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

2023-04-06 Thread Jorn Vernee
On Thu, 6 Apr 2023 18:27:33 GMT, Chen Liang wrote: > I ran with make test TEST="test/jdk/java/lang/invoke/MethodHandleProxies". > The scratch's subdirectories (corresponding to processors) are all empty. The contents of the scratch directory is only saved if the test fails. Maybe it's not that

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

2023-04-06 Thread Jorn Vernee
On Thu, 6 Apr 2023 18:03:09 GMT, Chen Liang wrote: >> test/micro/org/openjdk/bench/java/lang/invoke/MethodHandleProxiesAsIFInstanceCall.java >> line 176: >> >>> 174: public void constantLambda() { >>> 175: i = constantLambda.doWork(i); >>> 176: } >> >> I think setting the resul

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

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

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

2023-04-06 Thread Jorn Vernee
On Thu, 6 Apr 2023 17:04:02 GMT, Johannes Kuhn wrote: >> I don't think that's good enough. If an instance implements an interface >> that just happens to also have an entry in the INTERFACE_INFOS cache, then >> e.g. `MethodHandleProxies::wrapperInstanceTarget` could be used to retrieve >> the

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

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

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

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

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

2023-04-06 Thread Jorn Vernee
On Thu, 6 Apr 2023 16:24:10 GMT, Chen Liang wrote: >> Sorry, you are supposed to run it with an installed `SecurityManager` of >> course. >> With an installed `SecurityManager` you should not be able to access classes >> in `sun.misc`. > > Guess I will just nuke the annotation and check for i

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

2023-04-06 Thread Jorn Vernee
On Thu, 6 Apr 2023 15:57:33 GMT, Johannes Kuhn wrote: >> Chen Liang has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Whitespace, cleanup, rename benchmarks to be informative > > src/java.base/share/classes/java/lang/invoke/MethodHandlePro

<    2   3   4   5   6   7   8   9   10   >