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

ruby-changes:31516

From: charliesome <ko1@a...>
Date: Sat, 9 Nov 2013 12:34:56 +0900 (JST)
Subject: [ruby-changes:31516] charliesome:r43595 (trunk): * class.c: unify names of vm state version counters to 'serial'.

charliesome	2013-11-09 12:34:49 +0900 (Sat, 09 Nov 2013)

  New Revision: 43595

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

  Log:
    * class.c: unify names of vm state version counters to 'serial'.
      This includes renaming 'vm_state_version_t' to 'rb_serial_t',
      'method_state' to 'method_serial', 'seq' to 'class_serial',
      'vmstat' to 'constant_serial', etc.
    
    * insns.def: ditto
    * internal.h: ditto
    * vm.c: ditto
    * vm_core.h: ditto
    * vm_insnhelper.c: ditto
    * vm_insnhelper.h: ditto
    * vm_method.c: ditto

  Modified files:
    trunk/ChangeLog
    trunk/class.c
    trunk/compile.c
    trunk/insns.def
    trunk/internal.h
    trunk/vm.c
    trunk/vm_core.h
    trunk/vm_insnhelper.c
    trunk/vm_insnhelper.h
    trunk/vm_method.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 43594)
+++ ChangeLog	(revision 43595)
@@ -1,3 +1,18 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Nov  9 12:31:00 2013  Charlie Somerville  <charliesome@r...>
+
+	* class.c: unify names of vm state version counters to 'serial'.
+	  This includes renaming 'vm_state_version_t' to 'rb_serial_t',
+	  'method_state' to 'method_serial', 'seq' to 'class_serial',
+	  'vmstat' to 'constant_serial', etc.
+
+	* insns.def: ditto
+	* internal.h: ditto
+	* vm.c: ditto
+	* vm_core.h: ditto
+	* vm_insnhelper.c: ditto
+	* vm_insnhelper.h: ditto
+	* vm_method.c: ditto
+
 Sat Nov  9 09:22:29 2013  Masaya Tarui  <tarui@r...>
 
 	* gc.c (gc_page_sweep, rgengc_rememberset_mark): Refactoring.
Index: insns.def
===================================================================
--- insns.def	(revision 43594)
+++ insns.def	(revision 43595)
@@ -1183,7 +1183,7 @@ getinlinecache https://github.com/ruby/ruby/blob/trunk/insns.def#L1183
 ()
 (VALUE val)
 {
-    if (ic->ic_vmstat == GET_CONSTANT_STATE_VERSION()) {
+    if (ic->ic_constant_serial == GET_CONSTANT_SERIAL()) {
 	val = ic->ic_value.value;
 	JUMP(dst);
     }
@@ -1208,7 +1208,7 @@ setinlinecache https://github.com/ruby/ruby/blob/trunk/insns.def#L1208
 	rb_iseq_add_mark_object(GET_ISEQ(), val);
     }
     ic->ic_value.value = val;
-    ic->ic_vmstat = GET_CONSTANT_STATE_VERSION() - ruby_vm_const_missing_count;
+    ic->ic_constant_serial = GET_CONSTANT_SERIAL() - ruby_vm_const_missing_count;
     ruby_vm_const_missing_count = 0;
 }
 
