RFR: 8285301: C2: assert(!requires_atomic_access) failed: can't ensure atomicity

Vladimir Kozlov kvn at openjdk.java.net
Wed Apr 27 20:13:41 UTC 2022


On Wed, 27 Apr 2022 10:25:36 GMT, Tobias Hartmann <thartmann at openjdk.org> wrote:

> We hit asserts in `BarrierSetC2::load_at_resolved` and `BarrierSetC2::store_at_resolved` when running with `-XX:+AlwaysAtomicAccesses` because the corresponding code paths have not been implemented yet. Although the assert triggers on all platforms, it only affects long and double accesses on 32-bit systems (everything else is atomic anyway).
> 
> I moved the `requires_atomic_access` logic into `LoadNode::make` and `StoreNode::make` and refactored related code.
> 
> I noticed that `LoadNode::convert_to_reinterpret_load` and `StoreNode::convert_to_reinterpret_store` did not properly check for `requires_atomic_access` and fixed that as well.
> 
> I'm currently running all tests with `-XX:+AlwaysAtomicAccesses`.
> 
> Thanks,
> Tobias

src/hotspot/share/opto/memnode.cpp line 1300:

> 1298:   }
> 1299:   bool require_atomic_access = (Opcode() == Op_LoadL && ((LoadLNode*)this)->require_atomic_access()) ||
> 1300:                                (Opcode() == Op_LoadD && ((LoadDNode*)this)->require_atomic_access());

You can call `Opcode()` only once (it is virtual call - expensive).

src/hotspot/share/opto/memnode.cpp line 1322:

> 1320:   assert(has_reinterpret_variant(vt), "no reinterpret variant: %s %s", Name(), type2name(bt));
> 1321:   bool require_atomic_access = (Opcode() == Op_StoreL && ((StoreLNode*)this)->require_atomic_access()) ||
> 1322:                                (Opcode() == Op_StoreD && ((StoreDNode*)this)->require_atomic_access());

Call `Opcode()` once.

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

PR: https://git.openjdk.java.net/jdk/pull/8422


More information about the hotspot-dev mailing list