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

2023-10-18 Thread Jorn Vernee
On Wed, 18 Oct 2023 11:12:43 GMT, Maurizio Cimadamore wrote: >> This had a pretty big impact, actually. Especially on the larger sizes: >> >> >> Benchmark (size) Mode Cnt Score Error >> Units >> CriticalCalls.callNotPinned 100 avgt 30 84.818 �

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

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

2023-10-18 Thread Jorn Vernee
On Wed, 18 Oct 2023 09:48:47 GMT, Jorn Vernee wrote: >> test/micro/org/openjdk/bench/java/lang/foreign/CriticalCalls.java line 101: >> >>> 99: public int callNotPinned() throws Throwable { >>> 100: try (Arena arena = Arena.ofConfined()) { >>> 101: MemorySegment nativeArr

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

2023-10-18 Thread Jorn Vernee
On Wed, 18 Oct 2023 09:58:12 GMT, Maurizio Cimadamore wrote: >> I'm considering to leave `As such, these temporary addresses...` out. You >> already said that the address "is valid for the duration of the call". I'm >> not sure the subsequent sentence adds much. If you want to make a concrete

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 temporary because after the >> nati

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 Jorn Vernee
On Wed, 18 Oct 2023 09:45:25 GMT, Maurizio Cimadamore wrote: >> Jorn Vernee has updated the pull request incrementally with one additional >> commit since the last revision: >> >> drop unused in_reg_spiller > > test/micro/org/openjdk/bench/java/lang/foreign/CriticalCalls.java line 101: > >>

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 Jorn Vernee
On Wed, 18 Oct 2023 09:20:10 GMT, Maurizio Cimadamore wrote: >> Jorn Vernee has updated the pull request incrementally with one additional >> commit since the last revision: >> >> drop unused in_reg_spiller > > src/java.base/share/classes/java/lang/foreign/Linker.java line 795: > >> 793:

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-17 Thread Jorn Vernee
> 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 native function should return relatively quickly. Heap >