From 9533da6f1f306491858ba12fc630171e6ad97ae7 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 4 Nov 2017 14:32:48 +0000 Subject: [PATCH] gc.c: UNEXPECTED_NODE * gc.c (UNEXPECTED_NODE): extract rb_bug for T_NODE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- gc.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/gc.c b/gc.c index e79a09945e..247e4bfd85 100644 --- a/gc.c +++ b/gc.c @@ -2000,6 +2000,10 @@ rb_newobj_of(VALUE klass, VALUE flags) return newobj_of(klass, flags & ~FL_WB_PROTECTED, 0, 0, 0, flags & FL_WB_PROTECTED); } +#define UNEXPECTED_NODE(func) \ + rb_bug(#func"(): GC does not handle T_NODE 0x%x(%p) 0x%"PRIxVALUE, \ + BUILTIN_TYPE(obj), (void*)(obj), RBASIC(obj)->flags) + #undef rb_imemo_new VALUE @@ -2320,8 +2324,7 @@ obj_free(rb_objspace_t *objspace, VALUE obj) break; case T_NODE: - rb_bug("obj_free(): GC does not handle T_NODE 0x%x(%p) 0x%"PRIxVALUE, - BUILTIN_TYPE(obj), (void*)obj, RBASIC(obj)->flags); + UNEXPECTED_NODE(obj_free); break; case T_STRUCT: @@ -2526,9 +2529,8 @@ internal_object_p(VALUE obj) if (p->as.basic.flags) { switch (BUILTIN_TYPE(p)) { case T_NODE: - rb_bug("internal_object_p(): GC does not handle T_NODE 0x%x(%p) 0x%"PRIxVALUE, - BUILTIN_TYPE(obj), (void*)obj, RBASIC(obj)->flags); - break; + UNEXPECTED_NODE(internal_object_p); + break; case T_NONE: case T_IMEMO: case T_ICLASS: @@ -3302,8 +3304,7 @@ obj_memsize_of(VALUE obj, int use_all_types) break; case T_NODE: - rb_bug("obj_memsize_of(): GC does not handle T_NODE 0x%x(%p) 0x%"PRIxVALUE, - BUILTIN_TYPE(obj), (void*)obj, RBASIC(obj)->flags); + UNEXPECTED_NODE(obj_memsize_of); break; case T_STRUCT: @@ -4568,8 +4569,7 @@ gc_mark_children(rb_objspace_t *objspace, VALUE obj) break; case T_NODE: - rb_bug("rb_gc_mark(): GC does not handle T_NODE 0x%x(%p) 0x%"PRIxVALUE, - BUILTIN_TYPE(obj), (void*)obj, RBASIC(obj)->flags); + UNEXPECTED_NODE(rb_gc_mark); break; case T_IMEMO: @@ -9327,8 +9327,7 @@ rb_raw_obj_info(char *buff, const int buff_size, VALUE obj) switch (type) { case T_NODE: - rb_bug("rb_raw_obj_info(): GC does not handle T_NODE 0x%x(%p) 0x%"PRIxVALUE, - BUILTIN_TYPE(obj), (void*)obj, RBASIC(obj)->flags); + UNEXPECTED_NODE(rb_raw_obj_info); break; case T_ARRAY: snprintf(buff, buff_size, "%s [%s%s] len: %d", buff,