node.h: Reduce struct size to fit with Ruby object size (five VALUEs)

by merging `rb_ast_body_t#line_count` and `#script_lines`.

Fortunately `line_count == RARRAY_LEN(script_lines)` was always
satisfied. When script_lines is saved, it has an array of lines, and
when not saved, it has a Fixnum that represents the old line_count.
This commit is contained in:
Yusuke Endoh 2021-06-18 01:31:50 +09:00
parent acae5f363d
commit fb01411ae8
Notes: git 2021-06-18 02:34:57 +09:00
6 changed files with 19 additions and 8 deletions

4
node.h
View file

@ -398,8 +398,10 @@ typedef struct node_buffer_struct node_buffer_t;
typedef struct rb_ast_body_struct {
const NODE *root;
VALUE compile_option;
int line_count;
VALUE script_lines;
// script_lines is either:
// - a Fixnum that represents the line count of the original source, or
// - an Array that contains the lines of the original source
} rb_ast_body_t;
typedef struct rb_ast_struct {
VALUE flags;