From 98ee63693d963e96ac7d81ac33a5b12103b577b3 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Mon, 22 Apr 2019 16:23:04 -0700 Subject: Symbols can move, so don't cache in static pointer This changes the static pointers to use IDs then look up the symbols with the ID. Symbols can move, so we don't want to keep static references to them. --- iseq.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/iseq.c b/iseq.c index 0ead40fec2..878fed8120 100644 --- a/iseq.c +++ b/iseq.c @@ -2501,10 +2501,10 @@ ruby_node_name(int node) } #define DECL_SYMBOL(name) \ - static VALUE sym_##name + static ID sym_##name #define INIT_SYMBOL(name) \ - sym_##name = ID2SYM(rb_intern(#name)) + sym_##name = rb_intern(#name) static VALUE register_label(struct st_table *table, unsigned long idx) @@ -2551,7 +2551,7 @@ iseq_data_to_ary(const rb_iseq_t *iseq) VALUE *seq, *iseq_original; VALUE val = rb_ary_new(); - VALUE type; /* Symbol */ + ID type; /* Symbol */ VALUE locals = rb_ary_new(); VALUE params = rb_hash_new(); VALUE body = rb_ary_new(); /* [[:insn1, ...], ...] */ @@ -2559,7 +2559,7 @@ iseq_data_to_ary(const rb_iseq_t *iseq) VALUE exception = rb_ary_new(); /* [[....]] */ VALUE misc = rb_hash_new(); - static VALUE insn_syms[VM_INSTRUCTION_SIZE/2]; /* w/o-trace only */ + static ID insn_syms[VM_INSTRUCTION_SIZE/2]; /* w/o-trace only */ struct st_table *labels_table = st_init_numtable(); DECL_SYMBOL(top); @@ -2575,7 +2575,7 @@ iseq_data_to_ary(const rb_iseq_t *iseq) if (sym_top == 0) { int i; for (i=0; ilocation.first_lineno); - rb_ary_push(val, type); + rb_ary_push(val, ID2SYM(type)); rb_ary_push(val, locals); rb_ary_push(val, params); rb_ary_push(val, exception); -- cgit v1.2.3