diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-07-07 05:36:25 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-07-07 05:36:25 +0000 |
commit | 8572ed5c0d98a8edaee7e0e433d632c3ca3f5821 (patch) | |
tree | bbfa8fb0d9963cfe5ca485e3686de5db5a42a852 /parse.y | |
parent | 2e225e2c8b1623f42937b68d5511379d2a73de4c (diff) | |
download | ruby-8572ed5c0d98a8edaee7e0e433d632c3ca3f5821.tar.gz |
* parse.y: remove global_symbols::pinned_dsym
(and ::pinned_dsym_minor_marked).
Mark pinned dsymbols by rb_gc_register_mark_object() because
they are immortal.
* prase.y (rb_gc_free_dsymbol): rename parameter name `ptr' to `sym'.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46749 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 28 |
1 files changed, 12 insertions, 16 deletions
@@ -10152,9 +10152,7 @@ static struct symbols { ID last_id; st_table *str_id; st_table *id_str; - st_table *pinned_dsym; int minor_marked; - int pinned_dsym_minor_marked; } global_symbols = {tLAST_TOKEN}; static const struct st_hash_type symhash = { @@ -10167,7 +10165,6 @@ Init_sym(void) { global_symbols.str_id = st_init_table_with_size(&symhash, 1000); global_symbols.id_str = st_init_numtable_with_size(1000); - global_symbols.pinned_dsym = st_init_numtable_with_size(1000); (void)nodetype; (void)nodeline; @@ -10185,11 +10182,6 @@ rb_gc_mark_symbols(int full_mark) rb_mark_tbl(global_symbols.id_str); if (!full_mark) global_symbols.minor_marked = 1; } - - if (full_mark || global_symbols.pinned_dsym_minor_marked == 0) { - rb_mark_tbl(global_symbols.pinned_dsym); - if (!full_mark) global_symbols.pinned_dsym_minor_marked = 1; - } } #endif /* !RIPPER */ @@ -10485,11 +10477,15 @@ static ID rb_pin_dynamic_symbol(VALUE sym) { must_be_dynamic_symbol(sym); - sym = dsymbol_check(sym); - /* stick dynamic symbol */ - if (!st_insert(global_symbols.pinned_dsym, sym, (st_data_t)sym)) { - global_symbols.pinned_dsym_minor_marked = 0; + + if (UNLIKELY(SYMBOL_PINNED_P(sym) == 0)) { + sym = dsymbol_check(sym); + FL_SET(sym, SYMBOL_PINNED); + + /* make it permanent object */ + rb_gc_register_mark_object(sym); } + return (ID)sym; } @@ -10689,14 +10685,14 @@ rb_intern_str(VALUE str) } void -rb_gc_free_dsymbol(VALUE ptr) +rb_gc_free_dsymbol(VALUE sym) { st_data_t data; - data = (st_data_t)RSYMBOL(ptr)->fstr; + data = (st_data_t)RSYMBOL(sym)->fstr; st_delete(global_symbols.str_id, &data, 0); - data = (st_data_t)ptr; + data = (st_data_t)sym; st_delete(global_symbols.id_str, &data, 0); - RSYMBOL(ptr)->fstr = (VALUE)NULL; + RSYMBOL(sym)->fstr = (VALUE)NULL; } /* |