Closed yowl closed 3 years ago
RyuJIT codegen stores GC reference statics on the GC heap. Is wasm codegen using a different scheme?
@jkotas RhpAssignRef
sets the card table bits which are used for incremental marking during ephemeral GCs, is my assumption wrong that this only applies to references stored into the bounds of UOH / Gen2 and not statics (which i've assumed to be always marked completely)?
Both CoreCLR and CoreRT (w/ RyuJIT codegen at least) store statics in fake objects allocated on GC heap. It means that write barriers are needed for updates.
It is a trade-off:
C
where it is common for everything to be stored in statics. Avoiding the write barriers makes them run faster.My bad assumption, closing.
This PR changes the implementation of
stsfld
so thatRhpAssignRef
is not called when storing a gc pointer in a static field. For example, previous to this change, https://github.com/dotnet/corert/blob/145402e00724acbc9e7636739140fb84f7d64845/src/System.Private.CoreLib/shared/System/AttributeUsageAttribute.cs#L23 resulted in a call toRhpAssignRef
in the cctor.