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

ruby-changes:30762

From: charliesome <ko1@a...>
Date: Thu, 5 Sep 2013 10:44:43 +0900 (JST)
Subject: [ruby-changes:30762] charliesome:r42841 (trunk): * vm_insnhelper.c (vm_getivar): use class sequence to check class

charliesome	2013-09-05 10:44:36 +0900 (Thu, 05 Sep 2013)

  New Revision: 42841

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

  Log:
    * vm_insnhelper.c (vm_getivar): use class sequence to check class
      identity, instead of pointer + vm state
    
    * vm_insnhelper.c (vm_setivar): ditto

  Modified files:
    trunk/ChangeLog
    trunk/vm_insnhelper.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 42840)
+++ ChangeLog	(revision 42841)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Sep  5 10:41:00 2013  Charlie Somerville  <charliesome@r...>
+
+	* vm_insnhelper.c (vm_getivar): use class sequence to check class
+	  identity, instead of pointer + vm state
+
+	* vm_insnhelper.c (vm_setivar): ditto
+
 Thu Sep  5 08:20:58 2013  Tanaka Akira  <akr@f...>
 
 	* bignum.c (GMP_DIV_DIGITS): New macro.
Index: vm_insnhelper.c
===================================================================
--- vm_insnhelper.c	(revision 42840)
+++ vm_insnhelper.c	(revision 42841)
@@ -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_class == klass && ic->ic_vmstat == GET_VM_STATE_VERSION())) ||
+	if (LIKELY((!is_attr && ic->ic_seq == RCLASS_EXT(klass)->seq) ||
 		   (is_attr && ci->aux.index > 0))) {
 	    long index = !is_attr ? (long)ic->ic_value.index : ci->aux.index - 1;
 	    long len = ROBJECT_NUMIV(obj);
@@ -532,9 +532,8 @@ vm_getivar(VALUE obj, ID id, IC ic, rb_c https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L532
 			val = ptr[index];
 		    }
 		    if (!is_attr) {
-			ic->ic_class = klass;
 			ic->ic_value.index = index;
-			ic->ic_vmstat = GET_VM_STATE_VERSION();
+			ic->ic_seq = RCLASS_EXT(klass)->seq;
 		    }
 		    else { /* call_info */
 			ci->aux.index = index + 1;
@@ -566,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_class == klass && ic->ic_vmstat == GET_VM_STATE_VERSION()) ||
+	    (!is_attr && ic->ic_seq == RCLASS_EXT(klass)->seq) ||
 	    (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,9 +581,8 @@ vm_setivar(VALUE obj, ID id, VALUE val, https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L581
 
 	    if (iv_index_tbl && st_lookup(iv_index_tbl, (st_data_t)id, &index)) {
 		if (!is_attr) {
-		    ic->ic_class = klass;
 		    ic->ic_value.index = index;
-		    ic->ic_vmstat = GET_VM_STATE_VERSION();
+		    ic->ic_seq = RCLASS_EXT(klass)->seq;
 		}
 		else {
 		    ci->aux.index = index + 1;

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

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