From 7fafa8f376a4be7ba6ed7f9ea9c549847fae0d79 Mon Sep 17 00:00:00 2001 From: charliesome Date: Tue, 29 Oct 2013 00:52:38 +0000 Subject: * insns.def, vm.c, vm_insnhelper.c, vm_insnhelper.h, vm_method.c: split ruby_vm_global_state_version into two separate counters - one for the global method state and one for the global constant state. This means changes to constants do not affect method caches, and changes to methods do not affect constant caches. In particular, this means inclusions of modules containing constants no longer globally invalidate the method cache. * class.c, eval.c, include/ruby/intern.h, insns.def, vm.c, vm_method.c: rename rb_clear_cache_by_class to rb_clear_method_cache_by_class * class.c, include/ruby/intern.h, variable.c, vm_method.c: add rb_clear_constant_cache * compile.c, vm_core.h, vm_insnhelper.c: rename vmstat field in rb_call_info_struct to method_state * vm_method.c: rename vmstat field in struct cache_entry to method_state git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- variable.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'variable.c') diff --git a/variable.c b/variable.c index 9da4ee217d..d07f9ff9dd 100644 --- a/variable.c +++ b/variable.c @@ -1941,7 +1941,7 @@ rb_const_remove(VALUE mod, ID id) rb_class_name(mod), QUOTE_ID(id)); } - rb_clear_cache(); + rb_clear_constant_cache(); val = ((rb_const_entry_t*)v)->value; if (val == Qundef) { @@ -2151,7 +2151,7 @@ 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_clear_cache(); + rb_clear_constant_cache(); ele->value = val; /* autoload_i is shady */ return; @@ -2175,7 +2175,7 @@ rb_const_set(VALUE klass, ID id, VALUE val) } } - rb_clear_cache(); + rb_clear_constant_cache(); ce = ALLOC(rb_const_entry_t); @@ -2222,7 +2222,7 @@ set_const_visibility(VALUE mod, int argc, VALUE *argv, rb_const_flag_t flag) id = rb_check_id(&val); if (!id) { if (i > 0) { - rb_clear_cache(); + rb_clear_constant_cache(); } rb_name_error_str(val, "constant %"PRIsVALUE"::%"PRIsVALUE" not defined", @@ -2234,13 +2234,13 @@ set_const_visibility(VALUE mod, int argc, VALUE *argv, rb_const_flag_t flag) } else { if (i > 0) { - rb_clear_cache(); + rb_clear_constant_cache(); } rb_name_error(id, "constant %"PRIsVALUE"::%"PRIsVALUE" not defined", rb_class_name(mod), QUOTE_ID(id)); } } - rb_clear_cache(); + rb_clear_constant_cache(); } /* -- cgit v1.2.3