summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcharliesome <charliesome@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-12-09 10:51:02 +0000
committercharliesome <charliesome@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-12-09 10:51:02 +0000
commit7df979812699f153791b95e9c37f6c61b0cfb599 (patch)
tree9172a77252b37fdbeb662dbd61c0f0ca4ae1048b
parenta1119230621d3ab26e93466a6838be42aaa83307 (diff)
* compile.c, insns.def, test/ruby/test_rubyvm.rb, vm.c, vm_core.h,
vm_insnhelper.c, vm_insnhelper.h, vm_method.c: Rename method_serial to global_method_state and constant_serial to global_constant_state after discussion with ko1. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog7
-rw-r--r--compile.c2
-rw-r--r--insns.def4
-rw-r--r--test/ruby/test_rubyvm.rb4
-rw-r--r--vm.c20
-rw-r--r--vm_core.h2
-rw-r--r--vm_insnhelper.c6
-rw-r--r--vm_insnhelper.h8
-rw-r--r--vm_method.c14
9 files changed, 37 insertions, 30 deletions
diff --git a/ChangeLog b/ChangeLog
index 87dc95d..8dbf078 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Mon Dec 9 19:50:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
+
+ * compile.c, insns.def, test/ruby/test_rubyvm.rb, vm.c, vm_core.h,
+ vm_insnhelper.c, vm_insnhelper.h, vm_method.c: Rename method_serial
+ to global_method_state and constant_serial to global_constant_state
+ after discussion with ko1.
+
Mon Dec 9 18:50:43 2013 Aman Gupta <ruby@tmm1.net>
* hash.c (rb_hash_replace): fix segv on `{}.replace({})` introduced
diff --git a/compile.c b/compile.c
index 812f692..af11baf 100644
--- a/compile.c
+++ b/compile.c
@@ -960,7 +960,7 @@ new_callinfo(rb_iseq_t *iseq, ID mid, int argc, VALUE block, unsigned long flag)
ci->flag |= VM_CALL_ARGS_SKIP_SETUP;
}
}
- ci->method_serial = 0;
+ ci->method_state = 0;
ci->class_serial = 0;
ci->blockptr = 0;
ci->recv = Qundef;
diff --git a/insns.def b/insns.def
index 63a36b3..a636f55 100644
--- a/insns.def
+++ b/insns.def
@@ -1197,7 +1197,7 @@ getinlinecache
()
(VALUE val)
{
- if (ic->ic_serial == GET_CONSTANT_SERIAL()) {
+ if (ic->ic_serial == GET_GLOBAL_CONSTANT_STATE()) {
val = ic->ic_value.value;
JUMP(dst);
}
@@ -1222,7 +1222,7 @@ setinlinecache
rb_iseq_add_mark_object(GET_ISEQ(), val);
}
ic->ic_value.value = val;
- ic->ic_serial = GET_CONSTANT_SERIAL() - ruby_vm_const_missing_count;
+ ic->ic_serial = GET_GLOBAL_CONSTANT_STATE() - ruby_vm_const_missing_count;
ruby_vm_const_missing_count = 0;
}
diff --git a/test/ruby/test_rubyvm.rb b/test/ruby/test_rubyvm.rb
index c63ee9f..613cfe2 100644
--- a/test/ruby/test_rubyvm.rb
+++ b/test/ruby/test_rubyvm.rb
@@ -3,11 +3,11 @@ require 'test/unit'
class TestRubyVM < Test::Unit::TestCase
def test_stat
assert_kind_of Hash, RubyVM.stat
- assert_kind_of Fixnum, RubyVM.stat[:method_serial]
+ assert_kind_of Fixnum, RubyVM.stat[:global_method_state]
RubyVM.stat(stat = {})
assert_not_empty stat
- assert_equal stat[:method_serial], RubyVM.stat(:method_serial)
+ assert_equal stat[:global_method_state], RubyVM.stat(:global_method_state)
end
def test_stat_unknown
diff --git a/vm.c b/vm.c
index b47d0c2..bc19f6f 100644
--- a/vm.c
+++ b/vm.c
@@ -71,8 +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 rb_serial_t ruby_vm_method_serial = 1;
-static rb_serial_t ruby_vm_constant_serial = 1;
+static rb_serial_t ruby_vm_global_method_state = 1;
+static rb_serial_t ruby_vm_global_constant_state = 1;
static rb_serial_t ruby_vm_class_serial = 1;
#include "vm_insnhelper.h"
@@ -124,8 +124,8 @@ rb_vm_inc_const_missing_count(void)
* This hash includes information about method/constant cache serials:
*
* {
- * :method_serial=>251,
- * :constant_serial=>481,
+ * :global_method_state=>251,
+ * :global_constant_state=>481,
* :class_serial=>9029
* }
*
@@ -138,7 +138,7 @@ rb_vm_inc_const_missing_count(void)
static VALUE
vm_stat(int argc, VALUE *argv, VALUE self)
{
- static VALUE sym_method_serial, sym_constant_serial, sym_class_serial;
+ static VALUE sym_global_method_state, sym_global_constant_state, sym_class_serial;
VALUE arg = Qnil;
VALUE hash = Qnil, key = Qnil;
@@ -153,10 +153,10 @@ vm_stat(int argc, VALUE *argv, VALUE self)
hash = rb_hash_new();
}
- if (sym_method_serial == 0) {
+ if (sym_global_method_state == 0) {
#define S(s) sym_##s = ID2SYM(rb_intern_const(#s))
- S(method_serial);
- S(constant_serial);
+ S(global_method_state);
+ S(global_constant_state);
S(class_serial);
#undef S
}
@@ -167,8 +167,8 @@ vm_stat(int argc, VALUE *argv, VALUE self)
else if (hash != Qnil) \
rb_hash_aset(hash, sym_##name, SERIALT2NUM(attr));
- SET(method_serial, ruby_vm_method_serial);
- SET(constant_serial, ruby_vm_constant_serial);
+ SET(global_method_state, ruby_vm_global_method_state);
+ SET(global_constant_state, ruby_vm_global_constant_state);
SET(class_serial, ruby_vm_class_serial);
#undef SET
diff --git a/vm_core.h b/vm_core.h
index 3f71933..08a09da 100644
--- a/vm_core.h
+++ b/vm_core.h
@@ -160,7 +160,7 @@ typedef struct rb_call_info_struct {
rb_iseq_t *blockiseq;
/* inline cache: keys */
- rb_serial_t method_serial;
+ rb_serial_t method_state;
rb_serial_t class_serial;
VALUE klass;
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index d490f46..b515f8a 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -823,7 +823,7 @@ vm_search_method(rb_call_info_t *ci, VALUE recv)
VALUE klass = CLASS_OF(recv);
#if OPT_INLINE_METHOD_CACHE
- if (LIKELY(GET_METHOD_SERIAL() == ci->method_serial && RCLASS_EXT(klass)->class_serial == ci->class_serial)) {
+ if (LIKELY(GET_GLOBAL_METHOD_STATE() == ci->method_state && RCLASS_EXT(klass)->class_serial == ci->class_serial)) {
/* cache hit! */
return;
}
@@ -833,7 +833,7 @@ vm_search_method(rb_call_info_t *ci, VALUE recv)
ci->klass = klass;
ci->call = vm_call_general;
#if OPT_INLINE_METHOD_CACHE
- ci->method_serial = GET_METHOD_SERIAL();
+ ci->method_state = GET_GLOBAL_METHOD_STATE();
ci->class_serial = RCLASS_EXT(klass)->class_serial;
#endif
}
@@ -901,7 +901,7 @@ rb_equal_opt(VALUE obj1, VALUE obj2)
rb_call_info_t ci;
ci.mid = idEq;
ci.klass = 0;
- ci.method_serial = 0;
+ ci.method_state = 0;
ci.me = NULL;
ci.defined_class = 0;
return opt_eq_func(obj1, obj2, &ci);
diff --git a/vm_insnhelper.h b/vm_insnhelper.h
index 048fdc4..45a9da4 100644
--- a/vm_insnhelper.h
+++ b/vm_insnhelper.h
@@ -261,10 +261,10 @@ enum vm_regan_acttype {
} while (0)
#define NEXT_CLASS_SERIAL() (++ruby_vm_class_serial)
-#define GET_METHOD_SERIAL() (ruby_vm_method_serial)
-#define INC_METHOD_SERIAL() (++ruby_vm_method_serial)
-#define GET_CONSTANT_SERIAL() (ruby_vm_constant_serial)
-#define INC_CONSTANT_SERIAL() (++ruby_vm_constant_serial)
+#define GET_GLOBAL_METHOD_STATE() (ruby_vm_global_method_state)
+#define INC_GLOBAL_METHOD_STATE() (++ruby_vm_global_method_state)
+#define GET_GLOBAL_CONSTANT_STATE() (ruby_vm_global_constant_state)
+#define INC_GLOBAL_CONSTANT_STATE() (++ruby_vm_global_constant_state)
static VALUE make_no_method_exception(VALUE exc, const char *format,
VALUE obj, int argc, const VALUE *argv);
diff --git a/vm_method.c b/vm_method.c
index 81f4eee..7a76158 100644
--- a/vm_method.c
+++ b/vm_method.c
@@ -25,7 +25,7 @@ static void rb_vm_check_redefinition_opt_method(const rb_method_entry_t *me, VAL
#define attached id__attached__
struct cache_entry {
- rb_serial_t method_serial;
+ rb_serial_t method_state;
rb_serial_t class_serial;
ID mid;
rb_method_entry_t* me;
@@ -47,14 +47,14 @@ void
rb_clear_cache(void)
{
rb_warning("rb_clear_cache() is deprecated.");
- INC_METHOD_SERIAL();
- INC_CONSTANT_SERIAL();
+ INC_GLOBAL_METHOD_STATE();
+ INC_GLOBAL_CONSTANT_STATE();
}
void
rb_clear_constant_cache(void)
{
- INC_CONSTANT_SERIAL();
+ INC_GLOBAL_CONSTANT_STATE();
}
void
@@ -62,7 +62,7 @@ rb_clear_method_cache_by_class(VALUE klass)
{
if (klass && klass != Qundef) {
if (klass == rb_cBasicObject || klass == rb_cObject || klass == rb_mKernel) {
- INC_METHOD_SERIAL();
+ INC_GLOBAL_METHOD_STATE();
}
else {
rb_class_clear_method_cache(klass);
@@ -550,7 +550,7 @@ rb_method_entry_get_without_cache(VALUE klass, ID id,
struct cache_entry *ent;
ent = GLOBAL_METHOD_CACHE(klass, id);
ent->class_serial = RCLASS_EXT(klass)->class_serial;
- ent->method_serial = GET_METHOD_SERIAL();
+ ent->method_state = GET_GLOBAL_METHOD_STATE();
ent->defined_class = defined_class;
ent->mid = id;
@@ -588,7 +588,7 @@ rb_method_entry(VALUE klass, ID id, VALUE *defined_class_ptr)
#if OPT_GLOBAL_METHOD_CACHE
struct cache_entry *ent;
ent = GLOBAL_METHOD_CACHE(klass, id);
- if (ent->method_serial == GET_METHOD_SERIAL() &&
+ if (ent->method_state == GET_GLOBAL_METHOD_STATE() &&
ent->class_serial == RCLASS_EXT(klass)->class_serial &&
ent->mid == id) {
if (defined_class_ptr)