diff options
-rw-r--r-- | gc.c | 99 | ||||
-rw-r--r-- | variable.c | 5 | ||||
-rw-r--r-- | version.h | 2 |
3 files changed, 56 insertions, 50 deletions
@@ -3460,11 +3460,11 @@ gc_page_sweep(rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *sweep_ if (bitset & 1) { switch (BUILTIN_TYPE(p)) { default: { /* majority case */ - gc_report(2, objspace, "page_sweep: free %s\n", obj_info((VALUE)p)); + gc_report(2, objspace, "page_sweep: free %p\n", (void *)p); #if USE_RGENGC && RGENGC_CHECK_MODE if (!is_full_marking(objspace)) { - if (RVALUE_OLD_P((VALUE)p)) rb_bug("page_sweep: %s - old while minor GC.", obj_info((VALUE)p)); - if (rgengc_remembered(objspace, (VALUE)p)) rb_bug("page_sweep: %s - remembered.", obj_info((VALUE)p)); + if (RVALUE_OLD_P((VALUE)p)) rb_bug("page_sweep: %p - old while minor GC.", (void *)p); + if (rgengc_remembered(objspace, (VALUE)p)) rb_bug("page_sweep: %p - remembered.", (void *)p); } #endif if (obj_free(objspace, (VALUE)p)) { @@ -5877,18 +5877,18 @@ NOINLINE(static void gc_writebarrier_incremental(VALUE a, VALUE b, rb_objspace_t static void gc_writebarrier_incremental(VALUE a, VALUE b, rb_objspace_t *objspace) { - gc_report(2, objspace, "gc_writebarrier_incremental: [LG] %s -> %s\n", obj_info(a), obj_info(b)); + gc_report(2, objspace, "gc_writebarrier_incremental: [LG] %p -> %s\n", (void *)a, obj_info(b)); if (RVALUE_BLACK_P(a)) { if (RVALUE_WHITE_P(b)) { if (!RVALUE_WB_UNPROTECTED(a)) { - gc_report(2, objspace, "gc_writebarrier_incremental: [IN] %s -> %s\n", obj_info(a), obj_info(b)); + gc_report(2, objspace, "gc_writebarrier_incremental: [IN] %p -> %s\n", (void *)a, obj_info(b)); gc_mark_from(objspace, b, a); } } else if (RVALUE_OLD_P(a) && !RVALUE_OLD_P(b)) { if (!RVALUE_WB_UNPROTECTED(b)) { - gc_report(1, objspace, "gc_writebarrier_incremental: [GN] %s -> %s\n", obj_info(a), obj_info(b)); + gc_report(1, objspace, "gc_writebarrier_incremental: [GN] %p -> %s\n", (void *)a, obj_info(b)); RVALUE_AGE_SET_OLD(objspace, b); if (RVALUE_BLACK_P(b)) { @@ -5896,7 +5896,7 @@ gc_writebarrier_incremental(VALUE a, VALUE b, rb_objspace_t *objspace) } } else { - gc_report(1, objspace, "gc_writebarrier_incremental: [LL] %s -> %s\n", obj_info(a), obj_info(b)); + gc_report(1, objspace, "gc_writebarrier_incremental: [LL] %p -> %s\n", (void *)a, obj_info(b)); gc_remember_unprotected(objspace, b); } } @@ -9271,64 +9271,69 @@ rb_raw_obj_info(char *buff, const int buff_size, VALUE obj) (int)RARRAY_LEN(obj)); break; case T_STRING: { - snprintf(buff, buff_size, "%s %s", buff, RSTRING_PTR(obj)); - break; + snprintf(buff, buff_size, "%s %s", buff, RSTRING_PTR(obj)); + break; } case T_CLASS: { - VALUE class_path = rb_class_path_cached(obj); - if (!NIL_P(class_path)) { - snprintf(buff, buff_size, "%s %s", buff, RSTRING_PTR(class_path)); - } - break; + VALUE class_path = rb_class_path_cached(obj); + if (!NIL_P(class_path)) { + snprintf(buff, buff_size, "%s %s", buff, RSTRING_PTR(class_path)); + } + break; } case T_DATA: { - const rb_iseq_t *iseq; - if (rb_obj_is_proc(obj) && (iseq = vm_proc_iseq(obj)) != NULL) { - rb_raw_iseq_info(buff, buff_size, iseq); - } - else { - const char * const type_name = rb_objspace_data_type_name(obj); - if (type_name) { - snprintf(buff, buff_size, "%s %s", buff, type_name); - } - } - break; + const rb_iseq_t *iseq; + if (rb_obj_is_proc(obj) && (iseq = vm_proc_iseq(obj)) != NULL) { + rb_raw_iseq_info(buff, buff_size, iseq); + } + else { + const char * const type_name = rb_objspace_data_type_name(obj); + if (type_name) { + snprintf(buff, buff_size, "%s %s", buff, type_name); + } + } + break; } case T_IMEMO: { - const char *imemo_name; - switch (imemo_type(obj)) { + const char *imemo_name = "\0"; + switch (imemo_type(obj)) { #define IMEMO_NAME(x) case imemo_##x: imemo_name = #x; break; - IMEMO_NAME(env); - IMEMO_NAME(cref); - IMEMO_NAME(svar); - IMEMO_NAME(throw_data); - IMEMO_NAME(ifunc); - IMEMO_NAME(memo); - IMEMO_NAME(ment); - IMEMO_NAME(iseq); + IMEMO_NAME(env); + IMEMO_NAME(cref); + IMEMO_NAME(svar); + IMEMO_NAME(throw_data); + IMEMO_NAME(ifunc); + IMEMO_NAME(memo); + IMEMO_NAME(ment); + IMEMO_NAME(iseq); #undef IMEMO_NAME - } - snprintf(buff, buff_size, "%s %s", buff, imemo_name); + } + snprintf(buff, buff_size, "%s %s", buff, imemo_name); - switch (imemo_type(obj)) { - case imemo_ment: { - const rb_method_entry_t *me = &RANY(obj)->as.imemo.ment; + switch (imemo_type(obj)) { + case imemo_ment: { + const rb_method_entry_t *me = &RANY(obj)->as.imemo.ment; + if (me->def) { snprintf(buff, buff_size, "%s (called_id: %s, type: %s, alias: %d, owner: %s, defined_class: %s)", buff, rb_id2name(me->called_id), method_type_name(me->def->type), me->def->alias_count, obj_info(me->owner), obj_info(me->defined_class)); - break; } - case imemo_iseq: { - const rb_iseq_t *iseq = (const rb_iseq_t *)obj; - rb_raw_iseq_info(buff, buff_size, iseq); - break; + else { + snprintf(buff, buff_size, "%s", rb_id2name(me->called_id)); } - default: - break; + break; + } + case imemo_iseq: { + const rb_iseq_t *iseq = (const rb_iseq_t *)obj; + rb_raw_iseq_info(buff, buff_size, iseq); + break; } + default: + break; + } } default: break; diff --git a/variable.c b/variable.c index 8e11b4086d..f84475ddf9 100644 --- a/variable.c +++ b/variable.c @@ -317,10 +317,11 @@ rb_class_path_no_cache(VALUE klass) VALUE rb_class_path_cached(VALUE klass) { - st_table *ivtbl = RCLASS_IV_TBL(klass); + st_table *ivtbl; st_data_t n; - if (!ivtbl) return Qnil; + if (!RCLASS_EXT(klass)) return Qnil; + if (!(ivtbl = RCLASS_IV_TBL(klass))) return Qnil; if (st_lookup(ivtbl, (st_data_t)classpath, &n)) return (VALUE)n; if (st_lookup(ivtbl, (st_data_t)tmp_classpath, &n)) return (VALUE)n; return Qnil; @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.4.4" #define RUBY_RELEASE_DATE "2018-03-20" -#define RUBY_PATCHLEVEL 269 +#define RUBY_PATCHLEVEL 270 #define RUBY_RELEASE_YEAR 2018 #define RUBY_RELEASE_MONTH 3 |