ruby-changes:48622
From: mame <ko1@a...>
Date: Fri, 10 Nov 2017 22:46:44 +0900 (JST)
Subject: [ruby-changes:48622] mame:r60737 (trunk): Make `rb_ast_dispose` use `RB_OBJ_WRITE`
mame 2017-11-10 22:46:38 +0900 (Fri, 10 Nov 2017) New Revision: 60737 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60737 Log: Make `rb_ast_dispose` use `RB_OBJ_WRITE` This fixes the mistake of r60722. I used `rb_gc_writebarrier_remember` to notify to GC that the references is changed. But the function just adds the object to the remember set blindly. Ko1 told me that `RB_OBJ_WRITE` is suitable in this case. Modified files: trunk/node.c Index: node.c =================================================================== --- node.c (revision 60736) +++ node.c (revision 60737) @@ -1147,17 +1147,17 @@ rb_ast_mark(rb_ast_t *ast) https://github.com/ruby/ruby/blob/trunk/node.c#L1147 void rb_ast_free(rb_ast_t *ast) { - if (ast->node_buffer) rb_node_buffer_free(ast->node_buffer); - ast->node_buffer = 0; - ast->root = 0; - ast->mark_ary = 0; + if (ast->node_buffer) { + rb_node_buffer_free(ast->node_buffer); + ast->node_buffer = 0; + } } void rb_ast_dispose(rb_ast_t *ast) { rb_ast_free(ast); - rb_gc_writebarrier_remember((VALUE)ast); + RB_OBJ_WRITE(ast, &ast->mark_ary, Qnil); } void -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/