Need to insert write barriers in struct updates; fix #3547

This commit is contained in:
Yukihiro "Matz" Matsumoto
2017-04-05 11:53:20 +09:00
parent bdeb803f04
commit 74712c73ac
+2
View File
@@ -449,6 +449,7 @@ mrb_struct_aset_sym(mrb_state *mrb, mrb_value s, mrb_sym id, mrb_value val)
for (i=0; i<len; i++) {
if (mrb_symbol(ptr_members[i]) == id) {
ptr[i] = val;
mrb_write_barrier(mrb, (struct RBasic*)mrb_ptr(s));
return val;
}
}
@@ -511,6 +512,7 @@ mrb_struct_aset(mrb_state *mrb, mrb_value s)
"offset %S too large for struct(size:%S)",
mrb_fixnum_value(i), mrb_fixnum_value(RSTRUCT_LEN(s)));
}
mrb_write_barrier(mrb, (struct RBasic*)mrb_ptr(s));
return RSTRUCT_PTR(s)[i] = val;
}