summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2021-04-27 15:32:42 +0900
committerYusuke Endoh <mame@ruby-lang.org>2021-04-27 17:05:19 +0900
commitd405b1a878ebaf57f2374d557239d87c8065260a (patch)
tree2485b6cdf74b73c18885f195d206572e9b8293f0 /parse.y
parente48109d86fa06584a79610ecd5cb16f0bbd64e8c (diff)
Make imemo_ast WB-protected again
by firing the write barrier of imemo_ast after nd_lit is modified. This will fix the issue of https://github.com/ruby/ruby/pull/4416 more gracefully.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4419
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y6
1 files changed, 5 insertions, 1 deletions
diff --git a/parse.y b/parse.y
index 909a4ec3b18..6909e9c777e 100644
--- a/parse.y
+++ b/parse.y
@@ -11072,6 +11072,7 @@ const_decl_path(struct parser_params *p, NODE **dest)
path = rb_fstring(path);
}
*dest = n = NEW_LIT(path, loc);
+ RB_OBJ_WRITTEN(p->ast, Qnil, n->nd_lit);
}
return n;
}
@@ -11159,7 +11160,9 @@ shareable_literal_constant(struct parser_params *p, enum shareability shareable,
case NODE_ZLIST:
lit = rb_ary_new();
OBJ_FREEZE_RAW(lit);
- return NEW_LIT(lit, loc);
+ NODE *n = NEW_LIT(lit, loc);
+ RB_OBJ_WRITTEN(p->ast, Qnil, n->nd_lit);
+ return n;
case NODE_LIST:
lit = rb_ary_new();
@@ -11245,6 +11248,7 @@ shareable_literal_constant(struct parser_params *p, enum shareability shareable,
}
else {
value = NEW_LIT(rb_ractor_make_shareable(lit), loc);
+ RB_OBJ_WRITTEN(p->ast, Qnil, value->nd_lit);
}
return value;