RFR: 8356255: Add Stable Field Updaters to allow efficient lazy field evaluations [v4]

Chen Liang liach at openjdk.org
Wed May 7 12:57:17 UTC 2025


On Wed, 7 May 2025 09:23:45 GMT, Per Minborg <pminborg at openjdk.org> wrote:

>> This sketch shows how "Stable Updaters" can be used to create stable computations of `@Stable` fields. Only one updater is needed per class, similar to `AtomicIntegerFieldUpdater`.
>
> Per Minborg has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - Reformat
>  - Revert changes in public classes

The MH+VH form should be much more lightweight: MH and VH are just MemberName references.

I wonder if we can advertise the MH+VH version as an indy BSM:

public static CallSite lazyAccessor(Lookup lookup, String unused, MethodType callType, VarHandle field, MethodHandle computer)


The CallSite would be constant, with `StableIntFieldUpdaterVarHandle.applyAsInt` bound to the specific updater. This way, we can even defer the creation of the updater.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/25040#issuecomment-2858487803


More information about the net-dev mailing list