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

ruby-changes:29581

From: tarui <ko1@a...>
Date: Wed, 26 Jun 2013 01:20:51 +0900 (JST)
Subject: [ruby-changes:29581] tarui:r41633 (trunk): * gc.c (is_before_sweep): Add new helper function that check the object

tarui	2013-06-26 01:20:39 +0900 (Wed, 26 Jun 2013)

  New Revision: 41633

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

  Log:
    * gc.c (is_before_sweep): Add new helper function that check the object
      is before sweep?
    * gc.c (rb_gc_force_recycle): Have to clear mark bit if object's slot
      already ready to mainor sweep.

  Modified files:
    trunk/ChangeLog
    trunk/gc.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41632)
+++ ChangeLog	(revision 41633)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Jun 26 01:18:13 2013  Masaya Tarui  <tarui@r...>
+
+	* gc.c (is_before_sweep): Add new helper function that check the object
+	  is before sweep?
+	* gc.c (rb_gc_force_recycle): Have to clear mark bit if object's slot
+	  already ready to mainor sweep.
+
 Wed Jun 26 01:17:29 2013  Tanaka Akira  <akr@f...>
 
 	* bignum.c (bigsub_int): Fix a buffer over read.
Index: gc.c
===================================================================
--- gc.c	(revision 41632)
+++ gc.c	(revision 41633)
@@ -603,6 +603,22 @@ RVALUE_PROMOTE(VALUE obj) https://github.com/ruby/ruby/blob/trunk/gc.c#L603
 #endif
 }
 
+static inline int
+is_before_sweep(VALUE obj)
+{
+    struct heaps_slot *slot;
+    rb_objspace_t *objspace = &rb_objspace;
+    if (is_lazy_sweeping(objspace)) {
+	slot = objspace->heap.sweep_slots;
+	while (slot) {
+	    if(slot->header == GET_HEAP_HEADER(obj))
+		return TRUE;
+	    slot = slot->next;
+	}
+    }
+    return FALSE;
+}
+
 static inline void
 RVALUE_DEMOTE(VALUE obj)
 {
@@ -3971,6 +3987,9 @@ rb_gc_force_recycle(VALUE p) https://github.com/ruby/ruby/blob/trunk/gc.c#L3987
 #if USE_RGENGC
     CLEAR_IN_BITMAP(GET_HEAP_REMEMBERSET_BITS(p), p);
     CLEAR_IN_BITMAP(GET_HEAP_OLDGEN_BITS(p), p);
+    if(!is_before_sweep(p)){
+	CLEAR_IN_BITMAP(GET_HEAP_MARK_BITS(p), p);
+    }
 #endif
 
     objspace->total_freed_object_num++;

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

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