[Universal parser] Decouple IMEMO from rb_ast_t
This patch removes the VALUE flags member from the rb_ast_t structure making rb_ast_t no longer an IMEMO object.
VALUE flags
rb_ast_t
We are trying to make the Ruby parser generated from parse.y a universal parser that can be used by other implementations such as mruby. To achieve this, it is necessary to exclude VALUE and IMEMO from parse.y, AST, and NODE.
rubyparser.h
ruby_parser.c
internal/ruby_parser.h
in ast_alloc()
rb_ruby_ast_data_get()
rb_parser_compile_XXXX()
rb_ast_t *
VALUE
calls ast_alloc()
iseq.c
vm_core.h
rb_iseq_new_XXXX()
rb_ast_body_t *
ast.c
rb_ast_t *ast
VALUE vast
node_memsize()
rb_ast_local_table_link
tokens
compile.c
load.c
node.c
parse.y
proc.c
ruby.c
template/prelude.c.tmpl
vm.c
vm_eval.c
imemo.{c|h}
imemo_ast
Co-authored-by: Nobuyoshi Nakada [email protected]
[Universal parser] Decouple IMEMO from rb_ast_t
This patch removes the
VALUE flags
member from therb_ast_t
structure makingrb_ast_t
no longer an IMEMO object.Background¶
We are trying to make the Ruby parser generated from parse.y a universal parser that can be used by other implementations such as mruby.
To achieve this, it is necessary to exclude VALUE and IMEMO from parse.y, AST, and NODE.
Summary (file by file)¶
rubyparser.h
VALUE flags
member fromrb_ast_t
ruby_parser.c
andinternal/ruby_parser.h
rb_ast_t
in ast_alloc()
so that GC can manage itrb_ast_t
from the VALUE byrb_ruby_ast_data_get()
rb_parser_compile_XXXX()
functions fromrb_ast_t *
toVALUE
calls ast_alloc()
is to create VALUE vast outside ruby_parser.ciseq.c
andvm_core.h
rb_iseq_new_XXXX()
functions fromrb_ast_body_t *
toVALUE
ast.c
rb_ast_t *ast
withVALUE vast
(sorry for the big diff)node_memsize()
rb_ast_local_table_link
,tokens
and script_linescompile.c
,load.c
,node.c
,parse.y
,proc.c
,ruby.c
,template/prelude.c.tmpl
,vm.c
andvm_eval.c
imemo.{c|h}
imemo_ast
appears, considers it a bugCo-authored-by: Nobuyoshi Nakada [email protected]