-
Notifications
You must be signed in to change notification settings - Fork 38
Description
OpenJDK uses template DecoratorSet
to describe certain memory access. For example, HeapAccess<AS_NO_KEEPALIVE>::oop_store_at
where oop_store_at
is expected to take AS_NO_KEEPALIVE
into consideration in its implementation.
// A decorator is an attribute or property that affects the way a memory access is performed in some way.
// There are different groups of decorators. Some have to do with memory ordering, others to do with,
// e.g. strength of references, strength of GC barriers, or whether compression should be applied or not.
// Some decorators are set at buildtime, such as whether primitives require GC barriers or not, others
// at callsites such as whether an access is in the heap or not, and others are resolved at runtime
// such as GC-specific barriers and encoding/decoding compressed oops.
typedef uint64_t DecoratorSet;
However, we cannot access DecoratorSet
in each MMTk barrier implementation (such as MMTkObjectBarrierSetRuntime
, or MMTkSATBBarrierSetRuntime
).
The reason is that MMTk is registered as a single third-party GC for OpenJDK, and OpenJDK expects one BarrierSet
implementation for each GC. Thus MMTk only has one MMTkBarrierSet
(and one corresponding AccessBarrier
where you can access DecoratorSet
). To support multiple MMTk GC plans, the binding creates its own barrier interface, and uses virtual dispatch in MMTkBarrierSet
/AccessBarrier
to each MMTkBarrierSetRuntime
. The template type DecoratorSet
cannot be passed to MMTkBarrierSetRuntime
via virtual dispatch. And the last place where we can access Decoratorset
is in MMTkBarrierSet
which is used for all MMTk plans. This is not ideal.
This caused issues when I tried to implement #311 (comment). Also some code introduced with concurrent Immix to MMTkBarrierSet
that uses DecoratorSet
may only apply to concurrent Immix, but now it is used for all the MMTk plans: https://github.com/tianleq/mmtk-openjdk/blob/0d869df5438f286e4110b26361d09bf82983f3b2/openjdk/mmtkBarrierSet.hpp#L188