RFR: 8333791: Fix memory barriers for @Stable fields

Aleksey Shipilev shade at openjdk.org
Tue Jul 16 09:56:57 UTC 2024


On Mon, 15 Jul 2024 23:29:37 GMT, Paul Sandoz <psandoz at openjdk.org> wrote:

> IIUC this means we can remove the explicit fence here:
> 
> ```
>     public ConstantCallSite(MethodHandle target) {
>         super(target);
>         isFrozen = true;
>         UNSAFE.storeStoreFence(); // properly publish isFrozen update
>     }
> ```

I think so, but there is more to it: there are other fences around the `CallSite`-s that might be simplified. I would prefer not to do it any of usage changes in this PR. Separately, I tried to benchmark `new ConstantCallSite(MH)` just to see if these barriers are merged, and quickly realized there is a bunch of `MethodHandleNatives$CallSiteContext` with `Cleaners` get instantiated for every `CCS` created, which completely dominates any wins we get from removing this fence.

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

PR Comment: https://git.openjdk.org/jdk/pull/19635#issuecomment-2230489134


More information about the hotspot-dev mailing list