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

ruby-changes:32019

From: charliesome <ko1@a...>
Date: Mon, 9 Dec 2013 20:00:30 +0900 (JST)
Subject: [ruby-changes:32019] charliesome:r44098 (trunk): * internal.h (RCLASS_SERIAL): Add RCLASS_SERIAL as a convenience

charliesome	2013-12-09 20:00:23 +0900 (Mon, 09 Dec 2013)

  New Revision: 44098

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

  Log:
    * internal.h (RCLASS_SERIAL): Add RCLASS_SERIAL as a convenience
      accessor for RCLASS_EXT(klass)->class_serial.
    
    * class.c, vm_insnhelper.c, vm_method.c: Use RCLASS_SERIAL

  Modified files:
    trunk/ChangeLog
    trunk/class.c
    trunk/internal.h
    trunk/vm_insnhelper.c
    trunk/vm_method.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 44097)
+++ ChangeLog	(revision 44098)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Dec  9 20:00:00 2013  Charlie Somerville  <charliesome@r...>
+
+	* internal.h (RCLASS_SERIAL): Add RCLASS_SERIAL as a convenience
+	  accessor for RCLASS_EXT(klass)->class_serial.
+
+	* class.c, vm_insnhelper.c, vm_method.c: Use RCLASS_SERIAL
+
 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,
Index: vm_method.c
===================================================================
--- vm_method.c	(revision 44097)
+++ vm_method.c	(revision 44098)
@@ -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)->class_serial = rb_next_class_serial();
+    RCLASS_SERIAL(klass) = rb_next_class_serial();
     rb_class_foreach_subclass(klass, rb_class_clear_method_cache);
 }
 
Index: class.c
===================================================================
--- class.c	(revision 44097)
+++ class.c	(revision 44098)
@@ -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)->class_serial = rb_next_class_serial();
+    RCLASS_SERIAL(obj) = rb_next_class_serial();
 
     RCLASS_REFINED_CLASS(obj) = Qnil;
     RCLASS_EXT(obj)->allocator = 0;
Index: internal.h
===================================================================
--- internal.h	(revision 44097)
+++ internal.h	(revision 44098)
@@ -296,6 +296,7 @@ void rb_class_remove_from_super_subclass https://github.com/ruby/ruby/blob/trunk/internal.h#L296
 #define RCLASS_IV_INDEX_TBL(c) (RCLASS(c)->iv_index_tbl)
 #define RCLASS_ORIGIN(c) (RCLASS_EXT(c)->origin)
 #define RCLASS_REFINED_CLASS(c) (RCLASS_EXT(c)->refined_class)
+#define RCLASS_SERIAL(c) (RCLASS_EXT(c)->class_serial)
 
 static inline void
 RCLASS_M_TBL_INIT(VALUE c)
Index: vm_insnhelper.c
===================================================================
--- vm_insnhelper.c	(revision 44097)
+++ vm_insnhelper.c	(revision 44098)
@@ -487,7 +487,7 @@ vm_getivar(VALUE obj, ID id, IC ic, rb_c https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L487
 	VALUE val = Qundef;
 	VALUE klass = RBASIC(obj)->klass;
 
-	if (LIKELY((!is_attr && ic->ic_serial == RCLASS_EXT(klass)->class_serial) ||
+	if (LIKELY((!is_attr && ic->ic_serial == RCLASS_SERIAL(klass)) ||
 		   (is_attr && ci->aux.index > 0))) {
 	    long index = !is_attr ? (long)ic->ic_value.index : ci->aux.index - 1;
 	    long len = ROBJECT_NUMIV(obj);
@@ -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
 		    }
 		    if (!is_attr) {
 			ic->ic_value.index = index;
-			ic->ic_serial = RCLASS_EXT(klass)->class_serial;
+			ic->ic_serial = RCLASS_SERIAL(klass);
 		    }
 		    else { /* call_info */
 			ci->aux.index = index + 1;
@@ -542,7 +542,7 @@ vm_setivar(VALUE obj, ID id, VALUE val, https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L542
 	st_data_t index;
 
 	if (LIKELY(
-	    (!is_attr && ic->ic_serial == RCLASS_EXT(klass)->class_serial) ||
+	    (!is_attr && ic->ic_serial == RCLASS_SERIAL(klass)) ||
 	    (is_attr && ci->aux.index > 0))) {
 	    long index = !is_attr ? (long)ic->ic_value.index : ci->aux.index-1;
 	    long len = ROBJECT_NUMIV(obj);
@@ -559,7 +559,7 @@ vm_setivar(VALUE obj, ID id, VALUE val, https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L559
 	    if (iv_index_tbl && st_lookup(iv_index_tbl, (st_data_t)id, &index)) {
 		if (!is_attr) {
 		    ic->ic_value.index = index;
-		    ic->ic_serial = RCLASS_EXT(klass)->class_serial;
+		    ic->ic_serial = RCLASS_SERIAL(klass);
 		}
 		else {
 		    ci->aux.index = index + 1;
@@ -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_GLOBAL_METHOD_STATE() == ci->method_state && RCLASS_EXT(klass)->class_serial == ci->class_serial)) {
+    if (LIKELY(GET_GLOBAL_METHOD_STATE() == ci->method_state && RCLASS_SERIAL(klass) == ci->class_serial)) {
 	/* cache hit! */
 	return;
     }
@@ -834,7 +834,7 @@ vm_search_method(rb_call_info_t *ci, VAL https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L834
     ci->call = vm_call_general;
 #if OPT_INLINE_METHOD_CACHE
     ci->method_state = GET_GLOBAL_METHOD_STATE();
-    ci->class_serial = RCLASS_EXT(klass)->class_serial;
+    ci->class_serial = RCLASS_SERIAL(klass);
 #endif
 }
 

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

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