Permalink
Browse files

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

  • Loading branch information...
matz committed Apr 5, 2017
1 parent bdeb803 commit 74712c73ac9471fd388d76b0f12229ec428d5146
Showing with 2 additions and 0 deletions.
  1. +2 −0 mrbgems/mruby-struct/src/struct.c
@@ -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;
}

0 comments on commit 74712c7

Please sign in to comment.