On Fri, 17 May 2024 09:31:33 GMT, Per Minborg wrote:
>> # Stable Values & Collections (Internal)
>>
>> ## Summary
>> This PR proposes to introduce an internal _Stable Values & Collections_ API,
>> which provides immutable value holders where elements are initialized _at
>> most once_. Stable
On Fri, 17 May 2024 09:31:33 GMT, Per Minborg wrote:
>> # Stable Values & Collections (Internal)
>>
>> ## Summary
>> This PR proposes to introduce an internal _Stable Values & Collections_ API,
>> which provides immutable value holders where elements are initialized _at
>> most once_. Stable
On Fri, 17 May 2024 09:31:33 GMT, Per Minborg wrote:
>> # Stable Values & Collections (Internal)
>>
>> ## Summary
>> This PR proposes to introduce an internal _Stable Values & Collections_ API,
>> which provides immutable value holders where elements are initialized _at
>> most once_. Stable
On Mon, 20 May 2024 09:50:17 GMT, Jens Lidestrom wrote:
>> Per Minborg has updated the pull request incrementally with two additional
>> commits since the last revision:
>>
>> - Add benchmarks for memoized IntFunction and Function
>> - Add benchmark for memoized supplier
>
>
On Fri, 17 May 2024 09:31:33 GMT, Per Minborg wrote:
>> # Stable Values & Collections (Internal)
>>
>> > src="https://github.com/openjdk/jdk/assets/7457876/db4b22a1-af87-4914-adac-b05a87e7cb42;
>> width=20% height=20%>
>>
>> ## Summary
>> This PR proposes to introduce an internal _Stable
On Fri, 17 May 2024 09:31:33 GMT, Per Minborg wrote:
>> # Stable Values & Collections (Internal)
>>
>> ## Summary
>> This PR proposes to introduce an internal _Stable Values & Collections_ API,
>> which provides immutable value holders where elements are initialized _at
>> most once_. Stable
> # Stable Values & Collections (Internal)
>
> ## Summary
> This PR proposes to introduce an internal _Stable Values & Collections_ API,
> which provides immutable value holders where elements are initialized _at
> most once_. Stable Values & Collections offer the performance and safety
>
> # Stable Values & Collections (Internal)
>
> ## Summary
> This PR proposes to introduce an internal _Stable Values & Collections_ API,
> which provides immutable value holders where elements are initialized _at
> most once_. Stable Values & Collections offer the performance and safety
>
> # Stable Values & Collections (Internal)
>
> ## Summary
> This PR proposes to introduce an internal _Stable Values & Collections_ API,
> which provides immutable value holders where elements are initialized _at
> most once_. Stable Values & Collections offer the performance and safety
>
> # Stable Values & Collections (Internal)
>
> ## Summary
> This PR proposes to introduce an internal _Stable Values & Collections_ API,
> which provides immutable value holders where elements are initialized _at
> most once_. Stable Values & Collections offer the performance and safety
>
On Thu, 16 May 2024 12:48:24 GMT, Per Minborg wrote:
>> # Stable Values & Collections (Internal)
>>
>> ## Summary
>> This PR proposes to introduce an internal _Stable Values & Collections_ API,
>> which provides immutable value holders where elements are initialized _at
>> most once_. Stable
Is it possible to make stable values and collections Serializable? I see
various applications for this feature in entity classes as a way to
preserve immutability of entity fields and at the same time not break
current JPA specifications. It is a *very* common task in commercial
development.
On Thu, 16 May 2024 12:48:24 GMT, Per Minborg wrote:
>> # Stable Values & Collections (Internal)
>>
>> ## Summary
>> This PR proposes to introduce an internal _Stable Values & Collections_ API,
>> which provides immutable value holders where elements are initialized _at
>> most once_. Stable
> # Stable Values & Collections (Internal)
>
> ## Summary
> This PR proposes to introduce an internal _Stable Values & Collections_ API,
> which provides immutable value holders where elements are initialized _at
> most once_. Stable Values & Collections offer the performance and safety
>
> # Stable Values & Collections (Internal)
>
> ## Summary
> This PR proposes to introduce an internal _Stable Values & Collections_ API,
> which provides immutable value holders where elements are initialized _at
> most once_. Stable Values & Collections offer the performance and safety
>
> # Stable Values & Collections (Internal)
>
> ## Summary
> This PR proposes to introduce an internal _Stable Values & Collections_ API,
> which provides immutable value holders where elements are initialized _at
> most once_. Stable Values & Collections offer the performance and safety
>
> # Stable Values & Collections (Internal)
>
> ## Summary
> This PR proposes to introduce an internal _Stable Values & Collections_ API,
> which provides immutable value holders where elements are initialized _at
> most once_. Stable Values & Collections offer the performance and safety
>
On Thu, 16 May 2024 11:14:16 GMT, Chen Liang wrote:
>> The idea here is to have the most likely value in the middle... Not sure if
>> that motivates the added complexity though.
>
> Is there any refernce on how/why the middle entry in a tableswitch
> instruction is the fastest?
It is only in
On Thu, 16 May 2024 11:13:24 GMT, Chen Liang wrote:
>> It seems reasonable to assume `null` values are not constant-folded. For
>> straight-out-of-the-box usage, there is no apparent significant difference
>> as indicated by a new benchmark I just added:
>>
>>
>> Benchmark
On Thu, 16 May 2024 07:29:21 GMT, Per Minborg wrote:
>> # Stable Values & Collections (Internal)
>>
>> ## Summary
>> This PR proposes to introduce an internal _Stable Values & Collections_ API,
>> which provides immutable value holders where elements are initialized _at
>> most once_. Stable
> # Stable Values & Collections (Internal)
>
> ## Summary
> This PR proposes to introduce an internal _Stable Values & Collections_ API,
> which provides immutable value holders where elements are initialized _at
> most once_. Stable Values & Collections offer the performance and safety
>
On Thu, 16 May 2024 07:11:20 GMT, Per Minborg wrote:
>> src/java.base/share/classes/jdk/internal/lang/stable/StableValueImpl.java
>> line 139:
>>
>>> 137: case NON_NULL: { return valueVolatile(); }
>>> 138: case ERROR:{ throw StableUtil.error(this); }
>>> 139:
On Thu, 16 May 2024 06:54:26 GMT, Per Minborg wrote:
>> Maybe the `state == NULL` check should be moved before `v != null`, as the
>> **JIT** doesn’t constant‑fold `null` [`@Stable`] values:
>>
> # Stable Values & Collections (Internal)
>
> ## Summary
> This PR proposes to introduce an internal _Stable Values & Collections_ API,
> which provides immutable value holders where elements are initialized _at
> most once_. Stable Values & Collections offer the performance and safety
>
On Thu, 16 May 2024 09:01:22 GMT, Per Minborg wrote:
>> # Stable Values & Collections (Internal)
>>
>> ## Summary
>> This PR proposes to introduce an internal _Stable Values & Collections_ API,
>> which provides immutable value holders where elements are initialized _at
>> most once_. Stable
> # Stable Values & Collections (Internal)
>
> ## Summary
> This PR proposes to introduce an internal _Stable Values & Collections_ API,
> which provides immutable value holders where elements are initialized _at
> most once_. Stable Values & Collections offer the performance and safety
>
On Wed, 15 May 2024 16:26:57 GMT, Chen Liang wrote:
>> Per Minborg has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> Switch to monomorphic StableValue and use lazy arrays
>
>
On Wed, 15 May 2024 15:49:22 GMT, Chen Liang wrote:
>> Maybe there is a better home for this?
>
> I don't think we should publish this API; this will soon be phased out by
> strict final fields (written only before super constructor calls) introduced
> by Valhalla, as strict final fields are
On Wed, 15 May 2024 16:29:08 GMT, Chen Liang wrote:
>> Per Minborg has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> Switch to monomorphic StableValue and use lazy arrays
>
>
> # Stable Values & Collections (Internal)
>
> ## Summary
> This PR proposes to introduce an internal _Stable Values & Collections_ API,
> which provides immutable value holders where elements are initialized _at
> most once_. Stable Values & Collections offer the performance and safety
>
On Wed, 15 May 2024 16:31:15 GMT, Chen Liang wrote:
>> Per Minborg has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> Switch to monomorphic StableValue and use lazy arrays
>
>
> # Stable Values & Collections (Internal)
>
> ## Summary
> This PR proposes to introduce an internal _Stable Values & Collections_ API,
> which provides immutable value holders where elements are initialized _at
> most once_. Stable Values & Collections offer the performance and safety
>
On Wed, 15 May 2024 19:07:26 GMT, Chen Liang wrote:
>> Yes, according to the `@Stable` annotation’s JavaDoc, this is UB:
>> https://github.com/openjdk/jdk/blob/8a4315f833f3700075d65fae6bc566011c837c07/src/java.base/share/classes/jdk/internal/vm/annotation/Stable.java#L74-L80
>
> Fyi what usually
> # Stable Values & Collections (Internal)
>
> ## Summary
> This PR proposes to introduce an internal _Stable Values & Collections_ API,
> which provides immutable value holders where elements are initialized _at
> most once_. Stable Values & Collections offer the performance and safety
>
> # Stable Values & Collections (Internal)
>
> ## Summary
> This PR proposes to introduce an internal _Stable Values & Collections_ API,
> which provides immutable value holders where elements are initialized _at
> most once_. Stable Values & Collections offer the performance and safety
>
On Thu, 16 May 2024 07:19:54 GMT, Per Minborg wrote:
>> src/java.base/share/classes/jdk/internal/lang/StableValue.java line 384:
>>
>>> 382: * @param the memoized type
>>> 383: */
>>> 384: static Supplier ofSupplier(Supplier original) {
>>
>> `ofSupplier` sounds like this
On Wed, 15 May 2024 16:25:04 GMT, Chen Liang wrote:
>> Per Minborg has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> Switch to monomorphic StableValue and use lazy arrays
>
> src/java.base/share/classes/jdk/internal/lang/StableValue.java
On Wed, 15 May 2024 16:19:05 GMT, Chen Liang wrote:
>> Per Minborg has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> Switch to monomorphic StableValue and use lazy arrays
>
>
On Wed, 15 May 2024 16:11:56 GMT, Chen Liang wrote:
>> Per Minborg has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> Switch to monomorphic StableValue and use lazy arrays
>
>
On Wed, 15 May 2024 18:45:16 GMT, ExE Boss wrote:
>> src/java.base/share/classes/jdk/internal/lang/stable/StableValueImpl.java
>> line 104:
>>
>>> 102: // Optimistically try plain semantics first
>>> 103: final V v = value;
>>> 104: if (v != null) {
>>
>> If `value ==
On Wed, 15 May 2024 18:49:49 GMT, ExE Boss wrote:
>> src/java.base/share/classes/jdk/internal/lang/stable/StableValueImpl.java
>> line 240:
>>
>>> 238: }
>>> 239: } finally {
>>> 240: supplying = false;
>>
>> Resetting a stable field is a bad idea.
On Wed, 15 May 2024 16:10:06 GMT, Chen Liang wrote:
>> Per Minborg has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> Switch to monomorphic StableValue and use lazy arrays
>
>
On Wed, 15 May 2024 15:27:34 GMT, Per Minborg wrote:
>> # Stable Values & Collections (Internal)
>>
>> ## Summary
>> This PR proposes to introduce an internal _Stable Values & Collections_ API,
>> which provides immutable value holders where elements are initialized _at
>> most once_. Stable
On Wed, 15 May 2024 15:27:34 GMT, Per Minborg wrote:
>> # Stable Values & Collections (Internal)
>>
>> ## Summary
>> This PR proposes to introduce an internal _Stable Values & Collections_ API,
>> which provides immutable value holders where elements are initialized _at
>> most once_. Stable
On Mon, 6 May 2024 19:31:43 GMT, Per Minborg wrote:
>> src/java.base/share/classes/jdk/internal/lang/StableArray.java line 25:
>>
>>> 23: * @since 23
>>> 24: */
>>> 25: public sealed interface StableArray
>>
>> Do we have a use case for StableArray beyond those of StableList?
>
> I am trying
On Wed, 15 May 2024 15:20:58 GMT, Per Minborg wrote:
>> At some point in the future, 'jdk.unsupported' will be removed
>
> Maybe there is a better home for this?
I don't think we should publish this API; this will soon be phased out by
strict final fields (written only before super constructor
On Tue, 14 May 2024 11:12:39 GMT, Per Minborg wrote:
>> src/hotspot/share/ci/ciField.cpp line 262:
>>
>>> 260: const char* stable_array3d_klass_name =
>>> "jdk/internal/lang/StableArray3D";
>>> 261:
>>> 262: static bool trust_final_non_static_fields_of_type(Symbol* signature) {
>>
>> Is
On Wed, 15 May 2024 15:27:34 GMT, Per Minborg wrote:
>> # Stable Values & Collections (Internal)
>>
>> ## Summary
>> This PR proposes to introduce an internal _Stable Values & Collections_ API,
>> which provides immutable value holders where elements are initialized _at
>> most once_. Stable
On Wed, 15 May 2024 08:53:32 GMT, ExE Boss wrote:
>> Per Minborg has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> Revise docs for ofBackground()
>
> src/java.base/share/classes/jdk/internal/lang/StableValue.java line 1:
>
>> 1: /*
>
>
> # Stable Values & Collections (Internal)
>
> ## Summary
> This PR proposes to introduce an internal _Stable Values & Collections_ API,
> which provides immutable value holders where elements are initialized _at
> most once_. Stable Values & Collections offer the performance and safety
>
On Wed, 15 May 2024 12:26:34 GMT, Rémi Forax wrote:
>> Given that `TrustedFieldType` is more generic than stable values, it could
>> be moved to `jdk.internal.misc` or `jdk.internal.reflect`, then
>> `jdk.unsupported` could use it without exporting new packages to
>> `jdk.unsupported`.
>
> At
On Wed, 15 May 2024 11:27:04 GMT, ExE Boss wrote:
>>> Maybe export this interface to `jdk.unsupported`?
>>
>> I don't we should do that. In general, we need jdk.unsupported to go away in
>> the long term. Also integrity of the platform depends on java.base being
>> very stingy and not
On Wed, 15 May 2024 10:43:52 GMT, Alan Bateman wrote:
>> src/java.base/share/classes/jdk/internal/lang/stable/TrustedFieldType.java
>> line 14:
>>
>>> 12: * operations.
>>> 13: */
>>> 14: public sealed interface TrustedFieldType
>>
>> Maybe export this interface to `jdk.unsupported`?
>
>>
On Wed, 15 May 2024 08:49:46 GMT, ExE Boss wrote:
> Maybe export this interface to `jdk.unsupported`?
I don't we should do that. In general, we need jdk.unsupported to go away in
the long term. Also integrity of the platform depends on java.base being very
stingy and not exporting internal
On Wed, 15 May 2024 07:48:42 GMT, Per Minborg wrote:
>> # Stable Values & Collections (Internal)
>>
>> ## Summary
>> This PR proposes to introduce an internal _Stable Values & Collections_ API,
>> which provides immutable value holders where elements are initialized _at
>> most once_. Stable
> # Stable Values & Collections (Internal)
>
> ## Summary
> This PR proposes to introduce an internal _Stable Values & Collections_ API,
> which provides immutable value holders where elements are initialized _at
> most once_. Stable Values & Collections offer the performance and safety
>
> # Stable Values & Collections (Internal)
>
> ## Summary
> This PR proposes to introduce an internal _Stable Values & Collections_ API,
> which provides immutable value holders where elements are initialized _at
> most once_. Stable Values & Collections offer the performance and safety
>
On Tue, 14 May 2024 16:02:41 GMT, Viktor Klang wrote:
>> Per Minborg has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> Remove text in public class that references an internal class
>
>
On Tue, 14 May 2024 14:51:20 GMT, Per Minborg wrote:
>> # Stable Values & Collections (Internal)
>>
>> ## Summary
>> This PR proposes to introduce an internal _Stable Values & Collections_ API,
>> which provides immutable value holders where elements are initialized _at
>> most once_. Stable
On Tue, 14 May 2024 14:51:20 GMT, Per Minborg wrote:
>> # Stable Values & Collections (Internal)
>>
>> ## Summary
>> This PR proposes to introduce an internal _Stable Values & Collections_ API,
>> which provides immutable value holders where elements are initialized _at
>> most once_. Stable
On Tue, 14 May 2024 14:19:44 GMT, Alan Bateman wrote:
>> Per Minborg has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> Remove text in public class that references an internal class
>
>
> # Stable Values & Collections (Internal)
>
> ## Summary
> This PR proposes to introduce an internal _Stable Values & Collections_ API,
> which provides immutable value holders where elements are initialized _at
> most once_. Stable Values & Collections offer the performance and safety
>
On Tue, 16 Apr 2024 11:47:23 GMT, Per Minborg wrote:
> # Stable Values & Collections (Internal)
>
> ## Summary
> This PR proposes to introduce an internal _Stable Values & Collections_ API,
> which provides immutable value holders where elements are initialized _at
> most once_. Stable Values
On Mon, 22 Apr 2024 09:34:39 GMT, Per Minborg wrote:
>> src/java.base/share/classes/jdk/internal/lang/stable/StableValueElement.java
>> line 116:
>>
>>> 114: public V computeIfUnset(Supplier supplier) {
>>> 115: // Todo: This creates a lambda
>>> 116: return
On Fri, 19 Apr 2024 09:32:56 GMT, ExE Boss wrote:
>> # Stable Values & Collections (Internal)
>>
>> ## Summary
>> This PR proposes to introduce an internal _Stable Values & Collections_ API,
>> which provides immutable value holders where elements are initialized _at
>> most once_. Stable
On Wed, 17 Apr 2024 13:23:53 GMT, Maurizio Cimadamore
wrote:
>> I see what you mean. Initially, I thought it would be easy to create
>> memorized functions but it turned out, that was not the case if one wants to
>> retain easy debugability etc. So, I have added a couple of factory methods
On Wed, 17 Apr 2024 11:12:37 GMT, Per Minborg wrote:
>> Yes, consider the 3 capture scenarios:
>> | API | Capture frequency | Capture Impact | Code Convenience | Flexibility |
>> |-|---||--|-|
>> | `StableValue.ofMap(map, k -> ...)`
On Mon, 22 Apr 2024 17:09:39 GMT, Chen Liang wrote:
>> src/java.base/share/classes/jdk/internal/lang/StableValue.java line 130:
>>
>>> 128: * } else {
>>> 129: * V newValue = supplier.get();
>>> 130: * stable.setOrThrow(newValue);
>>
>> If ::computeIfUnset allows racy
On Mon, 22 Apr 2024 16:16:39 GMT, Dan Heidinga wrote:
>> # Stable Values & Collections (Internal)
>>
>> ## Summary
>> This PR proposes to introduce an internal _Stable Values & Collections_ API,
>> which provides immutable value holders where elements are initialized _at
>> most once_. Stable
On Wed, 17 Apr 2024 14:24:59 GMT, Maurizio Cimadamore
wrote:
>> # Stable Values & Collections (Internal)
>>
>> ## Summary
>> This PR proposes to introduce an internal _Stable Values & Collections_ API,
>> which provides immutable value holders where elements are initialized _at
>> most
On Tue, 23 Apr 2024 12:18:53 GMT, Per Minborg wrote:
>> Good idea.
>
> Ahh. I thought you meant pattern matching in another place (which actually
> turned out to be a really good idea). Here, however, we also need to get the
> type parameters correct:
>
>
On Tue, 16 Apr 2024 11:47:23 GMT, Per Minborg wrote:
> # Stable Values & Collections (Internal)
>
> ## Summary
> This PR proposes to introduce an internal _Stable Values & Collections_ API,
> which provides immutable value holders where elements are initialized _at
> most once_. Stable Values
On Tue, 23 Apr 2024 12:22:25 GMT, Per Minborg wrote:
>> src/java.base/share/classes/java/lang/reflect/AccessibleObject.java line 193:
>>
>>> 191: * final fields declared in a {@linkplain Class#isHidden()
>>> hidden class}
>>> 192: * final fields declared in a {@linkplain
On Mon, 13 May 2024 12:18:28 GMT, Chen Liang wrote:
>> As we need the array in both cases, how would such a solution look like
>> without duplicating code?
>
> I was thinking about changing the StableEnumMap factory to directly take an
> EnumSet/BitSet indicating the indices without
On Tue, 23 Apr 2024 09:17:29 GMT, Per Minborg wrote:
>> src/java.base/share/classes/java/util/ImmutableCollections.java line 183:
>>
>>> 181:K key,
>>> 182:Function>> extends V> mapper) {
>>> 183:
On Tue, 14 May 2024 11:07:00 GMT, Per Minborg wrote:
>> # Stable Values & Collections (Internal)
>>
>> ## Summary
>> This PR proposes to introduce an internal _Stable Values & Collections_ API,
>> which provides immutable value holders where elements are initialized _at
>> most once_. Stable
On Mon, 22 Apr 2024 16:31:15 GMT, Dan Heidinga wrote:
>> # Stable Values & Collections (Internal)
>>
>> ## Summary
>> This PR proposes to introduce an internal _Stable Values & Collections_ API,
>> which provides immutable value holders where elements are initialized _at
>> most once_. Stable
On Tue, 16 Apr 2024 11:47:23 GMT, Per Minborg wrote:
> # Stable Values & Collections (Internal)
>
> ## Summary
> This PR proposes to introduce an internal _Stable Values & Collections_ API,
> which provides immutable value holders where elements are initialized _at
> most once_. Stable Values
On Tue, 16 Apr 2024 11:47:23 GMT, Per Minborg wrote:
> # Stable Values & Collections (Internal)
>
> ## Summary
> This PR proposes to introduce an internal _Stable Values & Collections_ API,
> which provides immutable value holders where elements are initialized _at
> most once_. Stable Values
# Stable Values & Collections (Internal)
## Summary
This PR proposes to introduce an internal _Stable Values & Collections_ API,
which provides immutable value holders where elements are initialized _at most
once_. Stable Values & Collections offer the performance and safety benefits of
final
On Wed, 17 Apr 2024 15:17:52 GMT, Per Minborg wrote:
>> Also, I want to mention a few important differences between `@Stable` and
>> Stable Values:
>>
>> Patterns:
>> 1. Benign race (does not exist in StableValue API): multiple threads can
>> create an instance and upload, any non-null
On Wed, 17 Apr 2024 14:07:05 GMT, Chen Liang wrote:
> Question:
>
> 1. Will we ever try to expose the stable benign race model to users?
> 2. Will we ever try to inline the stable values in object layout like a
> stable field?
1. I think there is little or no upside in exposing the benign
On Tue, 16 Apr 2024 11:47:23 GMT, Per Minborg wrote:
> # Stable Values & Collections (Internal)
>
> ## Summary
> This PR proposes to introduce an internal _Stable Values & Collections_ API,
> which provides immutable value holders where elements are initialized _at
> most once_. Stable Values
On Wed, 17 Apr 2024 15:17:52 GMT, Per Minborg wrote:
>> Also, I want to mention a few important differences between `@Stable` and
>> Stable Values:
>>
>> Patterns:
>> 1. Benign race (does not exist in StableValue API): multiple threads can
>> create an instance and upload, any non-null
On Tue, 16 Apr 2024 11:47:23 GMT, Per Minborg wrote:
> # Stable Values & Collections (Internal)
>
> ## Summary
> This PR proposes to introduce an internal _Stable Values & Collections_ API,
> which provides immutable value holders where elements are initialized _at
> most once_. Stable Values
85 matches
Mail list logo