diff options
author | Alan Wu <XrXr@users.noreply.github.com> | 2019-04-11 23:46:28 -0400 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-05-22 15:46:47 +0900 |
commit | b00f280d4b9569e7153365d7e1c522b3d6b3c6cf (patch) | |
tree | 872700dc5ffaa9e3b0fec6f0d13df655704355d7 /gc.c | |
parent | a829be209fc5866f07adc93e8b2f1ddf7131ebfd (diff) |
Eagerly name modules and classes
* variable.c: make the hidden ivars `classpath` and `tmp_classpath` the source
of truth for module and constant names. Assign to them when modules are bind
to constants.
* variable.c: remove references to module name cache, as what used to be the cache
is now the source of truth. Remove rb_class_path_no_cache().
* variable.c: remove the hidden ivar `classid`. This existed for the purposes of
module name search, which is now replaced. Also, remove the associated
rb_name_class().
* class.c: use rb_set_class_path_string to set the name of Object during boot.
Must use a fstring as this runs before rb_cString is initialized and
creating a normal string leads to a VALUE without a class.
* spec/ruby/core/module/name_spec.rb: add a few specs to specify what happens
to Module#name across multiple operations. These specs pass without other
code changes in this commit.
[Feature #15765]
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -11097,7 +11097,7 @@ rb_raw_obj_info(char *buff, const int buff_size, VALUE obj) } else { if (RTEST(RBASIC(obj)->klass)) { - VALUE class_path = rb_class_path_cached(RBASIC(obj)->klass); + VALUE class_path = rb_class_path(RBASIC(obj)->klass); if (!NIL_P(class_path)) { APPENDF((BUFF_ARGS, "(%s)", RSTRING_PTR(class_path))); } @@ -11151,7 +11151,7 @@ rb_raw_obj_info(char *buff, const int buff_size, VALUE obj) case T_CLASS: case T_MODULE: { - VALUE class_path = rb_class_path_cached(obj); + VALUE class_path = rb_class_path(obj); if (!NIL_P(class_path)) { APPENDF((BUFF_ARGS, "%s", RSTRING_PTR(class_path))); } @@ -11159,7 +11159,7 @@ rb_raw_obj_info(char *buff, const int buff_size, VALUE obj) } case T_ICLASS: { - VALUE class_path = rb_class_path_cached(RBASIC_CLASS(obj)); + VALUE class_path = rb_class_path(RBASIC_CLASS(obj)); if (!NIL_P(class_path)) { APPENDF((BUFF_ARGS, "src:%s", RSTRING_PTR(class_path))); } |