Re: RFR: 8315131: Clarify VarHandle set/get access on 32-bit platforms [v5]

2025-07-17 Thread Maurizio Cimadamore
On Thu, 17 Jul 2025 18:28:04 GMT, Chen Liang wrote: >> On 32 bit platforms, when an access to long/double is aligned, it is >> supported but not atomic. The original wording in >> `MethodHandles::byteBufferViewVarHandle` sounds as if it is not supported at >> all. We can fix that by borrowing

Re: RFR: 8315131: Clarify VarHandle set/get access on 32-bit platforms [v4]

2025-07-17 Thread Maurizio Cimadamore
On Thu, 17 Jul 2025 17:57:16 GMT, Chen Liang wrote: >> On 32 bit platforms, when an access to long/double is aligned, it is >> supported but not atomic. The original wording in >> `MethodHandles::byteBufferViewVarHandle` sounds as if it is not supported at >> all. We can fix that by borrowing

Re: RFR: 8362169: Pointer passed to upcall may get wrong scope

2025-07-16 Thread Maurizio Cimadamore
On Mon, 14 Jul 2025 15:33:35 GMT, Jorn Vernee wrote: > Issue copied from the JBS issue: > > When an upcall stub accepts a by-value struct, and the struct is passed by > the underlying ABI as a pointer to a temporary copy on the caller's stack > (for instance on Windows when the struct doesn't

Re: StableValue vs Optional

2025-06-17 Thread Maurizio Cimadamore
On 17/06/2025 16:01, Mickael Istria wrote: On Tue, Jun 17, 2025 at 4:51 PM Maurizio Cimadamore wrote: Maybe I'm misunderstanding... what would be the difference between StableValue::supplier and Supplier::cache ? Is it a discoverability issue you are pointing out (e.g.

Re: StableValue vs Optional

2025-06-17 Thread Maurizio Cimadamore
On 17/06/2025 15:25, Mickael Istria wrote: (and still believe a Supplier.cache(Supplier computer) would be a nice addition). Maybe I'm misunderstanding... what would be the difference between StableValue::supplier and Supplier::cache ? Is it a discoverability issue you are pointing out (e.g

Re: StableValue vs Optional

2025-06-17 Thread Maurizio Cimadamore
On 17/06/2025 13:55, Mickael Istria wrote: Thanks for your answer. > the most minimalistic type to model that would be a Supplier. Indeed. I mentioned Optional, but as the discussion goes, what could work instead of an Optional would be a constructor `Supplier.cache(Supplier computer)` that

Re: StableValue vs Optional

