diff options
author | yui-knk <[email protected]> | 2024-01-12 07:38:02 +0900 |
---|---|---|
committer | Yuichiro Kaneko <[email protected]> | 2024-01-12 21:17:41 +0900 |
commit | b35e21b3889e95cf727f2da49abb881c3466bc75 (patch) | |
tree | 83905792922f90dfaa48f00282d51f64d4d8844d | |
parent | 52d9e55903b2e72022ba90079cb23c6f2cd03af5 (diff) |
Remove reference counter from rb_parser_config
It's allocated outside of parser then no need to track
reference count in rb_parser_config.
-rw-r--r-- | node.c | 1 | ||||
-rw-r--r-- | parse.y | 1 | ||||
-rw-r--r-- | ruby_parser.c | 2 | ||||
-rw-r--r-- | rubyparser.h | 8 |
4 files changed, 0 insertions, 12 deletions
@@ -321,7 +321,6 @@ rb_ast_t * rb_ast_new(rb_parser_config_t *config) { node_buffer_t *nb = rb_node_buffer_new(config); - config->counter++; return config->ast_new((VALUE)nb); } #else @@ -15970,7 +15970,6 @@ rb_ruby_parser_allocate(rb_parser_config_t *config) /* parser_initialize expects fields to be set to 0 */ rb_parser_t *p = (rb_parser_t *)config->calloc(1, sizeof(rb_parser_t)); p->config = config; - p->config->counter++; return p; } diff --git a/ruby_parser.c b/ruby_parser.c index 9f9b680646..47dc54df6c 100644 --- a/ruby_parser.c +++ b/ruby_parser.c @@ -618,8 +618,6 @@ extern VALUE rb_mRubyVMFrozenCore; VALUE rb_node_case_when_optimizable_literal(const NODE *const node); rb_parser_config_t rb_global_parser_config = (rb_parser_config_t) { - .counter = 0, - .malloc = ruby_xmalloc, .calloc = ruby_xcalloc, .realloc = ruby_xrealloc, diff --git a/rubyparser.h b/rubyparser.h index e78df79e7a..974a03992c 100644 --- a/rubyparser.h +++ b/rubyparser.h @@ -1194,14 +1194,6 @@ typedef struct rb_imemo_tmpbuf_struct rb_imemo_tmpbuf_t; #ifdef UNIVERSAL_PARSER typedef struct rb_parser_config_struct { - /* - * Reference counter. - * This is needed because both parser and ast refer - * same config pointer. - * We can remove this, once decuple parser and ast from Ruby GC. - */ - int counter; - /* Memory */ void *(*malloc)(size_t size); void *(*calloc)(size_t number, size_t size); |