ruby/template
HASUMI Hitoshi 2244c58b00 [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.

## 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`
  - Remove the `VALUE flags` member from `rb_ast_t`
- `ruby_parser.c` and `internal/ruby_parser.h`
  - Use TypedData_Make_Struct VALUE which wraps `rb_ast_t` `in ast_alloc()` so that GC can manage it
    - You can retrieve `rb_ast_t` from the VALUE by `rb_ruby_ast_data_get()`
  - Change the return type of `rb_parser_compile_XXXX()` functions from `rb_ast_t *` to `VALUE`
  - rb_ruby_ast_new() which internally `calls ast_alloc()` is to create VALUE vast outside ruby_parser.c
- `iseq.c` and `vm_core.h`
  - Amend the first parameter of `rb_iseq_new_XXXX()` functions from `rb_ast_body_t *` to `VALUE`
  - This keeps the VALUE of AST on the machine stack to prevent being removed by GC
- `ast.c`
  - Almost all change is replacement `rb_ast_t *ast` with `VALUE vast` (sorry for the big diff)
  - Fix `node_memsize()`
    - Now it includes `rb_ast_local_table_link`, `tokens` and script_lines
- `compile.c`, `load.c`, `node.c`, `parse.y`, `proc.c`, `ruby.c`, `template/prelude.c.tmpl`, `vm.c` and `vm_eval.c`
  - Follow-up due to the above changes
- `imemo.{c|h}`
  - If an object with `imemo_ast` appears, considers it a bug

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2024-04-26 11:21:08 +09:00
..
Doxyfile.tmpl Remove never used macros related to RJIT [ci skip] 2024-03-24 22:37:20 +09:00
GNUmakefile.in Remove duplicate dependency line 2024-03-08 11:58:41 +09:00
Makefile.in Realclean extracted bundled gems and lock files 2024-04-11 23:47:32 +09:00
builtin_binary.inc.tmpl Revert "Disable iseq-dumped builtin module for universal x86_64/arm64 binaries" 2023-11-09 16:01:01 +09:00
call_iseq_optimized.inc.tmpl
configure-ext.mk.tmpl Remove `--jobserver-auth` option which varies for each run 2023-06-19 18:28:10 +09:00
depend.tmpl
encdb.h.tmpl Refactor encdb and transdb templates 2024-03-17 19:09:37 +09:00
extinit.c.tmpl Alias init functions 2024-02-04 16:43:09 +09:00
exts.mk.tmpl Ignore failures on removing ext sub directories 2024-03-11 00:46:15 +09:00
fake.rb.in [Bug #19967] Reset `LIBPATHENV` env after started 2023-10-21 14:05:20 +09:00
id.c.tmpl Generate token ID indexes in id.def 2022-09-08 18:18:56 +09:00
id.h.tmpl Add comments to id.h and undef finished macros 2023-07-21 14:52:43 +09:00
known_errors.inc.tmpl [DOC] Documentize known_errors 2024-01-13 11:08:00 +09:00
limits.c.tmpl
prelude.c.tmpl [Universal parser] Decouple IMEMO from rb_ast_t 2024-04-26 11:21:08 +09:00
ruby-gdb.in
ruby-lldb.in
ruby-runner.h.in
ruby.pc.in Use RUBY_PROGRAM_VERSION as version in pkg-config file [ci skip] 2023-04-13 11:31:34 +09:00
sizes.c.tmpl Fix trivial -Wundef warnings 2021-05-04 14:56:55 +02:00
transdb.h.tmpl Refactor encdb and transdb templates 2024-03-17 19:09:37 +09:00
unicode_norm_gen.tmpl
unicode_properties.rdoc.tmpl [Bug #19728] Auto-generate unicode property docs 2023-07-01 23:22:17 +09:00
verconf.h.tmpl