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

ruby-changes:32035

From: tmm1 <ko1@a...>
Date: Tue, 10 Dec 2013 15:58:54 +0900 (JST)
Subject: [ruby-changes:32035] tmm1:r44114 (trunk): gc.c: speed up RGENGC_CHECK_MODE by removing unncessary check

tmm1	2013-12-10 15:58:48 +0900 (Tue, 10 Dec 2013)

  New Revision: 44114

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

  Log:
    gc.c: speed up RGENGC_CHECK_MODE by removing unncessary check
    
    * gc.c (reflist_add): revert changes from r44109. it is unnecessary
      after r44113
    * gc.c (allrefs_i): fix whitespace
    * gc.c (allrefs_roots_i): fix whitespace

  Modified files:
    trunk/ChangeLog
    trunk/gc.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 44113)
+++ ChangeLog	(revision 44114)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Dec 10 15:56:48 2013  Aman Gupta <ruby@t...>
+
+	* gc.c (reflist_add): revert changes from r44109. it is unnecessary
+	  after r44113
+	* gc.c (allrefs_i): fix whitespace
+	* gc.c (allrefs_roots_i): fix whitespace
+
 Tue Dec 10 15:46:03 2013  Koichi Sasada  <ko1@a...>
 
 	* gc.c (allrefs_add): push obj only if allrefs table doesn't have
Index: gc.c
===================================================================
--- gc.c	(revision 44113)
+++ gc.c	(revision 44114)
@@ -4165,21 +4165,15 @@ reflist_destruct(struct reflist *refs) https://github.com/ruby/ruby/blob/trunk/gc.c#L4165
     xfree(refs);
 }
 
-static int
+static void
 reflist_add(struct reflist *refs, VALUE obj)
 {
-    int i = 0;
     if (refs->pos == refs->size) {
 	refs->size *= 2;
 	SIZED_REALLOC_N(refs->list, VALUE, refs->size, refs->size/2);
     }
 
-    for (i=0; i<refs->pos; i++)
-	if (refs->list[i] == obj)
-	    return 0; /* already exists */
-
     refs->list[refs->pos++] = obj;
-    return 1; /* added */
 }
 
 static void
@@ -4248,7 +4242,7 @@ allrefs_i(VALUE obj, void *ptr) https://github.com/ruby/ruby/blob/trunk/gc.c#L4242
 
     if (allrefs_add(data, obj)) {
 	push_mark_stack(&data->objspace->mark_stack, obj);
-}
+    }
 }
 
 static void
@@ -4259,8 +4253,8 @@ allrefs_roots_i(VALUE obj, void *ptr) https://github.com/ruby/ruby/blob/trunk/gc.c#L4253
     data->root_obj = MAKE_ROOTSIG(data->category);
 
     if (allrefs_add(data, obj)) {
-    push_mark_stack(&data->objspace->mark_stack, obj);
-}
+	push_mark_stack(&data->objspace->mark_stack, obj);
+    }
 }
 
 static st_table *

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

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