RFR: 8332670: C1 clone intrinsic needs memory barriers

Galder Zamarreño galder at openjdk.org
Wed Jun 5 15:14:58 UTC 2024


On Tue, 4 Jun 2024 08:43:04 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

> All right, that looks reasonable.
> 
> I am a bit queasy on conditionally removing the `StoreStore` barrier from the allocation path, given that it also protects the object metadata. An accidentally missing barrier would probably lead to VM crash, that is in the best case. Current code paths do not seem to be affected by this, but there is also no guardrails that would protect us from making such a mistake in the future: someone adds `new NewTypeArray` somewhere, and forgets a trailing barrier?
> 
> What would be the cost of still emitting (an excess for cloning path) `StoreStore` in `C1_MacroAssembler::allocate_array`? Would that cost still matter, given the performance improvement we get with C1 clone intrinsic?

Let me make sure I understand this right: you are suggesting removing the `if (zero_array)` branch and instead always emit storestore barrier, as well as the storestore barrier at the end of `append_alloc_array_copy`?

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

PR Comment: https://git.openjdk.org/jdk/pull/19538#issuecomment-2150323145


More information about the hotspot-compiler-dev mailing list