summaryrefslogtreecommitdiff
path: root/vm.c
diff options
context:
space:
mode:
authorcharliesome <charliesome@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-10-29 00:52:38 +0000
committercharliesome <charliesome@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-10-29 00:52:38 +0000
commit7fafa8f376a4be7ba6ed7f9ea9c549847fae0d79 (patch)
tree78e2b63103472f79be696b1ee98eaa379d8ba606 /vm.c
parente2ec76056aec67bd5422df597993f2cfc871b758 (diff)
* 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
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/vm.c b/vm.c
index 80e13de..af29665 100644
--- a/vm.c
+++ b/vm.c
@@ -71,7 +71,8 @@ static VALUE
vm_invoke_proc(rb_thread_t *th, rb_proc_t *proc, VALUE self, VALUE defined_class,
int argc, const VALUE *argv, const rb_block_t *blockptr);
-static vm_state_version_t ruby_vm_global_state_version = 1;
+static vm_state_version_t ruby_vm_method_state_version = 1;
+static vm_state_version_t ruby_vm_constant_state_version = 1;
static vm_state_version_t ruby_vm_sequence = 1;
#include "vm_insnhelper.h"
@@ -2075,12 +2076,12 @@ vm_define_method(rb_thread_t *th, VALUE obj, ID id, VALUE iseqval,
OBJ_WRITE(miseq->self, &miseq->klass, klass);
miseq->defined_method_id = id;
rb_add_method(klass, id, VM_METHOD_TYPE_ISEQ, miseq, noex);
- rb_clear_cache_by_class(klass);
+ rb_clear_method_cache_by_class(klass);
if (!is_singleton && noex == NOEX_MODFUNC) {
klass = rb_singleton_class(klass);
rb_add_method(klass, id, VM_METHOD_TYPE_ISEQ, miseq, NOEX_PUBLIC);
- rb_clear_cache_by_class(klass);
+ rb_clear_method_cache_by_class(klass);
}
}
@@ -2130,8 +2131,8 @@ m_core_undef_method(VALUE self, VALUE cbase, VALUE sym)
{
REWIND_CFP({
rb_undef(cbase, SYM2ID(sym));
- rb_clear_cache_by_class(cbase);
- rb_clear_cache_by_class(self);
+ rb_clear_method_cache_by_class(cbase);
+ rb_clear_method_cache_by_class(self);
});
return Qnil;
}