Remove reference counter from rb_parser_config
It's allocated outside of parser then no need to track reference count in rb_parser_config.
This commit is contained in:
parent
52d9e55903
commit
b35e21b388
1
node.c
1
node.c
@ -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
|
||||
|
1
parse.y
1
parse.y
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user