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

ruby-changes:32807

From: ko1 <ko1@a...>
Date: Sat, 8 Feb 2014 16:03:48 +0900 (JST)
Subject: [ruby-changes:32807] ko1:r44886 (trunk): * gc.c, gc.h (rb_objspace_marked_object_p): added.

ko1	2014-02-08 16:03:43 +0900 (Sat, 08 Feb 2014)

  New Revision: 44886

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

  Log:
    * gc.c, gc.h (rb_objspace_marked_object_p): added.
      This function *ONLY* works just after marking phase,
      before any sweeping.
      This function is highly depending current GC implementation
      and can be removed future version.

  Modified files:
    trunk/ChangeLog
    trunk/gc.c
    trunk/gc.h
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 44885)
+++ ChangeLog	(revision 44886)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Feb  8 15:54:12 2014  Koichi Sasada  <ko1@a...>
+
+	* gc.c, gc.h (rb_objspace_marked_object_p): added.
+	  This function *ONLY* works just after marking phase,
+	  before any sweeping.
+	  This function is highly depending current GC implementation
+	  and can be removed future version.
+
 Sat Feb  8 15:41:37 2014  Tanaka Akira  <akr@f...>
 
 	* lib/resolv.rb: Don't set CLOEXEC flag explicitly.  (Ruby set it by
Index: gc.c
===================================================================
--- gc.c	(revision 44885)
+++ gc.c	(revision 44886)
@@ -3597,6 +3597,17 @@ rb_gc_mark(VALUE ptr) https://github.com/ruby/ruby/blob/trunk/gc.c#L3597
     gc_mark(&rb_objspace, ptr);
 }
 
+/* CAUTION: THIS FUNCTION ENABLE *ONLY BEFORE* SWEEPING.
+ * This function is only for GC_END_MARK timing.
+ */
+
+int
+rb_objspace_marked_object_p(VALUE obj)
+{
+    rb_objspace_t *objspace = &rb_objspace;
+    return gc_marked(objspace, obj) ? TRUE : FALSE;
+}
+
 /* resurrect non-marked `obj' if obj is before swept */
 
 void
Index: gc.h
===================================================================
--- gc.h	(revision 44885)
+++ gc.h	(revision 44886)
@@ -91,6 +91,7 @@ void rb_objspace_reachable_objects_from( https://github.com/ruby/ruby/blob/trunk/gc.h#L91
 void rb_objspace_reachable_objects_from_root(void (func)(const char *category, VALUE, void *), void *data);
 int rb_objspace_markable_object_p(VALUE obj);
 int rb_objspace_internal_object_p(VALUE obj);
+int rb_objspace_marked_object_p(VALUE obj);
 
 void rb_objspace_each_objects(
     int (*callback)(void *start, void *end, size_t stride, void *data),

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

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