2025-06-17 Thread Maurizio Cimadamore
Hi Mickael, I think at a very high level, a stable value is just a supplier of some value, lazily computed. So, the most minimalistic type to model that would be a Supplier. In fact, this is what the StableValue provides as well (StableValue has a factory that takes a supplier and gives you ba

Re: RFR: 8345292: Improve javadocs for MemorySegment::getStrings defining word boundary cases [v4]

2025-06-11 Thread Maurizio Cimadamore
On Wed, 11 Jun 2025 17:24:11 GMT, Per Minborg wrote: >> This PR proposes to improve the 'MemorySegment.getString(long offset, >> Charset charset)` method documentation with respect to multi-octet concerns. > > Per Minborg has updated the pull request incrementally with one additional > commit s

Re: RFR: 8345292: Improve javadocs for MemorySegment::getStrings defining word boundary cases [v2]

2025-06-11 Thread Maurizio Cimadamore
On Tue, 10 Jun 2025 17:01:24 GMT, Per Minborg wrote: >> This PR proposes to improve the 'MemorySegment.getString(long offset, >> Charset charset)` method documentation with respect to multi-octet concerns. > > Per Minborg has updated the pull request incrementally with one additional > commit s

Re: RFR: 8357531: The `SegmentBulkOperations::fill` method can be improved using overlaps [v8]

2025-06-10 Thread Maurizio Cimadamore
On Thu, 5 Jun 2025 19:05:34 GMT, Per Minborg wrote: >> This PR builds on a concept John Rose told me about some time ago. Instead >> of combining memory operations of various sizes, a single large and skewed >> memory operation can be made to clean up the tail of remaining bytes. >> >> This ha

Re: javac confused by generics on class?

2025-06-10 Thread Maurizio Cimadamore
I've replied here (and moved the thread in compiler-dev) -- please follow up there if anything feels missing: https://mail.openjdk.org/pipermail/compiler-dev/2025-June/030756.html Maurizio On 10/06/2025 17:20, Éamonn McManus wrote: This question would probably be better asked on Stack Overflow

Re: RFR: 8345292: Improve javadocs for MemorySegment::getStrings defining word boundary cases

2025-06-10 Thread Maurizio Cimadamore
On Tue, 10 Jun 2025 09:01:17 GMT, Per Minborg wrote: > This PR proposes to improve the 'MemorySegment.getString(long offset, Charset > charset)` method documentation with respect to multi-octet concerns. src/java.base/share/classes/java/lang/foreign/MemorySegment.java line 1301: > 1299: *

Re: RFR: 8357919: Arena::allocate returns segments with address zero if the segment length is zero after JDK-8345687

2025-05-28 Thread Maurizio Cimadamore
On Wed, 28 May 2025 09:06:57 GMT, Per Minborg wrote: > After https://bugs.openjdk.org/browse/JDK-8345687 was integrated, zero-length > segments always have an address of zero. This may cause problems in certain > native methods that can receive segments and/or buffers derived from segments. >

Re: RFR: 8357919: Arena::allocate returns segments with address zero if the segment length is zero after JDK-8345687

2025-05-28 Thread Maurizio Cimadamore
On Wed, 28 May 2025 09:06:57 GMT, Per Minborg wrote: > After https://bugs.openjdk.org/browse/JDK-8345687 was integrated, zero-length > segments always have an address of zero. This may cause problems in certain > native methods that can receive segments and/or buffers derived from segments. >

Re: RFR: 8357531: The `SegmentBulkOperations::fill` method can be improved using overlaps [v2]

2025-05-22 Thread Maurizio Cimadamore
On Thu, 22 May 2025 08:14:35 GMT, Per Minborg wrote: >> This PR builds on a concept John Rose told me about some time ago. Instead >> of combining memory operations of various sizes, a single large and skewed >> memory operation can be made to clean up the tail of remaining bytes. >> >> This h

Re: RFR: 8357531: The `SegmentBulkOperations::fill` method can be improved using overlaps

2025-05-22 Thread Maurizio Cimadamore
On Thu, 22 May 2025 07:36:51 GMT, Per Minborg wrote: > Performance on an M1 Mac (Sequoia 15.4.1) Are the "regressions" for very big sizes related to this patch? - PR Comment: https://git.openjdk.org/jdk/pull/25383#issuecomment-2900432766

Re: Towards a JSON API for the JDK

2025-05-21 Thread Maurizio Cimadamore
On 21/05/2025 18:06, Paul Sandoz wrote: It was a design choice to be consistent with each json value having an X, accepting X in on construction and producing X out (notionally) on deconstruction, which leans into pattern matching. Definitely pros/cons to that e.g., we could instead make JonObje

Re: Towards a JSON API for the JDK

2025-05-21 Thread Maurizio Cimadamore
Hi Paul, I like the emphasis on minimality, and extensibility of the proposed API. One comment/question is why the API choses to expose Json arrays and objects as List/Maps respectively, instead of e.g. providing accessor to the object members/array elements. E.g. it seems to me that creating

Re: RFR: 8354323: Safeguard SwitchBootstraps.typeSwitch when used outside the compiler

2025-05-12 Thread Maurizio Cimadamore
On Wed, 7 May 2025 11:57:02 GMT, Aggelos Biboudis wrote: > While the compiler does not allow invalid queries to flow into > `SwitchBootstraps:typeSwitch`, a library user could do that and `typeSwitch` > does not prevent such usage pattern errors resulting in erroneous evaluation. > > For exam

Re: RFR: 8347408: Create an internal method handle adapter for system calls with errno [v10]

2025-05-09 Thread Maurizio Cimadamore
On Thu, 8 May 2025 10:50:55 GMT, Per Minborg wrote: >> As we advance, converting older JDK code to use the relatively new FFM API >> requires system calls that can provide `errno` and the likes to explicitly >> allocate a MemorySegment to capture potential error states. This can lead to >> neg

Re: RFR: 8356080: Address post-integration comments for Stable Values [v2]

2025-05-09 Thread Maurizio Cimadamore
On Fri, 9 May 2025 12:10:38 GMT, Per Minborg wrote: >> This PR proposes to address comments in the initial PR for Stable Values, >> which were deferred until after integration. >> >> Unfortunately, this PR shows the total commit history for stable values. > > Per Minborg has updated the pull re

Re: RFR: 8347408: Create an internal method handle adapter for system calls with errno [v9]

2025-05-08 Thread Maurizio Cimadamore
On Thu, 8 May 2025 09:21:35 GMT, Per Minborg wrote: >> As we advance, converting older JDK code to use the relatively new FFM API >> requires system calls that can provide `errno` and the likes to explicitly >> allocate a MemorySegment to capture potential error states. This can lead to >> neg

Re: RFR: 8347408: Create an internal method handle adapter for system calls with errno [v8]

2025-05-08 Thread Maurizio Cimadamore
On Thu, 8 May 2025 07:54:17 GMT, Per Minborg wrote: >> As we advance, converting older JDK code to use the relatively new FFM API >> requires system calls that can provide `errno` and the likes to explicitly >> allocate a MemorySegment to capture potential error states. This can lead to >> neg

Re: RFR: 8347408: Create an internal method handle adapter for system calls with errno [v8]

2025-05-08 Thread Maurizio Cimadamore
On Thu, 8 May 2025 07:54:17 GMT, Per Minborg wrote: >> As we advance, converting older JDK code to use the relatively new FFM API >> requires system calls that can provide `errno` and the likes to explicitly >> allocate a MemorySegment to capture potential error states. This can lead to >> neg

Re: RFR: 8347408: Create an internal method handle adapter for system calls with errno [v8]

2025-05-08 Thread Maurizio Cimadamore
On Thu, 8 May 2025 07:54:17 GMT, Per Minborg wrote: >> As we advance, converting older JDK code to use the relatively new FFM API >> requires system calls that can provide `errno` and the likes to explicitly >> allocate a MemorySegment to capture potential error states. This can lead to >> neg

Re: RFR: 8349146: [REDO] Implement a better allocator for downcalls [v8]

2025-05-02 Thread Maurizio Cimadamore
On Fri, 2 May 2025 14:12:42 GMT, Per Minborg wrote: > The performance before this PR can be seen in the "confined" benchmarks > above. In those benchmarks, a regular `Arena.ofConfined` is created upon > every invocation. Yes - but I was referring to the performance of the native call -- not th

Re: RFR: 8349146: [REDO] Implement a better allocator for downcalls [v8]

2025-05-02 Thread Maurizio Cimadamore
On Fri, 2 May 2025 11:45:33 GMT, Maurizio Cimadamore wrote: >> src/java.base/share/classes/jdk/internal/foreign/BufferStack.java line 127: >> >>> 125: arena, >>> 126: new SlicingAllocator(arena.allocate(byteSize,

Re: RFR: 8349146: [REDO] Implement a better allocator for downcalls [v8]

2025-05-02 Thread Maurizio Cimadamore
On Fri, 2 May 2025 11:36:56 GMT, Maurizio Cimadamore wrote: >> Per Minborg has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Cleanup and only create CleanupAction once per thread > > src/java.base/shar

Re: RFR: 8349146: [REDO] Implement a better allocator for downcalls [v8]

2025-05-02 Thread Maurizio Cimadamore
On Fri, 2 May 2025 11:13:27 GMT, Per Minborg wrote: >> This PR is based on the work of @mernst-github and aims to implement an >> _internal_ thread-local 'stack' allocator, which works like a dynamically >> sized arena, but with reset functionality to reset the allocated size back >> to a cert

Re: RFR: 8349146: [REDO] Implement a better allocator for downcalls [v7]

2025-05-02 Thread Maurizio Cimadamore
On Fri, 2 May 2025 10:41:38 GMT, Per Minborg wrote: > Updated benchmarks: > > ``` > Benchmark(ELEM_SIZE) Mode Cnt Score Error > Units > BufferStackBench.OfVirtual.buffer 8 avgt 15 12.695 ± 0.205 > ns/op > BufferStackBench.OfVirtual.buffer

Re: RFR: 8349146: [REDO] Implement a better allocator for downcalls [v8]

2025-05-02 Thread Maurizio Cimadamore
On Fri, 2 May 2025 11:13:27 GMT, Per Minborg wrote: >> This PR is based on the work of @mernst-github and aims to implement an >> _internal_ thread-local 'stack' allocator, which works like a dynamically >> sized arena, but with reset functionality to reset the allocated size back >> to a cert

Re: RFR: 8349146: [REDO] Implement a better allocator for downcalls [v6]

2025-05-01 Thread Maurizio Cimadamore
On Wed, 30 Apr 2025 15:33:52 GMT, Per Minborg wrote: >> This PR is based on the work of @mernst-github and aims to implement an >> _internal_ thread-local 'stack' allocator, which works like a dynamically >> sized arena, but with reset functionality to reset the allocated size back >> to a cer

Re: RFR: 8349146: [REDO] Implement a better allocator for downcalls [v6]

2025-05-01 Thread Maurizio Cimadamore
On Thu, 1 May 2025 09:22:57 GMT, Maurizio Cimadamore wrote: >> Per Minborg has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Improve on comments > > src/java.base/share/classes/jdk/internal/foreign/Buffer

Re: RFR: 8349146: [REDO] Implement a better allocator for downcalls [v6]

2025-05-01 Thread Maurizio Cimadamore
On Wed, 30 Apr 2025 15:33:52 GMT, Per Minborg wrote: >> This PR is based on the work of @mernst-github and aims to implement an >> _internal_ thread-local 'stack' allocator, which works like a dynamically >> sized arena, but with reset functionality to reset the allocated size back >> to a cer

Re: RFR: 8349146: [REDO] Implement a better allocator for downcalls [v6]

2025-05-01 Thread Maurizio Cimadamore
On Wed, 30 Apr 2025 15:33:52 GMT, Per Minborg wrote: >> This PR is based on the work of @mernst-github and aims to implement an >> _internal_ thread-local 'stack' allocator, which works like a dynamically >> sized arena, but with reset functionality to reset the allocated size back >> to a cer

Re: RFR: 8349146: [REDO] Implement a better allocator for downcalls [v6]

2025-05-01 Thread Maurizio Cimadamore
On Thu, 1 May 2025 09:04:00 GMT, Maurizio Cimadamore wrote: >> Per Minborg has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Improve on comments > > src/java.base/share/classes/jdk/internal/foreign/Buff

Re: RFR: 8349146: [REDO] Implement a better allocator for downcalls [v6]

2025-05-01 Thread Maurizio Cimadamore
On Wed, 30 Apr 2025 15:33:52 GMT, Per Minborg wrote: >> This PR is based on the work of @mernst-github and aims to implement an >> _internal_ thread-local 'stack' allocator, which works like a dynamically >> sized arena, but with reset functionality to reset the allocated size back >> to a cer

Re: RFR: 8349146: [REDO] Implement a better allocator for downcalls [v6]

2025-05-01 Thread Maurizio Cimadamore
On Thu, 1 May 2025 09:05:58 GMT, Maurizio Cimadamore wrote: >> src/java.base/share/classes/jdk/internal/foreign/BufferStack.java line 81: >> >>> 79: @Override >>> 80: public int hashCode() { >>> 81: return System.identityHashCode(

Re: RFR: 8349146: [REDO] Implement a better allocator for downcalls [v6]

2025-05-01 Thread Maurizio Cimadamore
On Wed, 30 Apr 2025 15:33:52 GMT, Per Minborg wrote: >> This PR is based on the work of @mernst-github and aims to implement an >> _internal_ thread-local 'stack' allocator, which works like a dynamically >> sized arena, but with reset functionality to reset the allocated size back >> to a cer

Re: RFR: 8344708: Compiler Implementation of Module Import Declarations [v8]

2025-04-30 Thread Maurizio Cimadamore
On Tue, 29 Apr 2025 12:33:59 GMT, Jan Lahoda wrote: >> This is a patch to finalize the module imports feature. Please see: >> https://bugs.openjdk.org/browse/JDK-8344700 > > Jan Lahoda has updated the pull request incrementally with one additional > commit since the last revision: > > Reflect

Re: RFR: 8344708: Compiler Implementation of Module Import Declarations [v7]

2025-04-29 Thread Maurizio Cimadamore
On Mon, 28 Apr 2025 13:26:30 GMT, Jan Lahoda wrote: >> This is a patch to finalize the module imports feature. Please see: >> https://bugs.openjdk.org/browse/JDK-8344700 > > Jan Lahoda has updated the pull request with a new target base due to a merge > or a rebase. The pull request now contains

Re: RFR: 8344708: Compiler Implementation of Module Import Declarations [v7]

2025-04-29 Thread Maurizio Cimadamore
On Mon, 28 Apr 2025 13:26:30 GMT, Jan Lahoda wrote: >> This is a patch to finalize the module imports feature. Please see: >> https://bugs.openjdk.org/browse/JDK-8344700 > > Jan Lahoda has updated the pull request with a new target base due to a merge > or a rebase. The pull request now contains

Re: RFR: 8344708: Compiler Implementation of Module Import Declarations [v7]

2025-04-29 Thread Maurizio Cimadamore
On Tue, 29 Apr 2025 10:12:07 GMT, Maurizio Cimadamore wrote: >> Jan Lahoda has updated the pull request with a new target base due to a >> merge or a rebase. The pull request now contains 13 commits: >> >> - Merge branch 'master' into JDK-8344708 >&

Re: RFR: 8354996: Reduce dynamic code generation for a single downcall [v2]

2025-04-28 Thread Maurizio Cimadamore
On Fri, 18 Apr 2025 18:25:54 GMT, Chen Liang wrote: >> Perf numbers for simple main: >> Linking of `Class::forName0` down from ~152 to ~83 >> >> For calling little color management system >> https://bugs.openjdk.org/browse/JDK-8313344: >> JNI: ~45 >> baseline panama: ~164 >> patch: ~103 >> >>

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v33]

2025-04-28 Thread Maurizio Cimadamore
On Wed, 23 Apr 2025 07:38:00 GMT, Viktor Klang wrote: >> I asked around/looked this up, and it seems 'contents' would be more correct >> here, since a StableValue is primarily a container of things (you put things >> into it, get things out). > > Yeah, that was what I was thinking too. Note -

Re: RFR: 8355080: java.base/jdk.internal.foreign.SystemLookup.find() doesn't work on static JDK [v3]

2025-04-28 Thread Maurizio Cimadamore
On Wed, 23 Apr 2025 00:56:18 GMT, Jiangli Zhou wrote: >> Please review this PR that changes to use `NativeLibraries.loadLibrary()` >> for loading the `libsyslookup` in `jdk.internal.foreign.SystemLookup` class. >> >> `NativeLibraries.loadLibrary()` handles both the shared library and (static)

Re: RFR: 8353917: jnativescan: Simplify ClassResolver [v3]

2025-04-11 Thread Maurizio Cimadamore
On Thu, 10 Apr 2025 17:07:21 GMT, Jorn Vernee wrote: >> `jnativescan` uses the `ClassResolver` class to find both system classes, as >> well as application classes. In principle, a class resolver supports both >> iterating over all classes from that particular source, as well as looking >> up

Re: RFR: 8353917: jnativescan: Simplify ClassResolver [v2]

2025-04-10 Thread Maurizio Cimadamore
On Wed, 9 Apr 2025 16:00:52 GMT, Jorn Vernee wrote: >> `jnativescan` uses the `ClassResolver` class to find both system classes, as >> well as application classes. In principle, a class resolver supports both >> iterating over all classes from that particular source, as well as looking >> up c

Re: RFR: 8348556: Inlining fails earlier for MemorySegment::reinterpret [v7]

2025-04-10 Thread Maurizio Cimadamore
On Tue, 8 Apr 2025 12:24:41 GMT, Per Minborg wrote: >> This PR proposes to add some `@ForceInline` annotations in the `Module` >> class in order to assist inlining of FFM var/method handles. >> >> There are also some changes in other classes which, if implemented, can take >> us three addition

Re: RFR: 8348556: Inlining fails earlier for MemorySegment::reinterpret [v6]

2025-04-10 Thread Maurizio Cimadamore
On Thu, 10 Apr 2025 15:52:38 GMT, Maurizio Cimadamore wrote: > > Baseline: > > ``` > > Benchmark(offsetCount) (segmentSize) Mode > > CntScore Error Units > > FFMVarHandleInlineTest.t0_reference 2048

Re: RFR: 8348556: Inlining fails earlier for MemorySegment::reinterpret [v6]

2025-04-10 Thread Maurizio Cimadamore
On Tue, 8 Apr 2025 12:13:25 GMT, Per Minborg wrote: > Baseline: > > ``` > Benchmark(offsetCount) (segmentSize) Mode Cnt >Score Error Units > FFMVarHandleInlineTest.t0_reference 2048 1024 thrpt 25 > 1552613.262 ? 14295.035

Re: RFR: 8350075: Performance difference between SegmentAllocator methods [v2]

2025-04-10 Thread Maurizio Cimadamore
On Thu, 10 Apr 2025 06:00:48 GMT, Per Minborg wrote: >> This PR proposes to add `@ForceInline` to the `default` methods in >> `SegmentAllocator` that do not already have it. > > Per Minborg has updated the pull request with a new target base due to a > merge or a rebase. The incremental webrev

Re: RFR: 8353917: jnativescan: Simplify ClassResolver [v2]

2025-04-10 Thread Maurizio Cimadamore
On Wed, 9 Apr 2025 16:00:52 GMT, Jorn Vernee wrote: >> `jnativescan` uses the `ClassResolver` class to find both system classes, as >> well as application classes. In principle, a class resolver supports both >> iterating over all classes from that particular source, as well as looking >> up c

Re: RFR: 8353917: jnativescan: Simplify ClassResolver [v2]

2025-04-10 Thread Maurizio Cimadamore
On Thu, 10 Apr 2025 14:43:20 GMT, Maurizio Cimadamore wrote: > Very nice simplification! This seems to take advantage of the fact that, for the restricted method analysis, we only need to look at method reference entries whose owner is a system class -- because we know restricted methods

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v33]

2025-04-07 Thread Maurizio Cimadamore
On Thu, 3 Apr 2025 14:26:15 GMT, Quan Anh Mai wrote: >> I don't think we should promise this even though it might be the case. > > What is the benefit of not promising it? Promising helps the supplier to have > a well-defined order of execution. Furthermore, even if you do not promise > it, it

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v27]

2025-04-05 Thread Maurizio Cimadamore
On Thu, 3 Apr 2025 12:14:52 GMT, Maurizio Cimadamore wrote: >> That was intentional as the list is always `0..size` whereas a map can use >> arbitrary inputs. Is there a better way to illustrate this than what we have >> now? > > I guess my "beef" is that

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v33]

2025-04-05 Thread Maurizio Cimadamore
On Thu, 3 Apr 2025 08:22:47 GMT, Per Minborg wrote: > "A stable value is a holder of content that can be lazily computed at most > once" I'd replace `computed` with `set` (as that's the term we use in the API). - PR Review Comment: https://git.openjdk.org/jdk/pull/23972#discussion

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v27]

2025-04-05 Thread Maurizio Cimadamore
On Thu, 3 Apr 2025 11:23:36 GMT, Per Minborg wrote: >> Yes - but they cache different things -- the first caches results for values >> 0-9 -- the second cached results for 1, 2, 4, 8, 16, 32. > > That was intentional as the list is always `0..size` whereas a map can use > arbitrary inputs. Is t

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v40]

2025-04-05 Thread Maurizio Cimadamore
On Thu, 3 Apr 2025 14:00:00 GMT, Per Minborg wrote: >> Implement JEP 502. >> >> The PR passes tier1-tier3 tests. > > Per Minborg has updated the pull request incrementally with one additional > commit since the last revision: > > Make the sqrt example different src/java.base/share/classes/j

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v25]

2025-04-05 Thread Maurizio Cimadamore
On Tue, 1 Apr 2025 13:27:34 GMT, Per Minborg wrote: >> Implement JEP 502. >> >> The PR passes tier1-tier3 tests. > > Per Minborg has updated the pull request incrementally with two additional > commits since the last revision: > > - Add lazy toSting for StableMap::values > - Make toString fo

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v25]

2025-04-05 Thread Maurizio Cimadamore
On Wed, 2 Apr 2025 11:43:40 GMT, Maurizio Cimadamore wrote: >> I didn't mean to say "this is not true, so use a `static final` instead". >> What I meant was more "let's not dive into VM-specific details now" (see my >> other comment on the t

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v8]

2025-04-04 Thread Maurizio Cimadamore
On Tue, 25 Mar 2025 16:23:20 GMT, Per Minborg wrote: > I have rewritten all the `toString()` methods. A `StableList::toString` now > produces something much more similar to a regular `List::toString`. The only > difference is that the `StableList::toString` shows ".unset" for the elements > th

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v25]

2025-04-04 Thread Maurizio Cimadamore
On Wed, 2 Apr 2025 09:13:21 GMT, Per Minborg wrote: >> src/java.base/share/classes/java/lang/StableValue.java line 52: >> >>> 50: * A stable value is a deferred holder of shallowly immutable content. >>> 51: * >>> 52: * A {@code StableValue} can be created using the factory method >> >> s/c

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v25]

2025-04-04 Thread Maurizio Cimadamore
On Tue, 1 Apr 2025 13:27:34 GMT, Per Minborg wrote: >> Implement JEP 502. >> >> The PR passes tier1-tier3 tests. > > Per Minborg has updated the pull request incrementally with two additional > commits since the last revision: > > - Add lazy toSting for StableMap::values > - Make toString fo

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v40]

2025-04-04 Thread Maurizio Cimadamore
On Fri, 4 Apr 2025 10:18:27 GMT, Maurizio Cimadamore wrote: >> I agree with this observation. We should look at providing true partial >> functions using for example `Optional`. > > Btw, I believe for now we should just "note" the issue, and move one. Let's &g

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v33]

2025-04-04 Thread Maurizio Cimadamore
On Thu, 3 Apr 2025 12:07:03 GMT, Maurizio Cimadamore wrote: >> There is a problem here: If we say it is "immutable content" people might >> think that passing mutable data makes it immutable. If we say it is >> "shallowly immutable content" people

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview)

2025-04-04 Thread Maurizio Cimadamore
In general I don't disagree. There is, however, at least _some_ cases where the imperative API is less difficult to use. In some cases you know that a class has a complex lifecycle -- perhaps it starts off in a simple "larval" state, where the instance only exist in a single thread. In

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v41]

2025-04-04 Thread Maurizio Cimadamore
On Fri, 4 Apr 2025 09:14:22 GMT, Per Minborg wrote: >> Implement JEP 502. >> >> The PR passes tier1-tier3 tests. > > Per Minborg has updated the pull request incrementally with one additional > commit since the last revision: > > Address comments on docs src/java.base/share/classes/java/lan

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v40]

2025-04-04 Thread Maurizio Cimadamore
On Fri, 4 Apr 2025 08:55:19 GMT, Per Minborg wrote: >> src/java.base/share/classes/java/lang/StableValue.java line 211: >> >>> 209: * StableValue.function(CACHED_KEYS, LOG2_ORIGINAL); >>> 210: * >>> 211: * public static double log2(int a) { >> >> IMHO this example reveals a l

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v40]

2025-04-03 Thread Maurizio Cimadamore
On Thu, 3 Apr 2025 14:00:00 GMT, Per Minborg wrote: >> Implement JEP 502. >> >> The PR passes tier1-tier3 tests. > > Per Minborg has updated the pull request incrementally with one additional > commit since the last revision: > > Make the sqrt example different src/java.base/share/classes/j

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v36]

2025-04-03 Thread Maurizio Cimadamore
On Thu, 3 Apr 2025 12:17:03 GMT, Maurizio Cimadamore wrote: >> Per Minborg has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Move Serializable specs to @implNote > > src/java.base/share/classes/java/

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v36]

2025-04-03 Thread Maurizio Cimadamore
On Thu, 3 Apr 2025 11:34:03 GMT, Per Minborg wrote: >> Implement JEP 502. >> >> The PR passes tier1-tier3 tests. > > Per Minborg has updated the pull request incrementally with one additional > commit since the last revision: > > Move Serializable specs to @implNote src/java.base/share/clas

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v25]

2025-04-02 Thread Maurizio Cimadamore
On Tue, 1 Apr 2025 13:27:34 GMT, Per Minborg wrote: >> Implement JEP 502. >> >> The PR passes tier1-tier3 tests. > > Per Minborg has updated the pull request incrementally with two additional > commits since the last revision: > > - Add lazy toSting for StableMap::values > - Make toString fo

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v33]

2025-04-02 Thread Maurizio Cimadamore
On Wed, 2 Apr 2025 14:07:45 GMT, Viktor Klang wrote: >> src/java.base/share/classes/java/lang/StableValue.java line 50: >> >>> 48: >>> 49: /** >>> 50: * A stable value is a holder of shallowly immutable content that can >>> be lazily computed. >> >> This reads as if the content can only be s

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v27]

2025-04-02 Thread Maurizio Cimadamore
On Wed, 2 Apr 2025 12:00:31 GMT, Per Minborg wrote: >> The same discrepancy is present in the list vs. map examples > > There are two fundamental variants. One with `CACHED_SIZE` (for list and int > function) and one with `CACHED_KEYS` (for map and function). Yes - but they cache different thin

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v27]

2025-04-02 Thread Maurizio Cimadamore
On Wed, 2 Apr 2025 11:41:30 GMT, Maurizio Cimadamore wrote: >> Per Minborg has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Improve examples > > src/java.base/share/classes/java/lang/StableValue.java line

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v25]

2025-04-02 Thread Maurizio Cimadamore
On Wed, 2 Apr 2025 09:13:32 GMT, Maurizio Cimadamore wrote: >> Per Minborg has updated the pull request incrementally with two additional >> commits since the last revision: >> >> - Add lazy toSting for StableMap::values >> - Make toString for reversed and

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v25]

2025-04-02 Thread Maurizio Cimadamore
On Wed, 2 Apr 2025 11:37:56 GMT, Maurizio Cimadamore wrote: >> I've used `static` fields now to get out of the muddy waters of trusted >> final fields, records etc. > > I didn't mean to say "this is not true, so use a `static final` instead". > What

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v27]

2025-04-02 Thread Maurizio Cimadamore
On Wed, 2 Apr 2025 11:39:20 GMT, Per Minborg wrote: >> Implement JEP 502. >> >> The PR passes tier1-tier3 tests. > > Per Minborg has updated the pull request incrementally with one additional > commit since the last revision: > > Improve examples src/java.base/share/classes/java/lang/Stable

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v25]

2025-04-02 Thread Maurizio Cimadamore
On Wed, 2 Apr 2025 11:34:24 GMT, Per Minborg wrote: >> Now that we have removed the VM-specific handling of fields declared as >> `StableValue`, this is true. I will take a look at improving the wording. > > I've used `static` fields now to get out of the muddy waters of trusted final > fields,

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v25]

2025-04-02 Thread Maurizio Cimadamore
On Tue, 1 Apr 2025 13:27:34 GMT, Per Minborg wrote: >> Implement JEP 502. >> >> The PR passes tier1-tier3 tests. > > Per Minborg has updated the pull request incrementally with two additional > commits since the last revision: > > - Add lazy toSting for StableMap::values > - Make toString fo

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v25]

2025-04-02 Thread Maurizio Cimadamore
On Tue, 1 Apr 2025 13:27:34 GMT, Per Minborg wrote: >> Implement JEP 502. >> >> The PR passes tier1-tier3 tests. > > Per Minborg has updated the pull request incrementally with two additional > commits since the last revision: > > - Add lazy toSting for StableMap::values > - Make toString fo

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v6]

2025-04-02 Thread Maurizio Cimadamore
On Mon, 17 Mar 2025 02:56:11 GMT, Chen Liang wrote: >> Per Minborg has updated the pull request with a new target base due to a >> merge or a rebase. The pull request now contains 246 commits: >> >> - Merge branch 'master' into implement-jep502 >> - Clean up exception messages and fix comment

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v25]

2025-04-02 Thread Maurizio Cimadamore
On Tue, 1 Apr 2025 13:27:34 GMT, Per Minborg wrote: >> Implement JEP 502. >> >> The PR passes tier1-tier3 tests. > > Per Minborg has updated the pull request incrementally with two additional > commits since the last revision: > > - Add lazy toSting for StableMap::values > - Make toString fo

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v21]

2025-04-01 Thread Maurizio Cimadamore
On Mon, 31 Mar 2025 16:03:57 GMT, Per Minborg wrote: > Here are the results of the new `MethodHandle` benchmarks: > > ``` > Benchmark Mode Cnt Score Error Units > StableMethodHandleBenchmark.atomic avgt 10 3.676 ? 0.206 ns/op > StableMethodHandleBenchm

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v21]

2025-03-31 Thread Maurizio Cimadamore
On Mon, 31 Mar 2025 13:47:27 GMT, Per Minborg wrote: > Here are the latest benchmarks run on an M1 (macOS): > > ``` > Benchmark Mode Cnt Score Error > Units > StableFunctionBenchmark.functionavgt 10 4.228 ? 0.172 > ns/op >

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v8]

2025-03-31 Thread Maurizio Cimadamore
On Mon, 31 Mar 2025 14:52:28 GMT, Per Minborg wrote: > This makes the list behave differently if run normally compared to being run > in a debug session. So, I think the current "high impedance" strategy is > motivated. The downside is a bit more complex code. If this is the concern, then havi

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v21]

2025-03-31 Thread Maurizio Cimadamore
On Mon, 31 Mar 2025 13:32:56 GMT, Per Minborg wrote: >> Implement JEP 502. >> >> The PR passes tier1-tier3 tests. > > Per Minborg has updated the pull request incrementally with one additional > commit since the last revision: > > Finish and clean up benchmarks src/java.base/share/classes/j

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v6]

2025-03-26 Thread Maurizio Cimadamore
On Wed, 19 Mar 2025 01:25:24 GMT, John R Rose wrote: > Hi again Per! > > Here are some brief notes from our face-to-face chat at JavaOne. > > Debuggers want/need a "hook" for tentative evaluation of stables. It is an > error for a debugger to trigger stable value decisions. This applies mainly

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview)

2025-03-19 Thread Maurizio Cimadamore
On Sun, 16 Mar 2025 03:30:46 GMT, John Rose wrote: > This might seem to contradict my previous assertion > that StableValue, being mutex based, must not > use lock-free idioms. That comment applies > specifically to the update operation that takes > a lambda. Other operations, such as reading > a

Re: RFR: 8345687: Improve the implementation of SegmentFactories::allocateSegment [v7]

2025-03-13 Thread Maurizio Cimadamore
On Thu, 13 Mar 2025 05:46:44 GMT, Quan Anh Mai wrote: >> Hi, >> >> This patch improves the performance of a typical `Arena::allocate` in >> several ways: >> >> - Delay the creation of the NativeMemorySegmentImpl. This avoids the merge >> of the instance with the one obtained from the call in

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v6]

2025-03-13 Thread Maurizio Cimadamore
On Thu, 13 Mar 2025 15:22:43 GMT, Per Minborg wrote: >> Implement JEP 502. >> >> The PR passes tier1-tier3 tests. > > Per Minborg has updated the pull request with a new target base due to a > merge or a rebase. The pull request now contains 246 commits: > > - Merge branch 'master' into imple

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v6]

2025-03-13 Thread Maurizio Cimadamore
On Thu, 13 Mar 2025 15:22:43 GMT, Per Minborg wrote: >> Implement JEP 502. >> >> The PR passes tier1-tier3 tests. > > Per Minborg has updated the pull request with a new target base due to a > merge or a rebase. The pull request now contains 246 commits: > > - Merge branch 'master' into imple

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v6]

2025-03-13 Thread Maurizio Cimadamore
On Thu, 13 Mar 2025 15:52:37 GMT, Maurizio Cimadamore wrote: >> Per Minborg has updated the pull request with a new target base due to a >> merge or a rebase. The pull request now contains 246 commits: >> >> - Merge branch 'master' into implement-jep502 >

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v6]

2025-03-13 Thread Maurizio Cimadamore
On Thu, 13 Mar 2025 15:48:25 GMT, Maurizio Cimadamore wrote: >> Per Minborg has updated the pull request with a new target base due to a >> merge or a rebase. The pull request now contains 246 commits: >> >> - Merge branch 'master' into implement-jep502 >

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v6]

2025-03-13 Thread Maurizio Cimadamore
On Thu, 13 Mar 2025 15:22:43 GMT, Per Minborg wrote: >> Implement JEP 502. >> >> The PR passes tier1-tier3 tests. > > Per Minborg has updated the pull request with a new target base due to a > merge or a rebase. The pull request now contains 246 commits: > > - Merge branch 'master' into imple

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v6]

2025-03-13 Thread Maurizio Cimadamore
On Thu, 13 Mar 2025 15:22:43 GMT, Per Minborg wrote: >> Implement JEP 502. >> >> The PR passes tier1-tier3 tests. > > Per Minborg has updated the pull request with a new target base due to a > merge or a rebase. The pull request now contains 246 commits: > > - Merge branch 'master' into imple

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview)

2025-03-13 Thread Maurizio Cimadamore
On Wed, 12 Mar 2025 08:09:04 GMT, Per Minborg wrote: >> If you have an `@Stable Object[]`, then the elements are also considered >> `@Stable`. Then you can do something like: >> >> ReentrantLock[] locks; >> >> T get(int idx) { >> Object x = backing[idx]; >> if (x == nul

Re: RFR: 8345687: Improve the implementation of SegmentFactories::allocateSegment [v6]

2025-03-12 Thread Maurizio Cimadamore
On Fri, 7 Mar 2025 17:38:13 GMT, Quan Anh Mai wrote: >> Hi, >> >> This patch improves the performance of a typical `Arena::allocate` in >> several ways: >> >> - Delay the creation of the NativeMemorySegmentImpl. This avoids the merge >> of the instance with the one obtained from the call in t

Re: RFR: 8350811: [JMH] test foreign.StrLenTest failed with StringIndexOutOfBoundsException for size=451 [v2]

2025-03-11 Thread Maurizio Cimadamore
On Tue, 4 Mar 2025 19:37:32 GMT, Vladimir Ivanov wrote: >> test setup was updated to generate data of requested size. > > Vladimir Ivanov has updated the pull request incrementally with one > additional commit since the last revision: > > JDK-8350811 [JMH] test foreign.StrLenTest failed with

  1   2   3   4   5   6   7   8   9   10   >