Index: vm_core.h
===================================================================
--- vm_core.h	(revision 43594)
+++ vm_core.h	(revision 43595)
@@ -131,9 +131,8 @@ typedef struct rb_compile_option_struct https://github.com/ruby/ruby/blob/trunk/vm_core.h#L131
 
 
 struct iseq_inline_cache_entry {
-    vm_state_version_t ic_vmstat;
-    vm_state_version_t ic_seq;
-    VALUE ic_class;
+    rb_serial_t ic_constant_serial;
+    rb_serial_t ic_class_serial;
     union {
 	size_t index;
 	VALUE value;
@@ -162,8 +161,8 @@ typedef struct rb_call_info_struct { https://github.com/ruby/ruby/blob/trunk/vm_core.h#L161
     rb_iseq_t *blockiseq;
 
     /* inline cache: keys */
-    vm_state_version_t method_state;
-    vm_state_version_t seq;
+    rb_serial_t method_serial;
+    rb_serial_t class_serial;
     VALUE klass;
 
     /* inline cache: values */
Index: compile.c
===================================================================
--- compile.c	(revision 43594)
+++ compile.c	(revision 43595)
@@ -961,8 +961,8 @@ new_callinfo(rb_iseq_t *iseq, ID mid, in https://github.com/ruby/ruby/blob/trunk/compile.c#L961
 	    ci->flag |= VM_CALL_ARGS_SKIP_SETUP;
 	}
     }
-    ci->method_state = 0;
-    ci->seq = 0;
+    ci->method_serial = 0;
+    ci->class_serial = 0;
     ci->blockptr = 0;
     ci->recv = Qundef;
     ci->call = 0; /* TODO: should set default function? */
Index: vm_method.c
===================================================================
--- vm_method.c	(revision 43594)
+++ vm_method.c	(revision 43595)
@@ -25,8 +25,8 @@ 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 {
-    vm_state_version_t method_state;
-    vm_state_version_t seq;
+    rb_serial_t method_serial;
+    rb_serial_t class_serial;
     ID mid;
     rb_method_entry_t* me;
     VALUE defined_class;
@@ -39,7 +39,7 @@ static struct cache_entry global_method_ https://github.com/ruby/ruby/blob/trunk/vm_method.c#L39
 static void
 rb_class_clear_method_cache(VALUE klass)
 {
-    RCLASS_EXT(klass)->seq = rb_next_class_sequence();
+    RCLASS_EXT(klass)->class_serial = rb_next_class_serial();
     rb_class_foreach_subclass(klass, rb_class_clear_method_cache);
 }
 
@@ -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_STATE_VERSION();
-    INC_CONSTANT_STATE_VERSION();
+    INC_METHOD_SERIAL();
+    INC_CONSTANT_SERIAL();
 }
 
 void
 rb_clear_constant_cache(void)
 {
-    INC_CONSTANT_STATE_VERSION();
+    INC_CONSTANT_SERIAL();
 }
 
 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_STATE_VERSION();
+	    INC_METHOD_SERIAL();
 	}
 	else {
 	    rb_class_clear_method_cache(klass);
@@ -549,8 +549,8 @@ rb_method_entry_get_without_cache(VALUE https://github.com/ruby/ruby/blob/trunk/vm_method.c#L549
     if (ruby_running) {
 	struct cache_entry *ent;
 	ent = GLOBAL_METHOD_CACHE(klass, id);
-	ent->seq = RCLASS_EXT(klass)->seq;
-	ent->method_state = GET_METHOD_STATE_VERSION();
+	ent->class_serial = RCLASS_EXT(klass)->class_serial;
+	ent->method_serial = GET_METHOD_SERIAL();
 	ent->defined_class = defined_class;
 	ent->mid = id;
 
@@ -588,8 +588,8 @@ 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_state == GET_METHOD_STATE_VERSION() &&
-	ent->seq == RCLASS_EXT(klass)->seq &&
+    if (ent->method_serial == GET_METHOD_SERIAL() &&
+	ent->class_serial == RCLASS_EXT(klass)->class_serial &&
 	ent->mid == id) {
 	if (defined_class_ptr)
 	    *defined_class_ptr = ent->defined_class;
Index: class.c
===================================================================
--- class.c	(revision 43594)
+++ class.c	(revision 43595)
@@ -166,7 +166,7 @@ class_alloc(VALUE flags, VALUE klass) https://github.com/ruby/ruby/blob/trunk/class.c#L166
     RCLASS_EXT(obj)->subclasses = NULL;
     RCLASS_EXT(obj)->parent_subclasses = NULL;
     RCLASS_EXT(obj)->module_subclasses = NULL;
-    RCLASS_EXT(obj)->seq = rb_next_class_sequence();
+    RCLASS_EXT(obj)->class_serial = rb_next_class_serial();
 
     RCLASS_REFINED_CLASS(obj) = Qnil;
     RCLASS_EXT(obj)->allocator = 0;
Index: internal.h
===================================================================
--- internal.h	(revision 43594)
+++ internal.h	(revision 43595)
@@ -245,11 +245,11 @@ struct rb_subclass_entry { https://github.com/ruby/ruby/blob/trunk/internal.h#L245
 };
 
 #if defined(HAVE_LONG_LONG)
-typedef unsigned LONG_LONG vm_state_version_t;
+typedef unsigned LONG_LONG rb_serial_t;
 #elif defined(HAVE_UINT64_T)
-typedef uint64_t vm_state_version_t;
+typedef uint64_t rb_serial_t;
 #else
-typedef unsigned long vm_state_version_t;
+typedef unsigned long rb_serial_t;
 #endif
 
 struct rb_classext_struct {
@@ -264,7 +264,7 @@ struct rb_classext_struct { https://github.com/ruby/ruby/blob/trunk/internal.h#L264
      * included. Hopefully that makes sense.
      */
     rb_subclass_entry_t **module_subclasses;
-    vm_state_version_t seq;
+    rb_serial_t class_serial;
     VALUE origin;
     VALUE refined_class;
     rb_alloc_func_t allocator;
@@ -701,7 +701,7 @@ void ruby_kill(rb_pid_t pid, int sig); https://github.com/ruby/ruby/blob/trunk/internal.h#L701
 void Init_native_thread(void);
 
 /* vm_insnhelper.h */
-vm_state_version_t rb_next_class_sequence(void);
+rb_serial_t rb_next_class_serial(void);
 
 /* vm.c */
 VALUE rb_obj_is_thread(VALUE obj);
Index: vm.c
===================================================================
--- vm.c	(revision 43594)
+++ vm.c	(revision 43595)
@@ -71,9 +71,9 @@ 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 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;
+static rb_serial_t ruby_vm_method_serial = 1;
+static rb_serial_t ruby_vm_constant_serial = 1;
+static rb_serial_t ruby_vm_class_serial = 1;
 
 #include "vm_insnhelper.h"
 #include "vm_insnhelper.c"
@@ -88,10 +88,10 @@ static vm_state_version_t ruby_vm_sequen https://github.com/ruby/ruby/blob/trunk/vm.c#L88
 #define BUFSIZE 0x100
 #define PROCDEBUG 0
 
-vm_state_version_t
-rb_next_class_sequence(void)
+rb_serial_t
+rb_next_class_serial(void)
 {
-    return NEXT_CLASS_SEQUENCE();
+    return NEXT_CLASS_SERIAL();
 }
 
 VALUE rb_cRubyVM;
Index: vm_insnhelper.c
===================================================================
--- vm_insnhelper.c	(revision 43594)
+++ vm_insnhelper.c	(revision 43595)
@@ -510,7 +510,7 @@ vm_getivar(VALUE obj, ID id, IC ic, rb_c https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L510
 	VALUE val = Qundef;
 	VALUE klass = RBASIC(obj)->klass;
 
-	if (LIKELY((!is_attr && ic->ic_seq == RCLASS_EXT(klass)->seq) ||
+	if (LIKELY((!is_attr && ic->ic_class_serial == RCLASS_EXT(klass)->class_serial) ||
 		   (is_attr && ci->aux.index > 0))) {
 	    long index = !is_attr ? (long)ic->ic_value.index : ci->aux.index - 1;
 	    long len = ROBJECT_NUMIV(obj);
@@ -533,7 +533,7 @@ vm_getivar(VALUE obj, ID id, IC ic, rb_c https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L533
 		    }
 		    if (!is_attr) {
 			ic->ic_value.index = index;
-			ic->ic_seq = RCLASS_EXT(klass)->seq;
+			ic->ic_class_serial = RCLASS_EXT(klass)->class_serial;
 		    }
 		    else { /* call_info */
 			ci->aux.index = index + 1;
@@ -565,7 +565,7 @@ vm_setivar(VALUE obj, ID id, VALUE val, https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L565
 	st_data_t index;
 
 	if (LIKELY(
-	    (!is_attr && ic->ic_seq == RCLASS_EXT(klass)->seq) ||
+	    (!is_attr && ic->ic_class_serial == RCLASS_EXT(klass)->class_serial) ||
 	    (is_attr && ci->aux.index > 0))) {
 	    long index = !is_attr ? (long)ic->ic_value.index : ci->aux.index-1;
 	    long len = ROBJECT_NUMIV(obj);
@@ -582,7 +582,7 @@ vm_setivar(VALUE obj, ID id, VALUE val, https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L582
 	    if (iv_index_tbl && st_lookup(iv_index_tbl, (st_data_t)id, &index)) {
 		if (!is_attr) {
 		    ic->ic_value.index = index;
-		    ic->ic_seq = RCLASS_EXT(klass)->seq;
+		    ic->ic_class_serial = RCLASS_EXT(klass)->class_serial;
 		}
 		else {
 		    ci->aux.index = index + 1;
@@ -846,7 +846,7 @@ vm_search_method(rb_call_info_t *ci, VAL https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L846
     VALUE klass = CLASS_OF(recv);
 
 #if OPT_INLINE_METHOD_CACHE
-    if (LIKELY(GET_METHOD_STATE_VERSION() == ci->method_state && RCLASS_EXT(klass)->seq == ci->seq)) {
+    if (LIKELY(GET_METHOD_SERIAL() == ci->method_serial && RCLASS_EXT(klass)->class_serial == ci->class_serial)) {
 	/* cache hit! */
 	return;
     }
@@ -856,8 +856,8 @@ vm_search_method(rb_call_info_t *ci, VAL https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L856
     ci->klass = klass;
     ci->call = vm_call_general;
 #if OPT_INLINE_METHOD_CACHE
-    ci->method_state = GET_METHOD_STATE_VERSION();
-    ci->seq = RCLASS_EXT(klass)->seq;
+    ci->method_serial = GET_METHOD_SERIAL();
+    ci->class_serial = RCLASS_EXT(klass)->class_serial;
 #endif
 }
 
@@ -924,7 +924,7 @@ rb_equal_opt(VALUE obj1, VALUE obj2) https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L924
     rb_call_info_t ci;
     ci.mid = idEq;
     ci.klass = 0;
-    ci.method_state = 0;
+    ci.method_serial = 0;
     ci.me = NULL;
     ci.defined_class = 0;
     return opt_eq_func(obj1, obj2, &ci);
Index: vm_insnhelper.h
===================================================================
--- vm_insnhelper.h	(revision 43594)
+++ vm_insnhelper.h	(revision 43595)
@@ -259,11 +259,11 @@ enum vm_regan_acttype { https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.h#L259
     CALL_METHOD(ci); \
 } while (0)
 
-#define NEXT_CLASS_SEQUENCE() (++ruby_vm_sequence)
-#define GET_METHOD_STATE_VERSION() (ruby_vm_method_state_version)
-#define INC_METHOD_STATE_VERSION() (++ruby_vm_method_state_version)
-#define GET_CONSTANT_STATE_VERSION() (ruby_vm_constant_state_version)
-#define INC_CONSTANT_STATE_VERSION() (++ruby_vm_constant_state_version)
+#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)
 
 static VALUE make_no_method_exception(VALUE exc, const char *format,
 				      VALUE obj, int argc, const VALUE *argv);

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

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