aboutsummaryrefslogtreecommitdiffstats
path: root/variable.c
diff options
context:
space:
mode:
Diffstat (limited to 'variable.c')
-rw-r--r--variable.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/variable.c b/variable.c
index af1d23a86b..b3d9b3f6e8 100644
--- a/variable.c
+++ b/variable.c
@@ -1939,7 +1939,7 @@ rb_const_remove(VALUE mod, ID id)
rb_class_name(mod), QUOTE_ID(id));
}
- rb_vm_change_state();
+ rb_clear_cache();
val = ((rb_const_entry_t*)v)->value;
if (val == Qundef) {
@@ -2149,7 +2149,8 @@ rb_const_set(VALUE klass, ID id, VALUE val)
load = autoload_data(klass, id);
/* for autoloading thread, keep the defined value to autoloading storage */
if (load && (ele = check_autoload_data(load)) && (ele->thread == rb_thread_current())) {
- rb_vm_change_state();
+ rb_clear_cache();
+
ele->value = val; /* autoload_i is shady */
return;
}
@@ -2172,7 +2173,8 @@ rb_const_set(VALUE klass, ID id, VALUE val)
}
}
- rb_vm_change_state();
+ rb_clear_cache();
+
ce = ALLOC(rb_const_entry_t);
MEMZERO(ce, rb_const_entry_t, 1);
@@ -2217,8 +2219,10 @@ set_const_visibility(VALUE mod, int argc, VALUE *argv, rb_const_flag_t flag)
VALUE val = argv[i];
id = rb_check_id(&val);
if (!id) {
- if (i > 0)
- rb_clear_cache_by_class(mod);
+ if (i > 0) {
+ rb_clear_cache();
+ }
+
rb_name_error_str(val, "constant %"PRIsVALUE"::%"PRIsVALUE" not defined",
rb_class_name(mod), QUOTE(val));
}
@@ -2227,13 +2231,14 @@ set_const_visibility(VALUE mod, int argc, VALUE *argv, rb_const_flag_t flag)
((rb_const_entry_t*)v)->flag = flag;
}
else {
- if (i > 0)
- rb_clear_cache_by_class(mod);
+ if (i > 0) {
+ rb_clear_cache();
+ }
rb_name_error(id, "constant %"PRIsVALUE"::%"PRIsVALUE" not defined",
rb_class_name(mod), QUOTE_ID(id));
}
}
- rb_clear_cache_by_class(mod);
+ rb_clear_cache();
}
/*