Skip to content

Commit af0d6eb

Browse files
committed
[mono][interp] Add missing GC wbarriers for static field stores in collectible assemblies
1 parent 245859e commit af0d6eb

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/mono/mono/mini/interp/transform.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4644,7 +4644,12 @@ interp_emit_sfld_access (TransformData *td, MonoClassField *field, MonoClass *fi
46444644
}
46454645
interp_ins_set_dreg (td->last_ins, td->sp [-1].var);
46464646
} else {
4647-
if (G_UNLIKELY (m_field_is_from_update (field)) && (mt == MINT_TYPE_VT || mt == MINT_TYPE_O)) {
4647+
// Fields from hotreload update and fields from collectible assemblies are not
4648+
// stored inside fixed gc roots but rather in other objects. This means that
4649+
// storing into these fields requires write barriers.
4650+
if ((mt == MINT_TYPE_VT || mt == MINT_TYPE_O) &&
4651+
(m_field_is_from_update (field) ||
4652+
mono_image_get_alc (m_class_get_image (m_field_get_parent (field)))->collectible)) {
46484653
interp_emit_ldsflda (td, field, error);
46494654
return_if_nok (error);
46504655
interp_emit_stobj (td, field_class, TRUE);

0 commit comments

Comments
 (0)