ruby-changes:57713
From: Aaron <ko1@a...>
Date: Wed, 11 Sep 2019 04:42:59 +0900 (JST)
Subject: [ruby-changes:57713] 139510238b (master): WB needs to be executed after object is reachable
https://git.ruby-lang.org/ruby.git/commit/?id=139510238b From 139510238bcbb8d7fd8022c23a603c51d2acbe2e Mon Sep 17 00:00:00 2001 From: Aaron Patterson <tenderlove@r...> Date: Tue, 10 Sep 2019 11:27:40 -0700 Subject: WB needs to be executed after object is reachable diff --git a/node.h b/node.h index d39cae8..6d4ee68 100644 --- a/node.h +++ b/node.h @@ -284,7 +284,12 @@ typedef struct RNode { https://github.com/ruby/ruby/blob/trunk/node.h#L284 #define NEW_DEFN(i,a,d,loc) NEW_NODE(NODE_DEFN,0,i,NEW_SCOPE(a,d,loc),loc) #define NEW_DEFS(r,i,a,d,loc) NEW_NODE(NODE_DEFS,r,i,NEW_SCOPE(a,d,loc),loc) -#define NEW_SCOPE(a,b,loc) NEW_NODE(NODE_SCOPE,local_tbl(p),b,a,loc) +#define NEW_SCOPE(a,b,loc) ({ \ + VALUE tbl = 0; \ + NODE * _n = NEW_NODE(NODE_SCOPE,local_tbl(p, &tbl),b,a,loc); \ + tbl && RB_OBJ_WRITTEN(p->ast, Qnil, tbl); \ + _n; \ +}) #define NEW_BLOCK(a,loc) NEW_NODE(NODE_BLOCK,a,0,0,loc) #define NEW_IF(c,t,e,loc) NEW_NODE(NODE_IF,c,t,e,loc) #define NEW_UNLESS(c,t,e,loc) NEW_NODE(NODE_UNLESS,c,t,e,loc) diff --git a/parse.y b/parse.y index 852a5ed..a7d43b7 100644 --- a/parse.y +++ b/parse.y @@ -465,7 +465,7 @@ static NODE *symbol_append(struct parser_params *p, NODE *symbols, NODE *symbol) https://github.com/ruby/ruby/blob/trunk/parse.y#L465 static NODE *match_op(struct parser_params*,NODE*,NODE*,const YYLTYPE*,const YYLTYPE*); -static ID *local_tbl(struct parser_params*); +static ID *local_tbl(struct parser_params*, VALUE *tmp); static VALUE reg_compile(struct parser_params*, VALUE, int); static void reg_fragment_setenc(struct parser_params*, VALUE, int); @@ -11144,8 +11144,8 @@ new_args_tail(struct parser_params *p, NODE *kw_args, ID kw_rest_arg, ID block, https://github.com/ruby/ruby/blob/trunk/parse.y#L11144 args = ZALLOC(struct rb_args_info); VALUE tmpbuf = rb_imemo_tmpbuf_auto_free_pointer(args); args->imemo = tmpbuf; - RB_OBJ_WRITTEN(p->ast, Qnil, tmpbuf); node = NEW_NODE(NODE_ARGS, 0, 0, args, &NULL_LOC); + RB_OBJ_WRITTEN(p->ast, Qnil, tmpbuf); if (p->error_p) return node; args->block_arg = block; @@ -11633,7 +11633,7 @@ local_pop(struct parser_params *p) https://github.com/ruby/ruby/blob/trunk/parse.y#L11633 #ifndef RIPPER static ID* -local_tbl(struct parser_params *p) +local_tbl(struct parser_params *p, VALUE *tmp) { int cnt_args = vtable_size(p->lvtbl->args); int cnt_vars = vtable_size(p->lvtbl->vars); @@ -11655,8 +11655,8 @@ local_tbl(struct parser_params *p) https://github.com/ruby/ruby/blob/trunk/parse.y#L11655 buf[0] = cnt; VALUE tmpbuf = rb_imemo_tmpbuf_auto_free_pointer(buf); + *tmp = tmpbuf; buf[cnt + 1] = (ID)tmpbuf; - RB_OBJ_WRITTEN(p->ast, Qnil, tmpbuf); return buf; } -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/