[前][次][番号順一覧][スレッド一覧]

ruby-changes:65975

From: Yusuke <ko1@a...>
Date: Tue, 27 Apr 2021 17:05:45 +0900 (JST)
Subject: [ruby-changes:65975] d405b1a878 (master): Make imemo_ast WB-protected again

https://git.ruby-lang.org/ruby.git/commit/?id=d405b1a878

From d405b1a878ebaf57f2374d557239d87c8065260a Mon Sep 17 00:00:00 2001
From: Yusuke Endoh <mame@r...>
Date: Tue, 27 Apr 2021 15:32:42 +0900
Subject: 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.
---
 parse.y | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/parse.y b/parse.y
index 909a4ec..6909e9c 100644
--- a/parse.y
+++ b/parse.y
@@ -11072,6 +11072,7 @@ const_decl_path(struct parser_params *p, NODE **dest) https://github.com/ruby/ruby/blob/trunk/parse.y#L11072
 	    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, https://github.com/ruby/ruby/blob/trunk/parse.y#L11160
       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, https://github.com/ruby/ruby/blob/trunk/parse.y#L11248
     }
     else {
 	value = NEW_LIT(rb_ractor_make_shareable(lit), loc);
+        RB_OBJ_WRITTEN(p->ast, Qnil, value->nd_lit);
     }
 
     return value;
-- 
cgit v1.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]