summaryrefslogtreecommitdiff
path: root/vm.c
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2019-04-11 23:46:28 -0400
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-05-22 15:46:47 +0900
commitb00f280d4b9569e7153365d7e1c522b3d6b3c6cf (patch)
tree872700dc5ffaa9e3b0fec6f0d13df655704355d7 /vm.c
parenta829be209fc5866f07adc93e8b2f1ddf7131ebfd (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 'vm.c')
-rw-r--r--vm.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/vm.c b/vm.c
index 9b6600393c..1bc1ed757f 100644
--- a/vm.c
+++ b/vm.c
@@ -374,8 +374,6 @@ rb_vm_inc_const_missing_count(void)
ruby_vm_const_missing_count +=1;
}
-VALUE rb_class_path_no_cache(VALUE _klass);
-
MJIT_FUNC_EXPORTED int
rb_dtrace_setup(rb_execution_context_t *ec, VALUE klass, ID id,
struct ruby_dtrace_method_hook_args *args)
@@ -395,7 +393,7 @@ rb_dtrace_setup(rb_execution_context_t *ec, VALUE klass, ID id,
}
type = BUILTIN_TYPE(klass);
if (type == T_CLASS || type == T_ICLASS || type == T_MODULE) {
- VALUE name = rb_class_path_no_cache(klass);
+ VALUE name = rb_class_path(klass);
const char *classname, *filename;
const char *methodname = rb_id2name(id);
if (methodname && (filename = rb_source_location_cstr(&args->line_no)) != 0) {