From: ivmai Date: Tue, 3 May 2011 07:21:16 +0000 (+0000) Subject: 2011-05-03 Ivan Maidanski X-Git-Tag: gc7_2alpha6~48 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5f3d02837738332457ed15a63d868a16c6c352b0;p=gc 2011-05-03 Ivan Maidanski * dbg_mlc.c (GC_store_debug_info_inner, GC_store_debug_info): Rename "integer" argument to "linenum"; change the type of the argument to int. * gcj_mlc.c (GC_store_debug_info): Ditto. * dbg_mlc.c (GET_OH_LINENUM): New macro. * dbg_mlc.c (GC_print_obj, GC_print_smashed_obj): Use GET_OH_LINENUM; adjust print format specifier. * dbg_mlc.c (GC_debug_malloc, GC_debug_malloc_ignore_off_page, GC_debug_malloc_atomic_ignore_off_page, GC_debug_generic_malloc_inner, GC_debug_generic_malloc_inner_ignore_off_page, GC_debug_malloc_stubborn, GC_debug_malloc_atomic, GC_debug_malloc_uncollectable, GC_debug_malloc_atomic_uncollectable): Remove unnecessary cast of "i". * gcj_mlc.c (GC_debug_gcj_malloc): Ditto. --- diff --git a/ChangeLog b/ChangeLog index 250bc368..f35aaa09 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2011-05-03 Ivan Maidanski + + * dbg_mlc.c (GC_store_debug_info_inner, GC_store_debug_info): + Rename "integer" argument to "linenum"; change the type of the + argument to int. + * gcj_mlc.c (GC_store_debug_info): Ditto. + * dbg_mlc.c (GET_OH_LINENUM): New macro. + * dbg_mlc.c (GC_print_obj, GC_print_smashed_obj): Use + GET_OH_LINENUM; adjust print format specifier. + * dbg_mlc.c (GC_debug_malloc, GC_debug_malloc_ignore_off_page, + GC_debug_malloc_atomic_ignore_off_page, + GC_debug_generic_malloc_inner, + GC_debug_generic_malloc_inner_ignore_off_page, + GC_debug_malloc_stubborn, GC_debug_malloc_atomic, + GC_debug_malloc_uncollectable, + GC_debug_malloc_atomic_uncollectable): Remove unnecessary cast of + "i". + * gcj_mlc.c (GC_debug_gcj_malloc): Ditto. + 2011-04-26 Ivan Maidanski * .cvsignore (initsecondarythread, test_cpp): Add. diff --git a/dbg_mlc.c b/dbg_mlc.c index 4ab78f97..6e6ab699 100644 --- a/dbg_mlc.c +++ b/dbg_mlc.c @@ -255,7 +255,7 @@ GC_INNER void GC_default_print_heap_obj_proc(ptr_t p); /* Store debugging info into p. Return displaced pointer. */ /* This version assumes we do hold the allocation lock. */ STATIC ptr_t GC_store_debug_info_inner(ptr_t p, word sz, const char *string, - word integer) + int linenum) { word * result = (word *)((oh *)p + 1); @@ -268,7 +268,7 @@ STATIC ptr_t GC_store_debug_info_inner(ptr_t p, word sz, const char *string, ((oh *)p) -> oh_bg_ptr = HIDE_BACK_PTR((ptr_t)0); # endif ((oh *)p) -> oh_string = string; - ((oh *)p) -> oh_int = integer; + ((oh *)p) -> oh_int = linenum; # ifndef SHORT_DBG_HDRS ((oh *)p) -> oh_sz = sz; ((oh *)p) -> oh_sf = START_FLAG ^ (word)result; @@ -279,13 +279,13 @@ STATIC ptr_t GC_store_debug_info_inner(ptr_t p, word sz, const char *string, } GC_INNER ptr_t GC_store_debug_info(ptr_t p, word sz, const char *string, - word integer) + int linenum) { ptr_t result; DCL_LOCK_STATE; LOCK(); - result = GC_store_debug_info_inner(p, sz, string, integer); + result = GC_store_debug_info_inner(p, sz, string, linenum); UNLOCK(); return result; } @@ -364,6 +364,8 @@ STATIC void GC_print_type(ptr_t p) } } +#define GET_OH_LINENUM(ohdr) ((int)(ohdr)->oh_int) + /* Print a human-readable description of the object to stderr. p points */ /* to somewhere inside an object with the debugging info. */ STATIC void GC_print_obj(ptr_t p) @@ -377,10 +379,10 @@ STATIC void GC_print_obj(ptr_t p) GC_err_printf("%p (", ((ptr_t)ohdr + sizeof(oh))); GC_err_puts(ohdr -> oh_string); # ifdef SHORT_DBG_HDRS - GC_err_printf(":%ld, ", (unsigned long)(ohdr -> oh_int)); + GC_err_printf(":%d, ", GET_OH_LINENUM(ohdr)); # else - GC_err_printf(":%ld, sz=%ld, ", (unsigned long)(ohdr -> oh_int), - (unsigned long)(ohdr -> oh_sz)); + GC_err_printf(":%d, sz=%lu, ", + GET_OH_LINENUM(ohdr), (unsigned long)(ohdr -> oh_sz)); # endif GC_print_type((ptr_t)(ohdr + 1)); GC_err_puts(")\n"); @@ -416,13 +418,12 @@ STATIC void GC_debug_print_heap_obj_proc(ptr_t p) clobbered_addr, p, (unsigned long)(GC_size((ptr_t)ohdr) - DEBUG_BYTES)); } else { - GC_err_printf("%p in or near object at %p(%s:%lu, sz=%lu)\n", + GC_err_printf("%p in or near object at %p (%s:%d, sz=%lu)\n", clobbered_addr, p, (word)(ohdr -> oh_string) < HBLKSIZE ? "(smashed string)" : ohdr -> oh_string[0] == '\0' ? "EMPTY(smashed?)" : ohdr -> oh_string, - (unsigned long)(ohdr -> oh_int), - (unsigned long)(ohdr -> oh_sz)); + GET_OH_LINENUM(ohdr), (unsigned long)(ohdr -> oh_sz)); PRINT_CALL_CHAIN(ohdr); } } @@ -476,7 +477,7 @@ GC_API void * GC_CALL GC_debug_malloc(size_t lb, GC_EXTRA_PARAMS) GC_start_debugging(); } ADD_CALL_CHAIN(result, ra); - return (GC_store_debug_info(result, (word)lb, s, (word)i)); + return (GC_store_debug_info(result, (word)lb, s, i)); } GC_API void * GC_CALL GC_debug_malloc_ignore_off_page(size_t lb, @@ -495,7 +496,7 @@ GC_API void * GC_CALL GC_debug_malloc_ignore_off_page(size_t lb, GC_start_debugging(); } ADD_CALL_CHAIN(result, ra); - return (GC_store_debug_info(result, (word)lb, s, (word)i)); + return (GC_store_debug_info(result, (word)lb, s, i)); } GC_API void * GC_CALL GC_debug_malloc_atomic_ignore_off_page(size_t lb, @@ -514,7 +515,7 @@ GC_API void * GC_CALL GC_debug_malloc_atomic_ignore_off_page(size_t lb, GC_start_debugging(); } ADD_CALL_CHAIN(result, ra); - return (GC_store_debug_info(result, (word)lb, s, (word)i)); + return (GC_store_debug_info(result, (word)lb, s, i)); } #ifdef DBG_HDRS_ALL @@ -533,7 +534,7 @@ GC_API void * GC_CALL GC_debug_malloc_atomic_ignore_off_page(size_t lb, return(0); } ADD_CALL_CHAIN(result, GC_RETURN_ADDR); - return (GC_store_debug_info_inner(result, (word)lb, "INTERNAL", (word)0)); + return (GC_store_debug_info_inner(result, (word)lb, "INTERNAL", 0)); } GC_INNER void * GC_debug_generic_malloc_inner_ignore_off_page(size_t lb, @@ -548,7 +549,7 @@ GC_API void * GC_CALL GC_debug_malloc_atomic_ignore_off_page(size_t lb, return(0); } ADD_CALL_CHAIN(result, GC_RETURN_ADDR); - return (GC_store_debug_info_inner(result, (word)lb, "INTERNAL", (word)0)); + return (GC_store_debug_info_inner(result, (word)lb, "INTERNAL", 0)); } #endif /* DBG_HDRS_ALL */ @@ -568,7 +569,7 @@ GC_API void * GC_CALL GC_debug_malloc_atomic_ignore_off_page(size_t lb, GC_start_debugging(); } ADD_CALL_CHAIN(result, ra); - return (GC_store_debug_info(result, (word)lb, s, (word)i)); + return (GC_store_debug_info(result, (word)lb, s, i)); } GC_API void GC_CALL GC_debug_change_stubborn(void *p) @@ -634,7 +635,7 @@ GC_API void * GC_CALL GC_debug_malloc_atomic(size_t lb, GC_EXTRA_PARAMS) GC_start_debugging(); } ADD_CALL_CHAIN(result, ra); - return (GC_store_debug_info(result, (word)lb, s, (word)i)); + return (GC_store_debug_info(result, (word)lb, s, i)); } GC_API char * GC_CALL GC_debug_strdup(const char *str, GC_EXTRA_PARAMS) @@ -717,7 +718,7 @@ GC_API void * GC_CALL GC_debug_malloc_uncollectable(size_t lb, GC_start_debugging(); } ADD_CALL_CHAIN(result, ra); - return (GC_store_debug_info(result, (word)lb, s, (word)i)); + return (GC_store_debug_info(result, (word)lb, s, i)); } #ifdef ATOMIC_UNCOLLECTABLE @@ -739,7 +740,7 @@ GC_API void * GC_CALL GC_debug_malloc_uncollectable(size_t lb, GC_start_debugging(); } ADD_CALL_CHAIN(result, ra); - return (GC_store_debug_info(result, (word)lb, s, (word)i)); + return (GC_store_debug_info(result, (word)lb, s, i)); } #endif /* ATOMIC_UNCOLLECTABLE */ diff --git a/gcj_mlc.c b/gcj_mlc.c index a3d9358f..3c54974c 100644 --- a/gcj_mlc.c +++ b/gcj_mlc.c @@ -209,7 +209,7 @@ GC_INNER void GC_start_debugging(void); /* defined in dbg_mlc.c */ /* Store debugging info into p. Return displaced pointer. */ /* Assumes we don't hold allocation lock. */ GC_INNER ptr_t GC_store_debug_info(ptr_t p, word sz, const char *str, - word integer); + int linenum); /* Similar to GC_gcj_malloc, but add debug info. This is allocated */ /* with GC_gcj_debug_kind. */ @@ -239,7 +239,7 @@ GC_API void * GC_CALL GC_debug_gcj_malloc(size_t lb, GC_start_debugging(); } ADD_CALL_CHAIN(result, ra); - return (GC_store_debug_info(result, (word)lb, s, (word)i)); + return (GC_store_debug_info(result, (word)lb, s, i)); } /* There is no THREAD_LOCAL_ALLOC for GC_gcj_malloc_ignore_off_page(). */