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

ruby-changes:37952

From: ko1 <ko1@a...>
Date: Fri, 20 Mar 2015 13:28:54 +0900 (JST)
Subject: [ruby-changes:37952] ko1:r50033 (trunk): * gc.c (obj_info): obj_info() can receive internal objects.

ko1	2015-03-20 13:28:41 +0900 (Fri, 20 Mar 2015)

  New Revision: 50033

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

  Log:
    * gc.c (obj_info): obj_info() can receive internal objects.
    * gc.c (check_rvalue_consistency): obj_info() returns const char *.

  Modified files:
    trunk/ChangeLog
    trunk/gc.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 50032)
+++ ChangeLog	(revision 50033)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Mar 20 12:38:36 2015  Koichi Sasada  <ko1@a...>
+
+	* gc.c (obj_info): obj_info() can receive internal objects.
+
+	* gc.c (check_rvalue_consistency): obj_info() returns const char *.
+
 Fri Mar 20 12:14:37 2015  Koichi Sasada  <ko1@a...>
 
 	* gc.c (obj_info): show class name and T_DATA type_name.
Index: gc.c
===================================================================
--- gc.c	(revision 50032)
+++ gc.c	(revision 50033)
@@ -998,8 +998,8 @@ check_rvalue_consistency(const VALUE obj https://github.com/ruby/ruby/blob/trunk/gc.c#L998
 	const int marking_bit = RVALUE_MARKING_BITMAP(obj) != 0, remembered_bit = marking_bit;
 	const int age = RVALUE_FLAGS_AGE(RBASIC(obj)->flags);
 
-	if (BUILTIN_TYPE(obj) == T_NONE)   rb_bug("check_rvalue_consistency: %p is T_NONE", obj_info(obj));
-	if (BUILTIN_TYPE(obj) == T_ZOMBIE) rb_bug("check_rvalue_consistency: %p is T_ZOMBIE", obj_info(obj));
+	if (BUILTIN_TYPE(obj) == T_NONE)   rb_bug("check_rvalue_consistency: %s is T_NONE", obj_info(obj));
+	if (BUILTIN_TYPE(obj) == T_ZOMBIE) rb_bug("check_rvalue_consistency: %s is T_ZOMBIE", obj_info(obj));
 	obj_memsize_of((VALUE)obj, FALSE);
 
 	/* check generation
@@ -8817,19 +8817,16 @@ obj_info(VALUE obj) https://github.com/ruby/ruby/blob/trunk/gc.c#L8817
 	     C(RVALUE_WB_UNPROTECTED_BITMAP(obj), "U"),
 	     obj_type_name(obj));
 
-    switch (type) {
-      case T_NODE:
-      case T_IMEMO:
-	break;
-      default:
-	if (RBASIC(obj)->klass == 0) {
-	    snprintf(buff, OBJ_INFO_BUFFERS_SIZE, "%s (internal)", buff);
-	}
-	else {
-	    VALUE class_path = rb_class_path_cached(RBASIC(obj)->klass);
-	    if (!NIL_P(class_path)) {
-		snprintf(buff, OBJ_INFO_BUFFERS_SIZE, "%s (%s)", buff, RSTRING_PTR(class_path));
-	    }
+    if (internal_object_p(obj)) {
+	/* ignore */
+    }
+    else if (RBASIC(obj)->klass == 0) {
+	snprintf(buff, OBJ_INFO_BUFFERS_SIZE, "%s (temporary internal)", buff);
+    }
+    else {
+	VALUE class_path = rb_class_path_cached(RBASIC(obj)->klass);
+	if (!NIL_P(class_path)) {
+	    snprintf(buff, OBJ_INFO_BUFFERS_SIZE, "%s (%s)", buff, RSTRING_PTR(class_path));
 	}
     }
 

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

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