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

ruby-changes:38937

From: ko1 <ko1@a...>
Date: Thu, 25 Jun 2015 03:38:52 +0900 (JST)
Subject: [ruby-changes:38937] ko1:r51018 (trunk): * gc.c (RGENGC_OBJ_INFO, obj_info): add a macro to enable/disable

ko1	2015-06-25 03:38:36 +0900 (Thu, 25 Jun 2015)

  New Revision: 51018

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

  Log:
    * gc.c (RGENGC_OBJ_INFO, obj_info): add a macro to enable/disable
      rich obj_info() output.
      At the default, the value of RGENGC_OBJ_INFO is
      (RGENGC_DEBUG | RGENGC_CHECK_MODE).
    * gc.c (RGENGC_OBJ_INFO): force enable it to debug #11244.
    * gc.c (gc_mark_ptr): print more details with obj_info().
    * gc.c (gc_mark_children): remove useless debug prints.

  Modified files:
    trunk/ChangeLog
    trunk/gc.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 51017)
+++ ChangeLog	(revision 51018)
@@ -1,3 +1,17 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Jun 25 03:33:21 2015  Koichi Sasada  <ko1@a...>
+
+	* gc.c (RGENGC_OBJ_INFO, obj_info): add a macro to enable/disable
+	  rich obj_info() output.
+
+	  At the default, the value of RGENGC_OBJ_INFO is
+	  (RGENGC_DEBUG | RGENGC_CHECK_MODE).
+
+	* gc.c (RGENGC_OBJ_INFO): force enable it to debug #11244.
+
+	* gc.c (gc_mark_ptr): print more details with obj_info().
+
+	* gc.c (gc_mark_children): remove useless debug prints.
+
 Thu Jun 25 02:40:33 2015  Eric Wong  <e@8...>
 
 	* ext/openssl/ossl_ssl.c (ossl_ssl_read_internal):
Index: gc.c
===================================================================
--- gc.c	(revision 51017)
+++ gc.c	(revision 51018)
@@ -305,6 +305,12 @@ static ruby_gc_params_t gc_params = { https://github.com/ruby/ruby/blob/trunk/gc.c#L305
 #define GC_DEBUG_STRESS_TO_CLASS 0
 #endif
 
+#define RGENGC_OBJ_INFO 1
+
+#ifndef RGENGC_OBJ_INFO
+#define RGENGC_OBJ_INFO (RGENGC_DEBUG | RGENGC_CHECK_MODE)
+#endif
+
 typedef enum {
     GPR_FLAG_NONE               = 0x000,
     /* major reason */
@@ -4192,11 +4198,18 @@ static void https://github.com/ruby/ruby/blob/trunk/gc.c#L4198
 gc_mark_ptr(rb_objspace_t *objspace, VALUE obj)
 {
     if (LIKELY(objspace->mark_func_data == NULL)) {
-	rgengc_check_relation(objspace, obj);
-
 	/* check code for Bug #11244 */
-	if (BUILTIN_TYPE(obj) == T_NONE) rb_bug("gc_mark_ptr: obj is T_NONE");
+	if (BUILTIN_TYPE(obj) == T_NONE) {
+	    if (objspace->rgengc.parent_object) {
+		rb_bug("gc_mark_ptr: obj is %s (parent: %s)", obj_info(obj),
+		       obj_info(objspace->rgengc.parent_object));
+	    }
+	    else {
+		rb_bug("gc_mark_ptr: obj is %s (parent is not old)", obj_info(obj));
+	    }
+	}
 
+	rgengc_check_relation(objspace, obj);
 	if (!gc_mark_set(objspace, obj)) return; /* already marked */
 	gc_aging(objspace, obj);
 	gc_grey(objspace, obj);
@@ -4304,10 +4317,6 @@ gc_mark_children(rb_objspace_t *objspace https://github.com/ruby/ruby/blob/trunk/gc.c#L4317
 	if (!RCLASS_EXT(obj)) break;
 	mark_tbl(objspace, RCLASS_IV_TBL(obj));
 	mark_const_tbl(objspace, RCLASS_CONST_TBL(obj));
-
-	/* TODO: remove it. check code for Bug #11244 */
-	if (RB_TYPE_P(RCLASS_SUPER(obj), T_NONE)) rb_bug("gc_mark_children: super is T_NONE (%s)", obj_info(obj));
-
 	gc_mark(objspace, RCLASS_SUPER((VALUE)obj));
 	break;
 
@@ -8828,7 +8837,7 @@ obj_type_name(VALUE obj) https://github.com/ruby/ruby/blob/trunk/gc.c#L8837
     return type_name(TYPE(obj), obj);
 }
 
-#if RGENGC_DEBUG || RGENGC_CHECK_MODE
+#if RGENGC_OBJ_INFO
 #define OBJ_INFO_BUFFERS_NUM  10
 #define OBJ_INFO_BUFFERS_SIZE 0x100
 static int obj_info_buffers_index = 0;

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

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