From 90b70738427567dc065ad75b32fa932b280c304a Mon Sep 17 00:00:00 2001 From: nari Date: Wed, 26 Mar 2014 04:57:47 +0000 Subject: * parse.y: support Symbol GC. [ruby-trunk Feature #9634] See this ticket about Symbol GC. * include/ruby/ruby.h: Declare few functions. * rb_sym2id: almost same as old SYM2ID but support dynamic symbols. * rb_id2sym: almost same as old ID2SYM but support dynamic symbols. * rb_sym2str: almost same as `rb_id2str(SYM2ID(sym))` but not pin down a dynamic symbol. Declare a new struct. * struct RSymbol: represents a dynamic symbol as object in Ruby's heaps. Add few macros. * STATIC_SYM_P: check a static symbol. * DYNAMIC_SYM_P: check a dynamic symbol. * RSYMBOL: cast to RSymbol * gc.c: declare RSymbol. support T_SYMBOL. * internal.h: Declare few functions. * rb_gc_free_dsymbol: free up a dynamic symbol. GC call this function at a sweep phase. * rb_str_dynamic_intern: convert a string to a dynamic symbol. * rb_check_id_without_pindown: not pinning function. * rb_sym2id_without_pindown: ditto. * rb_check_id_cstr_without_pindown: ditto. * string.c (Init_String): String#intern and String#to_sym use rb_str_dynamic_intern. * template/id.h.tmpl: use LSB of ID as a flag for determining a static symbol, so we shift left other ruby_id_types. * string.c: use rb_sym2str instead `rb_id2str(SYM2ID(sym))` to avoid pinning. * load.c: use xx_without_pindown function at creating temporary ID to avoid pinning. * object.c: ditto. * sprintf.c: ditto. * struct.c: ditto. * thread.c: ditto. * variable.c: ditto. * vm_method.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- variable.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'variable.c') diff --git a/variable.c b/variable.c index 079f862797..292b084011 100644 --- a/variable.c +++ b/variable.c @@ -353,7 +353,7 @@ rb_path_to_class(VALUE pathname) } while (*p) { while (*p && *p != ':') p++; - id = rb_check_id_cstr(pbeg, p-pbeg, enc); + id = rb_check_id_cstr_without_pindown(pbeg, p-pbeg, enc); if (p[0] == ':') { if (p[1] != ':') goto undefined_class; p += 2; @@ -1403,7 +1403,7 @@ VALUE rb_obj_remove_instance_variable(VALUE obj, VALUE name) { VALUE val = Qnil; - const ID id = rb_check_id(&name); + const ID id = rb_check_id_without_pindown(&name); st_data_t n, v; struct st_table *iv_index_tbl; st_data_t index; @@ -1919,7 +1919,7 @@ rb_public_const_get_at(VALUE klass, ID id) VALUE rb_mod_remove_const(VALUE mod, VALUE name) { - const ID id = rb_check_id(&name); + const ID id = rb_check_id_without_pindown(&name); if (!id) { if (rb_is_const_name(name)) { @@ -2568,7 +2568,7 @@ rb_mod_class_variables(int argc, VALUE *argv, VALUE mod) VALUE rb_mod_remove_cvar(VALUE mod, VALUE name) { - const ID id = rb_check_id(&name); + const ID id = rb_check_id_without_pindown(&name); st_data_t val, n = id; if (!id) { -- cgit v1.2.3