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

ruby-changes:32077

From: tmm1 <ko1@a...>
Date: Fri, 13 Dec 2013 08:19:13 +0900 (JST)
Subject: [ruby-changes:32077] tmm1:r44156 (trunk): object.c: use RCLASS_M_TBL_WRAPPER for equality checks

tmm1	2013-12-13 08:19:02 +0900 (Fri, 13 Dec 2013)

  New Revision: 44156

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

  Log:
    object.c: use RCLASS_M_TBL_WRAPPER for equality checks
    
    * class.c (include_modules_at): use RCLASS_M_TBL_WRAPPER for
      equality checks. this avoids an unnecessary deference inside a tight
      loop, fixing a performance regression from r43973.
    * object.c (rb_obj_is_kind_of): ditto.
    * object.c (rb_class_inherited_p): ditto.

  Modified files:
    trunk/ChangeLog
    trunk/class.c
    trunk/object.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 44155)
+++ ChangeLog	(revision 44156)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Dec 13 08:15:31 2013  Aman Gupta <ruby@t...>
+
+	* class.c (include_modules_at): use RCLASS_M_TBL_WRAPPER for
+	  equality checks. this avoids an unnecessary deference inside a tight
+	  loop, fixing a performance regression from r43973.
+	* object.c (rb_obj_is_kind_of): ditto.
+	* object.c (rb_class_inherited_p): ditto.
+
 Wed Dec 13 02:00:00 2013  Kenta Murata  <mrkn@m...>
 
 	* ext/bigdecimal/bigdecimal.c (VpSetPTR): fix for limitation of the resulting
Index: object.c
===================================================================
--- object.c	(revision 44155)
+++ object.c	(revision 44156)
@@ -646,7 +646,7 @@ rb_obj_is_kind_of(VALUE obj, VALUE c) https://github.com/ruby/ruby/blob/trunk/object.c#L646
     c = class_or_module_required(c);
     c = RCLASS_ORIGIN(c);
     while (cl) {
-	if (cl == c || RCLASS_M_TBL(cl) == RCLASS_M_TBL(c))
+	if (cl == c || RCLASS_M_TBL_WRAPPER(cl) == RCLASS_M_TBL_WRAPPER(c))
 	    return Qtrue;
 	cl = RCLASS_SUPER(cl);
     }
@@ -1549,13 +1549,13 @@ rb_class_inherited_p(VALUE mod, VALUE ar https://github.com/ruby/ruby/blob/trunk/object.c#L1549
     }
     arg = RCLASS_ORIGIN(arg);
     while (mod) {
-	if (RCLASS_M_TBL(mod) == RCLASS_M_TBL(arg))
+	if (RCLASS_M_TBL_WRAPPER(mod) == RCLASS_M_TBL_WRAPPER(arg))
 	    return Qtrue;
 	mod = RCLASS_SUPER(mod);
     }
     /* not mod < arg; check if mod > arg */
     while (arg) {
-	if (RCLASS_M_TBL(arg) == RCLASS_M_TBL(start))
+	if (RCLASS_M_TBL_WRAPPER(arg) == RCLASS_M_TBL_WRAPPER(start))
 	    return Qfalse;
 	arg = RCLASS_SUPER(arg);
     }
Index: class.c
===================================================================
--- class.c	(revision 44155)
+++ class.c	(revision 44156)
@@ -862,7 +862,7 @@ include_modules_at(const VALUE klass, VA https://github.com/ruby/ruby/blob/trunk/class.c#L862
 	for (p = RCLASS_SUPER(klass); p; p = RCLASS_SUPER(p)) {
 	    switch (BUILTIN_TYPE(p)) {
 	      case T_ICLASS:
-		if (RCLASS_M_TBL(p) == RCLASS_M_TBL(module)) {
+		if (RCLASS_M_TBL_WRAPPER(p) == RCLASS_M_TBL_WRAPPER(module)) {
 		    if (!superclass_seen) {
 			c = p;  /* move insertion point */
 		    }

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

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