Explicit write barrier for binding
MODIFY
mrbgems/mruby-binding-core/src/binding-core.c
mrbgems/mruby-binding-core/src/binding-core.c
@@ -151,6 +151,9 @@ binding_local_variable_set(mrb_state *mrb, mrb_value self)
mrb_value *e = binding_local_variable_search(mrb, proc, env, varname);
if (e) {
*e = obj;
+ if (!mrb_immediate_p(obj)) {
+ mrb_field_write_barrier(mrb, (struct RBasic*)env, (struct RBasic*)mrb_obj_ptr(obj));
+ }
}
else {
mrb_proc_merge_lvar(mrb, (mrb_irep*)proc->body.irep, env, 1, &varname, &obj);

MODIFY
src/proc.c
src/proc.c
@@ -419,6 +419,11 @@ mrb_proc_merge_lvar(mrb_state *mrb, mrb_irep *irep, struct REnv *env, int num, c
memmove(destlv, lv, sizeof(mrb_sym) * num);
if (stack) {
memmove(destst, stack, sizeof(mrb_value) * num);
+ for (int i = 0; i < num; i++) {
+ if (!mrb_immediate_p(stack[i])) {
+ mrb_field_write_barrier(mrb, (struct RBasic*)env, (struct RBasic*)mrb_obj_ptr(stack[i]));
+ }
+ }
}
else {
for (int i = num; i > 0; i--, destst++) {

Explicit write barrier for binding