[前][次][番号順一覧][スレッド一覧]

ruby-changes:32018

From: charliesome <ko1@a...>
Date: Mon, 9 Dec 2013 19:51:10 +0900 (JST)
Subject: [ruby-changes:32018] charliesome:r44097 (trunk): * compile.c, insns.def, test/ruby/test_rubyvm.rb, vm.c, vm_core.h,

charliesome	2013-12-09 19:51:02 +0900 (Mon, 09 Dec 2013)

  New Revision: 44097

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44097

  Log:
    * 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.

  Modified files:
    trunk/ChangeLog
    trunk/compile.c
    trunk/insns.def
    trunk/test/ruby/test_rubyvm.rb
    trunk/vm.c
    trunk/vm_core.h
    trunk/vm_insnhelper.c
    trunk/vm_insnhelper.h
    trunk/vm_method.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 44096)
+++ ChangeLog	(revision 44097)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Dec  9 19:50:00 2013  Charlie Somerville  <charliesome@r...>
+
+	* 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@t...>
 
 	* hash.c (rb_hash_replace): fix segv on `{}.replace({})` introduced
Index: insns.def
===================================================================
--- insns.def	(revision 44096)
+++ insns.def	(revision 44097)
@@ -1197,7 +1197,7 @@ getinlinecache https://github.com/ruby/ruby/blob/trunk/insns.def#L1197
 ()
 (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 https://github.com/ruby/ruby/blob/trunk/insns.def#L1222
 	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;
 }
 
Index: vm_core.h
===================================================================
--- vm_core.h	(revision 44096)
+++ vm_core.h	(revision 44097)
@@ -160,7 +160,7 @@ typedef struct rb_call_info_struct { https://github.com/ruby/ruby/blob/trunk/vm_core.h#L160
     rb_iseq_t *blockiseq;
 
     /* inline cache: keys */
-    rb_serial_t method_serial;
+    rb_serial_t method_state;
     rb_serial_t class_serial;
     VALUE klass;
 
Index: compile.c
===================================================================
--- compile.c	(revision 44096)
+++ compile.c	(revision 44097)
@@ -960,7 +960,7 @@ new_callinfo(rb_iseq_t *iseq, ID mid, in https://github.com/ruby/ruby/blob/trunk/compile.c#L960
 	    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;
Index: vm_method.c
===================================================================
--- vm_method.c	(revision 44096)
+++ vm_method.c	(revision 44097)
@@ -25,7 +25,7 @@ static void rb_vm_check_redefinition_opt https://github.com/ruby/ruby/blob/trunk/vm_method.c#L25
 #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 https://github.com/ruby/ruby/blob/trunk/vm_method.c#L47
 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 kla https://github.com/ruby/ruby/blob/trunk/vm_method.c#L62
 {
     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 https://github.com/ruby/ruby/blob/trunk/vm_method.c#L550
 	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, VALU https://github.com/ruby/ruby/blob/trunk/vm_method.c#L588
 #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)
Index: vm.c
===================================================================
--- vm.c	(revision 44096)
+++ vm.c	(revision 44097)
@@ -71,8 +71,8 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/vm.c#L71
 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) https://github.com/ruby/ruby/blob/trunk/vm.c#L124
  *  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) https://github.com/ruby/ruby/blob/trunk/vm.c#L138
 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 sel https://github.com/ruby/ruby/blob/trunk/vm.c#L153
 	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 sel https://github.com/ruby/ruby/blob/trunk/vm.c#L167
     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
 
Index: vm_insnhelper.c
===================================================================
--- vm_insnhelper.c	(revision 44096)
+++ vm_insnhelper.c	(revision 44097)
@@ -823,7 +823,7 @@ vm_search_method(rb_call_info_t *ci, VAL https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L823
     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, VAL https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L833
     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) https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L901
     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);
Index: vm_insnhelper.h
===================================================================
--- vm_insnhelper.h	(revision 44096)
+++ vm_insnhelper.h	(revision 44097)
@@ -261,10 +261,10 @@ enum vm_regan_acttype { https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.h#L261
 } 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);
Index: test/ruby/test_rubyvm.rb
===================================================================
--- test/ruby/test_rubyvm.rb	(revision 44096)
+++ test/ruby/test_rubyvm.rb	(revision 44097)
@@ -3,11 +3,11 @@ require 'test/unit' https://github.com/ruby/ruby/blob/trunk/test/ruby/test_rubyvm.rb#L3
 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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]