mirror of
https://github.com/encounter/bdwgc.git
synced 2026-03-30 10:57:55 -07:00
Convert GC source files to valid C++ code
Issue #206 (bdwgc). * alloc.c (GC_copyright): Change type from char* const to const char* const. * alloc.c (GC_set_fl_marks, GC_clear_fl_marks, GC_finish_collection, GC_allocobj): Add missing explicit casts from void* to ptr_t. * backgraph.c [MAKE_BACK_GRAPH] (add_back_edges): Likewise. * blacklst.c (GC_default_print_heap_obj_proc, GC_print_blacklisted_ptr): Likewise. * dbg_mlc.c (GC_get_back_ptr_info, GC_store_debug_info_inner, GC_store_debug_info, GC_debug_malloc, GC_debug_malloc_ignore_off_page, GC_debug_malloc_atomic_ignore_off_page, GC_debug_generic_malloc, GC_debug_malloc_stubborn, GC_debug_malloc_atomic, GC_debug_malloc_uncollectable, GC_debug_malloc_atomic_uncollectable, GC_debug_free, GC_debug_free_inner, GC_debug_register_finalizer, GC_debug_register_finalizer_no_order, GC_debug_register_finalizer_unreachable, GC_debug_register_finalizer_ignore_self): Likewise. * finalize.c (GC_grow_table, push_and_mark_object, ensure_toggleref_capacity, GC_dump_finalization_links, GC_dump_finalization, GC_make_disappearing_links_disappear, GC_remove_dangling_disappearing_links, GC_finalize): Likewise. * gcj_mlc.c (GC_gcj_malloc, GC_debug_gcj_malloc, GC_gcj_malloc_ignore_off_page): Likewise. * include/private/gc_pmark.h (PUSH_CONTENTS_HDR): Likewise. * mallocx.c (GC_memalign): Likewise. * mark.c (GC_mark_from, GC_mark_and_push, GC_push_all_eager, GC_push_all_stack, GC_push_marked1, GC_push_marked2, GC_push_marked4): Likewise. * mark_rts.c (GC_exclude_static_roots_inner): Likewise. * misc.c (GC_base): Likewise. * new_hblk.c (GC_new_hblk): Likewise. * pthread_support.c (GC_register_altstack, GC_thr_init, GC_record_stack_base): Likewise. * ptr_chck.c (GC_is_visible): Likewise. * reclaim.c (GC_reclaim_small_nonempty_block, GC_disclaim_and_reclaim_or_free_small_block): Likewise. * thread_local_alloc.c (GC_mark_thread_local_fls_for): Likewise. * typd_mlc.c (GC_typed_mark_proc, GC_malloc_explicitly_typed_ignore_off_page): Likewise. * win32_threads.c (GC_record_stack_base, GC_get_stack_min, GC_push_stack_for): Likewise. * blacklst.c (GC_copy_bl): Rename "new" argument to "dest". * dbg_mlc.c (GC_store_debug_info_inner, GC_print_smashed_obj): Change type of p argument from ptr_t to void*. * include/private/gc_priv.h (GC_is_heap_base, GC_is_static_root): Likewise. * mark_rts.c [!THREADS] (GC_is_static_root): Likewise. * os_dep.c (GC_is_malloc_heap_base, GC_is_heap_base): Likewise. * ptr_chck.c (GC_on_stack): Likewise. * dbg_mlc.c (GC_print_obj): Change type of kind_str local variable from char* to const char*. * dbg_mlc.c (GC_debug_strdup, GC_debug_strndup): Cast result of GC_debug_malloc_atomic() to char*. * mallocx.c (GC_strdup, GC_strndup): Likewise. * dbg_mlc.c (GC_debug_wcsdup): Cast result of GC_debug_malloc_atomic() to wchar_t*. * mallocx.c (GC_wcsdup): Likewise. * dyn_load.c [MSWIN32 || MSWINCE || CYGWIN32] (GC_register_dynamic_libraries): Cast p local variable to char*. * os_dep.c (GC_register_data_segments): Likewise. * fnlz_mlc.c [ENABLE_DISCLAIM] (GC_finalized_disclaim): Cast masked fc_word to struct GC_finalizer_closure* (instead of void*). * fnlz_mlc.c [ENABLE_DISCLAIM] (GC_finalized_malloc): Cast result of GC_malloc_kind() to word*. * typd_mlc.c (GC_malloc_explicitly_typed, GC_calloc_explicitly_typed): Likewise. * include/private/gc_priv.h (WARN): Cast away const qualifier for msg (and the string literal). * misc.c (GC_default_on_abort): Remove cast to void* for WRITE() buf argument. * misc.c (GC_new_free_list_inner): Cast result local variable to void**. * misc.c (GC_new_free_list): Change type of result local variable from void* to void**. * pthread_support.c (GC_start_rtn_prepare_thread): Cast arg to struct start_info*. * win32_threads.c [GC_PTHREADS] (GC_pthread_start_inner): Likewise. * reclaim.c (GC_print_free_list): Replace ptr_t flh to void *flh_next local variable; remove redundant casts. * tools/if_mach.c (EXECV_ARGV_T): New macro; add comment. * tools/if_not_there.c (EXECV_ARGV_T): Likewise. * tools/if_mach.c (main): Use EXECV_ARGV_T instead of void* for execvp() argument. * tools/if_not_there.c (main): Likewise. * typd_mlc.c (LeafDescriptor, ComplexArrayDescriptor, SequenceDescriptor): Move struct definition out of union ComplexDescriptor. * typd_mlc.c (GC_add_ext_descriptor): Rename "new" local variable to newExtD. * win32_threads.c (GC_CreateThread, GC_beginthreadex): Cast result of GC_malloc_uncollectable() to thread_args*. * win32_threads.c [PARALLEL_MARK && !MSWINCE && __cplusplus] (GC_thr_init): Do not cast GetProcessAffinityMask() arguments to void*.
This commit is contained in:
@@ -117,7 +117,7 @@ STATIC GC_bool GC_need_full_gc = FALSE;
|
||||
STATIC word GC_used_heap_size_after_full = 0;
|
||||
|
||||
/* GC_copyright symbol is externally visible. */
|
||||
char * const GC_copyright[] =
|
||||
const char * const GC_copyright[] =
|
||||
{"Copyright 1988,1989 Hans-J. Boehm and Alan J. Demers ",
|
||||
"Copyright (c) 1991-1995 by Xerox Corporation. All rights reserved. ",
|
||||
"Copyright (c) 1996-1998 by Silicon Graphics. All rights reserved. ",
|
||||
@@ -817,7 +817,7 @@ GC_INNER void GC_set_fl_marks(ptr_t q)
|
||||
++hhdr -> hb_n_marks;
|
||||
}
|
||||
|
||||
q = obj_link(q);
|
||||
q = (ptr_t)obj_link(q);
|
||||
if (q == NULL)
|
||||
break;
|
||||
|
||||
@@ -905,7 +905,7 @@ STATIC void GC_clear_fl_marks(ptr_t q)
|
||||
}
|
||||
GC_bytes_found -= sz;
|
||||
|
||||
q = obj_link(q);
|
||||
q = (ptr_t)obj_link(q);
|
||||
if (q == NULL)
|
||||
break;
|
||||
|
||||
@@ -976,8 +976,9 @@ STATIC void GC_finish_collection(void)
|
||||
|
||||
for (kind = 0; kind < GC_n_kinds; kind++) {
|
||||
for (size = 1; size <= MAXOBJGRANULES; size++) {
|
||||
q = GC_obj_kinds[kind].ok_freelist[size];
|
||||
if (q != 0) GC_set_fl_marks(q);
|
||||
q = (ptr_t)GC_obj_kinds[kind].ok_freelist[size];
|
||||
if (q != NULL)
|
||||
GC_set_fl_marks(q);
|
||||
}
|
||||
}
|
||||
GC_start_reclaim(TRUE);
|
||||
@@ -1018,8 +1019,9 @@ STATIC void GC_finish_collection(void)
|
||||
|
||||
for (kind = 0; kind < GC_n_kinds; kind++) {
|
||||
for (size = 1; size <= MAXOBJGRANULES; size++) {
|
||||
q = GC_obj_kinds[kind].ok_freelist[size];
|
||||
if (q != 0) GC_clear_fl_marks(q);
|
||||
q = (ptr_t)GC_obj_kinds[kind].ok_freelist[size];
|
||||
if (q != NULL)
|
||||
GC_clear_fl_marks(q);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1496,5 +1498,5 @@ GC_INNER ptr_t GC_allocobj(size_t gran, int kind)
|
||||
/* Successful allocation; reset failure count. */
|
||||
GC_fail_count = 0;
|
||||
|
||||
return(*flh);
|
||||
return (ptr_t)(*flh);
|
||||
}
|
||||
|
||||
+1
-1
@@ -345,7 +345,7 @@ static void add_back_edges(ptr_t p, size_t n_bytes, word gc_descr)
|
||||
FIXUP_POINTER(current);
|
||||
if (current >= (word)GC_least_plausible_heap_addr &&
|
||||
current <= (word)GC_greatest_plausible_heap_addr) {
|
||||
ptr_t target = GC_base((void *)current);
|
||||
ptr_t target = (ptr_t)GC_base((void *)current);
|
||||
if (0 != target) {
|
||||
add_edge(p, target);
|
||||
}
|
||||
|
||||
+4
-4
@@ -56,7 +56,7 @@ STATIC void GC_clear_bl(word *);
|
||||
|
||||
GC_INNER void GC_default_print_heap_obj_proc(ptr_t p)
|
||||
{
|
||||
ptr_t base = GC_base(p);
|
||||
ptr_t base = (ptr_t)GC_base(p);
|
||||
int kind = HDR(base)->hb_obj_kind;
|
||||
|
||||
GC_err_printf("object at %p of appr. %lu bytes (%s)\n",
|
||||
@@ -71,7 +71,7 @@ GC_INNER void (*GC_print_heap_obj)(ptr_t p) = GC_default_print_heap_obj_proc;
|
||||
STATIC void GC_print_blacklisted_ptr(word p, ptr_t source,
|
||||
const char *kind_str)
|
||||
{
|
||||
ptr_t base = GC_base(source);
|
||||
ptr_t base = (ptr_t)GC_base(source);
|
||||
|
||||
if (0 == base) {
|
||||
GC_err_printf("Black listing (%s) %p referenced from %p in %s\n",
|
||||
@@ -125,9 +125,9 @@ STATIC void GC_clear_bl(word *doomed)
|
||||
BZERO(doomed, sizeof(page_hash_table));
|
||||
}
|
||||
|
||||
STATIC void GC_copy_bl(word *old, word *new)
|
||||
STATIC void GC_copy_bl(word *old, word *dest)
|
||||
{
|
||||
BCOPY(old, new, sizeof(page_hash_table));
|
||||
BCOPY(old, dest, sizeof(page_hash_table));
|
||||
}
|
||||
|
||||
static word total_stack_black_listed(void);
|
||||
|
||||
@@ -139,8 +139,8 @@
|
||||
}
|
||||
}
|
||||
# endif
|
||||
bp_base = GC_base(bp);
|
||||
if (0 == bp_base) {
|
||||
bp_base = (ptr_t)GC_base(bp);
|
||||
if (NULL == bp_base) {
|
||||
*base_p = bp;
|
||||
*offset_p = 0;
|
||||
return GC_REFD_FROM_ROOT;
|
||||
@@ -191,8 +191,8 @@
|
||||
ptr_t base;
|
||||
do {
|
||||
result = GC_generate_random_heap_address();
|
||||
base = GC_base(result);
|
||||
} while (base == 0 || !GC_is_marked(base));
|
||||
base = (ptr_t)GC_base(result);
|
||||
} while (NULL == base || !GC_is_marked(base));
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -269,13 +269,13 @@
|
||||
|
||||
/* 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 GC_ATTR_UNUSED,
|
||||
STATIC void *GC_store_debug_info_inner(void *p, word sz GC_ATTR_UNUSED,
|
||||
const char *string, int linenum)
|
||||
{
|
||||
word * result = (word *)((oh *)p + 1);
|
||||
|
||||
GC_ASSERT(GC_size(p) >= sizeof(oh) + sz);
|
||||
GC_ASSERT(!(SMALL_OBJ(sz) && CROSSES_HBLK(p, sz)));
|
||||
GC_ASSERT(!(SMALL_OBJ(sz) && CROSSES_HBLK((ptr_t)p, sz)));
|
||||
# ifdef KEEP_BACK_PTRS
|
||||
((oh *)p) -> oh_back_ptr = HIDE_BACK_PTR(NOT_MARKED);
|
||||
# endif
|
||||
@@ -290,7 +290,7 @@ STATIC ptr_t GC_store_debug_info_inner(ptr_t p, word sz GC_ATTR_UNUSED,
|
||||
((word *)p)[BYTES_TO_WORDS(GC_size(p))-1] =
|
||||
result[SIMPLE_ROUNDED_UP_WORDS(sz)] = END_FLAG ^ (word)result;
|
||||
# endif
|
||||
return((ptr_t)result);
|
||||
return result;
|
||||
}
|
||||
|
||||
GC_INNER ptr_t GC_store_debug_info(ptr_t p, word sz, const char *string,
|
||||
@@ -300,7 +300,7 @@ GC_INNER ptr_t GC_store_debug_info(ptr_t p, word sz, const char *string,
|
||||
DCL_LOCK_STATE;
|
||||
|
||||
LOCK();
|
||||
result = GC_store_debug_info_inner(p, sz, string, linenum);
|
||||
result = (ptr_t)GC_store_debug_info_inner(p, sz, string, linenum);
|
||||
UNLOCK();
|
||||
return result;
|
||||
}
|
||||
@@ -356,7 +356,7 @@ STATIC void GC_print_obj(ptr_t p)
|
||||
ptr_t q;
|
||||
hdr * hhdr;
|
||||
int kind;
|
||||
char *kind_str;
|
||||
const char *kind_str;
|
||||
char buffer[GC_TYPE_DESCR_LEN + 1];
|
||||
|
||||
GC_ASSERT(I_DONT_HOLD_LOCK());
|
||||
@@ -433,7 +433,7 @@ STATIC void GC_debug_print_heap_obj_proc(ptr_t p)
|
||||
/* Use GC_err_printf and friends to print a description of the object */
|
||||
/* whose client-visible address is p, and which was smashed at */
|
||||
/* clobbered_addr. */
|
||||
STATIC void GC_print_smashed_obj(const char *msg, ptr_t p,
|
||||
STATIC void GC_print_smashed_obj(const char *msg, void *p,
|
||||
ptr_t clobbered_addr)
|
||||
{
|
||||
oh * ohdr = (oh *)GC_base(p);
|
||||
@@ -446,11 +446,11 @@ STATIC void GC_debug_print_heap_obj_proc(ptr_t p)
|
||||
|| ohdr -> oh_string == 0) {
|
||||
GC_err_printf(
|
||||
"%s %p in or near object at %p(<smashed>, appr. sz = %lu)\n",
|
||||
msg, (void *)clobbered_addr, (void *)p,
|
||||
msg, (void *)clobbered_addr, p,
|
||||
(unsigned long)(GC_size((ptr_t)ohdr) - DEBUG_BYTES));
|
||||
} else {
|
||||
GC_err_printf("%s %p in or near object at %p (%s:%d, sz=%lu)\n",
|
||||
msg, (void *)clobbered_addr, (void *)p,
|
||||
msg, (void *)clobbered_addr, p,
|
||||
(word)(ohdr -> oh_string) < HBLKSIZE ? "(smashed string)" :
|
||||
ohdr -> oh_string[0] == '\0' ? "EMPTY(smashed?)" :
|
||||
ohdr -> oh_string,
|
||||
@@ -550,7 +550,7 @@ GC_API GC_ATTR_MALLOC void * GC_CALL GC_debug_malloc(size_t lb,
|
||||
GC_start_debugging();
|
||||
}
|
||||
ADD_CALL_CHAIN(result, ra);
|
||||
return (GC_store_debug_info(result, (word)lb, s, i));
|
||||
return GC_store_debug_info((ptr_t)result, (word)lb, s, i);
|
||||
}
|
||||
|
||||
GC_API GC_ATTR_MALLOC void * GC_CALL
|
||||
@@ -567,7 +567,7 @@ GC_API GC_ATTR_MALLOC void * GC_CALL
|
||||
GC_start_debugging();
|
||||
}
|
||||
ADD_CALL_CHAIN(result, ra);
|
||||
return (GC_store_debug_info(result, (word)lb, s, i));
|
||||
return GC_store_debug_info((ptr_t)result, (word)lb, s, i);
|
||||
}
|
||||
|
||||
GC_API GC_ATTR_MALLOC void * GC_CALL
|
||||
@@ -585,7 +585,7 @@ GC_API GC_ATTR_MALLOC void * GC_CALL
|
||||
GC_start_debugging();
|
||||
}
|
||||
ADD_CALL_CHAIN(result, ra);
|
||||
return (GC_store_debug_info(result, (word)lb, s, i));
|
||||
return GC_store_debug_info((ptr_t)result, (word)lb, s, i);
|
||||
}
|
||||
|
||||
STATIC void * GC_debug_generic_malloc(size_t lb, int knd, GC_EXTRA_PARAMS)
|
||||
@@ -602,7 +602,7 @@ STATIC void * GC_debug_generic_malloc(size_t lb, int knd, GC_EXTRA_PARAMS)
|
||||
GC_start_debugging();
|
||||
}
|
||||
ADD_CALL_CHAIN(result, ra);
|
||||
return GC_store_debug_info(result, (word)lb, s, i);
|
||||
return GC_store_debug_info((ptr_t)result, (word)lb, s, i);
|
||||
}
|
||||
|
||||
#ifdef DBG_HDRS_ALL
|
||||
@@ -662,7 +662,7 @@ STATIC void * GC_debug_generic_malloc(size_t lb, int knd, GC_EXTRA_PARAMS)
|
||||
GC_start_debugging();
|
||||
}
|
||||
ADD_CALL_CHAIN(result, ra);
|
||||
return (GC_store_debug_info(result, (word)lb, s, i));
|
||||
return GC_store_debug_info((ptr_t)result, (word)lb, s, i);
|
||||
}
|
||||
|
||||
GC_API void GC_CALL GC_debug_change_stubborn(const void *p)
|
||||
@@ -725,7 +725,7 @@ GC_API GC_ATTR_MALLOC void * GC_CALL GC_debug_malloc_atomic(size_t lb,
|
||||
GC_start_debugging();
|
||||
}
|
||||
ADD_CALL_CHAIN(result, ra);
|
||||
return (GC_store_debug_info(result, (word)lb, s, i));
|
||||
return GC_store_debug_info((ptr_t)result, (word)lb, s, i);
|
||||
}
|
||||
|
||||
GC_API GC_ATTR_MALLOC char * GC_CALL GC_debug_strdup(const char *str,
|
||||
@@ -740,7 +740,7 @@ GC_API GC_ATTR_MALLOC char * GC_CALL GC_debug_strdup(const char *str,
|
||||
}
|
||||
|
||||
lb = strlen(str) + 1;
|
||||
copy = GC_debug_malloc_atomic(lb, OPT_RA s, i);
|
||||
copy = (char *)GC_debug_malloc_atomic(lb, OPT_RA s, i);
|
||||
if (copy == NULL) {
|
||||
# ifndef MSWINCE
|
||||
errno = ENOMEM;
|
||||
@@ -758,7 +758,7 @@ GC_API GC_ATTR_MALLOC char * GC_CALL GC_debug_strndup(const char *str,
|
||||
size_t len = strlen(str); /* str is expected to be non-NULL */
|
||||
if (len > size)
|
||||
len = size;
|
||||
copy = GC_debug_malloc_atomic(len + 1, OPT_RA s, i);
|
||||
copy = (char *)GC_debug_malloc_atomic(len + 1, OPT_RA s, i);
|
||||
if (copy == NULL) {
|
||||
# ifndef MSWINCE
|
||||
errno = ENOMEM;
|
||||
@@ -778,7 +778,7 @@ GC_API GC_ATTR_MALLOC char * GC_CALL GC_debug_strndup(const char *str,
|
||||
GC_EXTRA_PARAMS)
|
||||
{
|
||||
size_t lb = (wcslen(str) + 1) * sizeof(wchar_t);
|
||||
wchar_t *copy = GC_debug_malloc_atomic(lb, OPT_RA s, i);
|
||||
wchar_t *copy = (wchar_t *)GC_debug_malloc_atomic(lb, OPT_RA s, i);
|
||||
if (copy == NULL) {
|
||||
# ifndef MSWINCE
|
||||
errno = ENOMEM;
|
||||
@@ -805,7 +805,7 @@ GC_API GC_ATTR_MALLOC 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, i));
|
||||
return GC_store_debug_info((ptr_t)result, (word)lb, s, i);
|
||||
}
|
||||
|
||||
#ifdef GC_ATOMIC_UNCOLLECTABLE
|
||||
@@ -824,7 +824,7 @@ GC_API GC_ATTR_MALLOC 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, i));
|
||||
return GC_store_debug_info((ptr_t)result, (word)lb, s, i);
|
||||
}
|
||||
#endif /* GC_ATOMIC_UNCOLLECTABLE */
|
||||
|
||||
@@ -841,8 +841,8 @@ GC_API void GC_CALL GC_debug_free(void * p)
|
||||
ptr_t base;
|
||||
if (0 == p) return;
|
||||
|
||||
base = GC_base(p);
|
||||
if (base == 0) {
|
||||
base = (ptr_t)GC_base(p);
|
||||
if (NULL == base) {
|
||||
# if defined(REDIRECT_MALLOC) \
|
||||
&& ((defined(NEED_CALLINFO) && defined(GC_HAVE_BUILTIN_BACKTRACE)) \
|
||||
|| defined(GC_LINUX_THREADS) || defined(GC_SOLARIS_THREADS) \
|
||||
@@ -909,7 +909,7 @@ GC_API void GC_CALL GC_debug_free(void * p)
|
||||
/* Used internally; we assume it's called correctly. */
|
||||
GC_INNER void GC_debug_free_inner(void * p)
|
||||
{
|
||||
ptr_t base = GC_base(p);
|
||||
ptr_t base = (ptr_t)GC_base(p);
|
||||
GC_ASSERT((ptr_t)p - (ptr_t)base == sizeof(oh));
|
||||
# ifdef LINT2
|
||||
if (!base) ABORT("Invalid GC_debug_free_inner argument");
|
||||
@@ -1185,8 +1185,8 @@ GC_API void GC_CALL GC_debug_register_finalizer(void * obj,
|
||||
{
|
||||
GC_finalization_proc my_old_fn = OFN_UNSET;
|
||||
void * my_old_cd;
|
||||
ptr_t base = GC_base(obj);
|
||||
if (0 == base) {
|
||||
ptr_t base = (ptr_t)GC_base(obj);
|
||||
if (NULL == base) {
|
||||
/* We won't collect it, hence finalizer wouldn't be run. */
|
||||
if (ocd) *ocd = 0;
|
||||
if (ofn) *ofn = 0;
|
||||
@@ -1214,8 +1214,8 @@ GC_API void GC_CALL GC_debug_register_finalizer_no_order
|
||||
{
|
||||
GC_finalization_proc my_old_fn = OFN_UNSET;
|
||||
void * my_old_cd;
|
||||
ptr_t base = GC_base(obj);
|
||||
if (0 == base) {
|
||||
ptr_t base = (ptr_t)GC_base(obj);
|
||||
if (NULL == base) {
|
||||
/* We won't collect it, hence finalizer wouldn't be run. */
|
||||
if (ocd) *ocd = 0;
|
||||
if (ofn) *ofn = 0;
|
||||
@@ -1243,8 +1243,8 @@ GC_API void GC_CALL GC_debug_register_finalizer_unreachable
|
||||
{
|
||||
GC_finalization_proc my_old_fn = OFN_UNSET;
|
||||
void * my_old_cd;
|
||||
ptr_t base = GC_base(obj);
|
||||
if (0 == base) {
|
||||
ptr_t base = (ptr_t)GC_base(obj);
|
||||
if (NULL == base) {
|
||||
/* We won't collect it, hence finalizer wouldn't be run. */
|
||||
if (ocd) *ocd = 0;
|
||||
if (ofn) *ofn = 0;
|
||||
@@ -1272,8 +1272,8 @@ GC_API void GC_CALL GC_debug_register_finalizer_ignore_self
|
||||
{
|
||||
GC_finalization_proc my_old_fn = OFN_UNSET;
|
||||
void * my_old_cd;
|
||||
ptr_t base = GC_base(obj);
|
||||
if (0 == base) {
|
||||
ptr_t base = (ptr_t)GC_base(obj);
|
||||
if (NULL == base) {
|
||||
/* We won't collect it, hence finalizer wouldn't be run. */
|
||||
if (ocd) *ocd = 0;
|
||||
if (ofn) *ofn = 0;
|
||||
|
||||
+3
-2
@@ -995,7 +995,8 @@ GC_INNER void GC_register_dynamic_libraries(void)
|
||||
# ifdef MSWIN32
|
||||
if (GC_no_win32_dlls) return;
|
||||
# endif
|
||||
base = limit = p = GC_sysinfo.lpMinimumApplicationAddress;
|
||||
p = GC_sysinfo.lpMinimumApplicationAddress;
|
||||
base = limit = (char *)p;
|
||||
while ((word)p < (word)GC_sysinfo.lpMaximumApplicationAddress) {
|
||||
size_t result = VirtualQuery(p, &buf, sizeof(buf));
|
||||
|
||||
@@ -1033,7 +1034,7 @@ GC_INNER void GC_register_dynamic_libraries(void)
|
||||
# endif
|
||||
if ((char *)p != limit) {
|
||||
GC_cond_add_roots(base, limit);
|
||||
base = p;
|
||||
base = (char *)p;
|
||||
}
|
||||
limit = new_limit;
|
||||
}
|
||||
|
||||
+14
-13
@@ -120,7 +120,7 @@ STATIC void GC_grow_table(struct hash_chain_entry ***table,
|
||||
for (i = 0; i < old_size; i++) {
|
||||
p = (*table)[i];
|
||||
while (p != 0) {
|
||||
ptr_t real_key = GC_REVEAL_POINTER(p -> hidden_key);
|
||||
ptr_t real_key = (ptr_t)GC_REVEAL_POINTER(p->hidden_key);
|
||||
struct hash_chain_entry *next = p -> next;
|
||||
size_t new_hash = HASH3(real_key, new_size, log_new_size);
|
||||
|
||||
@@ -325,7 +325,7 @@ GC_API int GC_CALL GC_unregister_disappearing_link(void * * link)
|
||||
|
||||
static void push_and_mark_object(void *p)
|
||||
{
|
||||
GC_normal_finalize_mark_proc(p);
|
||||
GC_normal_finalize_mark_proc((ptr_t)p);
|
||||
while (!GC_mark_stack_empty()) {
|
||||
MARK_FROM_MARK_STACK();
|
||||
}
|
||||
@@ -392,7 +392,7 @@ GC_API int GC_CALL GC_unregister_disappearing_link(void * * link)
|
||||
GC_ASSERT(capacity_inc >= 0);
|
||||
if (NULL == GC_toggleref_arr) {
|
||||
GC_toggleref_array_capacity = 32; /* initial capacity */
|
||||
GC_toggleref_arr = GC_INTERNAL_MALLOC_IGNORE_OFF_PAGE(
|
||||
GC_toggleref_arr = (GCToggleRef *)GC_INTERNAL_MALLOC_IGNORE_OFF_PAGE(
|
||||
GC_toggleref_array_capacity * sizeof(GCToggleRef),
|
||||
NORMAL);
|
||||
if (NULL == GC_toggleref_arr)
|
||||
@@ -408,7 +408,7 @@ GC_API int GC_CALL GC_unregister_disappearing_link(void * * link)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
new_array = GC_INTERNAL_MALLOC_IGNORE_OFF_PAGE(
|
||||
new_array = (GCToggleRef *)GC_INTERNAL_MALLOC_IGNORE_OFF_PAGE(
|
||||
GC_toggleref_array_capacity * sizeof(GCToggleRef),
|
||||
NORMAL);
|
||||
if (NULL == new_array)
|
||||
@@ -817,8 +817,8 @@ GC_API void GC_CALL GC_register_finalizer_unreachable(void * obj,
|
||||
|
||||
for (curr_dl = dl_hashtbl -> head[i]; curr_dl != 0;
|
||||
curr_dl = dl_next(curr_dl)) {
|
||||
ptr_t real_ptr = GC_REVEAL_POINTER(curr_dl -> dl_hidden_obj);
|
||||
ptr_t real_link = GC_REVEAL_POINTER(curr_dl -> dl_hidden_link);
|
||||
ptr_t real_ptr = (ptr_t)GC_REVEAL_POINTER(curr_dl->dl_hidden_obj);
|
||||
ptr_t real_link = (ptr_t)GC_REVEAL_POINTER(curr_dl->dl_hidden_link);
|
||||
|
||||
GC_printf("Object: %p, link: %p\n",
|
||||
(void *)real_ptr, (void *)real_link);
|
||||
@@ -843,7 +843,7 @@ GC_API void GC_CALL GC_register_finalizer_unreachable(void * obj,
|
||||
for (i = 0; i < fo_size; i++) {
|
||||
for (curr_fo = GC_fnlz_roots.fo_head[i];
|
||||
curr_fo != NULL; curr_fo = fo_next(curr_fo)) {
|
||||
ptr_t real_ptr = GC_REVEAL_POINTER(curr_fo -> fo_hidden_base);
|
||||
ptr_t real_ptr = (ptr_t)GC_REVEAL_POINTER(curr_fo->fo_hidden_base);
|
||||
|
||||
GC_printf("Finalizable object: %p\n", (void *)real_ptr);
|
||||
}
|
||||
@@ -923,8 +923,8 @@ GC_INLINE void GC_make_disappearing_links_disappear(
|
||||
struct disappearing_link *curr, *next;
|
||||
|
||||
ITERATE_DL_HASHTBL_BEGIN(dl_hashtbl, curr, prev)
|
||||
ptr_t real_ptr = GC_REVEAL_POINTER(curr -> dl_hidden_obj);
|
||||
ptr_t real_link = GC_REVEAL_POINTER(curr -> dl_hidden_link);
|
||||
ptr_t real_ptr = (ptr_t)GC_REVEAL_POINTER(curr->dl_hidden_obj);
|
||||
ptr_t real_link = (ptr_t)GC_REVEAL_POINTER(curr->dl_hidden_link);
|
||||
|
||||
if (!GC_is_marked(real_ptr)) {
|
||||
*(word *)real_link = 0;
|
||||
@@ -940,7 +940,8 @@ GC_INLINE void GC_remove_dangling_disappearing_links(
|
||||
struct disappearing_link *curr, *next;
|
||||
|
||||
ITERATE_DL_HASHTBL_BEGIN(dl_hashtbl, curr, prev)
|
||||
ptr_t real_link = GC_base(GC_REVEAL_POINTER(curr -> dl_hidden_link));
|
||||
ptr_t real_link =
|
||||
(ptr_t)GC_base(GC_REVEAL_POINTER(curr->dl_hidden_link));
|
||||
|
||||
if (NULL != real_link && !GC_is_marked(real_link)) {
|
||||
GC_clear_mark_bit(curr);
|
||||
@@ -980,7 +981,7 @@ GC_INNER void GC_finalize(void)
|
||||
for (curr_fo = GC_fnlz_roots.fo_head[i];
|
||||
curr_fo != NULL; curr_fo = fo_next(curr_fo)) {
|
||||
GC_ASSERT(GC_size(curr_fo) >= sizeof(struct finalizable_object));
|
||||
real_ptr = GC_REVEAL_POINTER(curr_fo -> fo_hidden_base);
|
||||
real_ptr = (ptr_t)GC_REVEAL_POINTER(curr_fo->fo_hidden_base);
|
||||
if (!GC_is_marked(real_ptr)) {
|
||||
GC_MARKED_FOR_FINALIZATION(real_ptr);
|
||||
GC_MARK_FO(real_ptr, curr_fo -> fo_mark_proc);
|
||||
@@ -997,7 +998,7 @@ GC_INNER void GC_finalize(void)
|
||||
curr_fo = GC_fnlz_roots.fo_head[i];
|
||||
prev_fo = 0;
|
||||
while (curr_fo != 0) {
|
||||
real_ptr = GC_REVEAL_POINTER(curr_fo -> fo_hidden_base);
|
||||
real_ptr = (ptr_t)GC_REVEAL_POINTER(curr_fo->fo_hidden_base);
|
||||
if (!GC_is_marked(real_ptr)) {
|
||||
if (!GC_java_finalization) {
|
||||
GC_set_mark_bit(real_ptr);
|
||||
@@ -1123,7 +1124,7 @@ GC_INNER void GC_finalize(void)
|
||||
curr_fo = GC_fnlz_roots.fo_head[i];
|
||||
GC_fnlz_roots.fo_head[i] = NULL;
|
||||
while (curr_fo != NULL) {
|
||||
real_ptr = GC_REVEAL_POINTER(curr_fo -> fo_hidden_base);
|
||||
real_ptr = (ptr_t)GC_REVEAL_POINTER(curr_fo->fo_hidden_base);
|
||||
GC_MARK_FO(real_ptr, GC_normal_finalize_mark_proc);
|
||||
GC_set_mark_bit(real_ptr);
|
||||
|
||||
|
||||
+4
-2
@@ -42,7 +42,8 @@ STATIC int GC_CALLBACK GC_finalized_disclaim(void *obj)
|
||||
/* info, GC_reclaim_with_finalization must be extended to clear */
|
||||
/* fragments so that the assumption holds for the selected word. */
|
||||
const struct GC_finalizer_closure *fc
|
||||
= (void *)(fc_word & ~(word)FINALIZER_CLOSURE_FLAG);
|
||||
= (struct GC_finalizer_closure *)(fc_word
|
||||
& ~(word)FINALIZER_CLOSURE_FLAG);
|
||||
(*fc->proc)((word *)obj + 1, fc->cd);
|
||||
}
|
||||
return 0;
|
||||
@@ -87,7 +88,8 @@ GC_API GC_ATTR_MALLOC void * GC_CALL GC_finalized_malloc(size_t lb,
|
||||
word *op;
|
||||
|
||||
GC_ASSERT(GC_finalized_kind != 0);
|
||||
op = GC_malloc_kind(SIZET_SAT_ADD(lb, sizeof(word)), GC_finalized_kind);
|
||||
op = (word *)GC_malloc_kind(SIZET_SAT_ADD(lb, sizeof(word)),
|
||||
GC_finalized_kind);
|
||||
if (EXPECT(NULL == op, FALSE))
|
||||
return NULL;
|
||||
*op = (word)fclos | FINALIZER_CLOSURE_FLAG;
|
||||
|
||||
@@ -176,7 +176,7 @@ static void maybe_finalize(void)
|
||||
return((*oom_fn)(lb));
|
||||
}
|
||||
} else {
|
||||
GC_gcjobjfreelist[lg] = obj_link(op);
|
||||
GC_gcjobjfreelist[lg] = (ptr_t)obj_link(op);
|
||||
GC_bytes_allocd += GRANULES_TO_BYTES((word)lg);
|
||||
}
|
||||
*(void **)op = ptr_to_struct_containing_descr;
|
||||
@@ -224,7 +224,7 @@ GC_API GC_ATTR_MALLOC void * GC_CALL GC_debug_gcj_malloc(size_t lb,
|
||||
}
|
||||
UNLOCK();
|
||||
ADD_CALL_CHAIN(result, ra);
|
||||
return (GC_store_debug_info(result, (word)lb, s, i));
|
||||
return GC_store_debug_info((ptr_t)result, (word)lb, s, i);
|
||||
}
|
||||
|
||||
/* There is no THREAD_LOCAL_ALLOC for GC_gcj_malloc_ignore_off_page(). */
|
||||
@@ -249,7 +249,7 @@ GC_API GC_ATTR_MALLOC void * GC_CALL GC_gcj_malloc_ignore_off_page(size_t lb,
|
||||
return((*oom_fn)(lb));
|
||||
}
|
||||
} else {
|
||||
GC_gcjobjfreelist[lg] = obj_link(op);
|
||||
GC_gcjobjfreelist[lg] = (ptr_t)obj_link(op);
|
||||
GC_bytes_allocd += GRANULES_TO_BYTES((word)lg);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -248,7 +248,7 @@ GC_INNER mse * GC_signal_mark_stack_overflow(mse *msp);
|
||||
size_t gran_displ = BYTES_TO_GRANULES(displ); \
|
||||
size_t gran_offset = hhdr -> hb_map[gran_displ]; \
|
||||
size_t byte_offset = displ & (GRANULE_BYTES - 1); \
|
||||
ptr_t base = current; \
|
||||
ptr_t base = (ptr_t)(current); \
|
||||
/* The following always fails for large block references. */ \
|
||||
if (EXPECT((gran_offset | byte_offset) != 0, FALSE)) { \
|
||||
if ((hhdr -> hb_flags & LARGE_BLOCK) != 0) { \
|
||||
@@ -304,7 +304,7 @@ GC_INNER mse * GC_signal_mark_stack_overflow(mse *msp);
|
||||
size_t displ = HBLKDISPL(current); /* Displacement in block; in bytes. */\
|
||||
unsigned32 low_prod, high_prod; \
|
||||
unsigned32 inv_sz = hhdr -> hb_inv_sz; \
|
||||
ptr_t base = current; \
|
||||
ptr_t base = (ptr_t)(current); \
|
||||
LONG_MULT(high_prod, low_prod, (unsigned32)displ, inv_sz); \
|
||||
/* product is > and within sz_in_bytes of displ * sz_in_bytes * 2**32 */ \
|
||||
if (EXPECT(low_prod >> 16 != 0, FALSE)) { \
|
||||
|
||||
@@ -621,8 +621,9 @@ typedef char * ptr_t; /* A generic pointer to which we can add */
|
||||
/* Print warning message, e.g. almost out of memory. */
|
||||
/* The argument (if any) format specifier should be: */
|
||||
/* "%s", "%p" or "%"WARN_PRIdPTR. */
|
||||
#define WARN(msg, arg) (*GC_current_warn_proc)("GC Warning: " msg, \
|
||||
(word)(arg))
|
||||
#define WARN(msg, arg) \
|
||||
(*GC_current_warn_proc)((/* no const */ char *)("GC Warning: " msg), \
|
||||
(word)(arg))
|
||||
GC_EXTERN GC_warn_proc GC_current_warn_proc;
|
||||
|
||||
/* Print format type macro for decimal signed_word value passed WARN(). */
|
||||
@@ -1563,7 +1564,7 @@ GC_EXTERN size_t GC_page_size;
|
||||
#if defined(MSWIN32) || defined(MSWINCE) || defined(CYGWIN32)
|
||||
struct _SYSTEM_INFO;
|
||||
GC_EXTERN struct _SYSTEM_INFO GC_sysinfo;
|
||||
GC_INNER GC_bool GC_is_heap_base(ptr_t p);
|
||||
GC_INNER GC_bool GC_is_heap_base(void *p);
|
||||
#endif
|
||||
|
||||
GC_EXTERN word GC_black_list_spacing;
|
||||
@@ -1825,7 +1826,7 @@ void GC_register_data_segments(void);
|
||||
GC_INNER void GC_thr_init(void);
|
||||
GC_INNER void GC_init_parallel(void);
|
||||
#else
|
||||
GC_INNER GC_bool GC_is_static_root(ptr_t p);
|
||||
GC_INNER GC_bool GC_is_static_root(void *p);
|
||||
/* Is the address p in one of the registered static */
|
||||
/* root sections? */
|
||||
#endif
|
||||
|
||||
@@ -511,7 +511,7 @@ GC_API GC_ATTR_MALLOC void * GC_CALL GC_memalign(size_t align, size_t lb)
|
||||
/* We could also try to make sure that the real rounded-up object size */
|
||||
/* is a multiple of align. That would be correct up to HBLKSIZE. */
|
||||
new_lb = SIZET_SAT_ADD(lb, align - 1);
|
||||
result = GC_malloc(new_lb);
|
||||
result = (ptr_t)GC_malloc(new_lb);
|
||||
/* It is OK not to check result for NULL as in that case */
|
||||
/* GC_memalign returns NULL too since (0 + 0 % align) is 0. */
|
||||
offset = (word)result % align;
|
||||
@@ -523,7 +523,7 @@ GC_API GC_ATTR_MALLOC void * GC_CALL GC_memalign(size_t align, size_t lb)
|
||||
GC_register_displacement(offset);
|
||||
}
|
||||
}
|
||||
result = (void *) ((ptr_t)result + offset);
|
||||
result += offset;
|
||||
GC_ASSERT((word)result % align == 0);
|
||||
return result;
|
||||
}
|
||||
@@ -558,7 +558,8 @@ GC_API GC_ATTR_MALLOC char * GC_CALL GC_strdup(const char *s)
|
||||
size_t lb;
|
||||
if (s == NULL) return NULL;
|
||||
lb = strlen(s) + 1;
|
||||
if ((copy = GC_malloc_atomic(lb)) == NULL) {
|
||||
copy = (char *)GC_malloc_atomic(lb);
|
||||
if (NULL == copy) {
|
||||
# ifndef MSWINCE
|
||||
errno = ENOMEM;
|
||||
# endif
|
||||
@@ -574,7 +575,7 @@ GC_API GC_ATTR_MALLOC char * GC_CALL GC_strndup(const char *str, size_t size)
|
||||
size_t len = strlen(str); /* str is expected to be non-NULL */
|
||||
if (len > size)
|
||||
len = size;
|
||||
copy = GC_malloc_atomic(len + 1);
|
||||
copy = (char *)GC_malloc_atomic(len + 1);
|
||||
if (copy == NULL) {
|
||||
# ifndef MSWINCE
|
||||
errno = ENOMEM;
|
||||
@@ -593,7 +594,8 @@ GC_API GC_ATTR_MALLOC char * GC_CALL GC_strndup(const char *str, size_t size)
|
||||
GC_API GC_ATTR_MALLOC wchar_t * GC_CALL GC_wcsdup(const wchar_t *str)
|
||||
{
|
||||
size_t lb = (wcslen(str) + 1) * sizeof(wchar_t);
|
||||
wchar_t *copy = GC_malloc_atomic(lb);
|
||||
wchar_t *copy = (wchar_t *)GC_malloc_atomic(lb);
|
||||
|
||||
if (copy == NULL) {
|
||||
# ifndef MSWINCE
|
||||
errno = ENOMEM;
|
||||
|
||||
@@ -664,8 +664,8 @@ GC_INNER mse * GC_mark_from(mse *mark_stack_top, mse *mark_stack,
|
||||
word current; /* Candidate pointer. */
|
||||
ptr_t limit = 0; /* (Incl) limit of current candidate range. */
|
||||
word descr;
|
||||
ptr_t greatest_ha = GC_greatest_plausible_heap_addr;
|
||||
ptr_t least_ha = GC_least_plausible_heap_addr;
|
||||
ptr_t greatest_ha = (ptr_t)GC_greatest_plausible_heap_addr;
|
||||
ptr_t least_ha = (ptr_t)GC_least_plausible_heap_addr;
|
||||
DECLARE_HDR_CACHE;
|
||||
|
||||
# define SPLIT_RANGE_WORDS 128 /* Must be power of 2. */
|
||||
@@ -1477,7 +1477,7 @@ GC_API struct GC_ms_entry * GC_CALL GC_mark_and_push(void *obj,
|
||||
GET_HDR(obj, hhdr);
|
||||
if ((EXPECT(IS_FORWARDING_ADDR_OR_NIL(hhdr), FALSE)
|
||||
&& (!GC_all_interior_pointers
|
||||
|| NULL == (hhdr = GC_find_header(GC_base(obj)))))
|
||||
|| NULL == (hhdr = GC_find_header((ptr_t)GC_base(obj)))))
|
||||
|| EXPECT(HBLK_IS_FREE(hhdr), FALSE)) {
|
||||
GC_ADD_TO_BLACK_LIST_NORMAL(obj, (ptr_t)src);
|
||||
return mark_stack_ptr;
|
||||
@@ -1513,7 +1513,7 @@ GC_API struct GC_ms_entry * GC_CALL GC_mark_and_push(void *obj,
|
||||
GET_HDR(p, hhdr);
|
||||
if (EXPECT(IS_FORWARDING_ADDR_OR_NIL(hhdr), FALSE)
|
||||
&& (NULL == hhdr
|
||||
|| (r = GC_base(p)) == NULL
|
||||
|| (r = (ptr_t)GC_base(p)) == NULL
|
||||
|| (hhdr = HDR(r)) == NULL)) {
|
||||
GC_ADD_TO_BLACK_LIST_STACK(p, source);
|
||||
return;
|
||||
@@ -1606,8 +1606,8 @@ GC_API void GC_CALL GC_push_all_eager(void *bottom, void *top)
|
||||
word * t = (word *)(((word) top) & ~(ALIGNMENT-1));
|
||||
register word *p;
|
||||
register word *lim;
|
||||
register ptr_t greatest_ha = GC_greatest_plausible_heap_addr;
|
||||
register ptr_t least_ha = GC_least_plausible_heap_addr;
|
||||
register ptr_t greatest_ha = (ptr_t)GC_greatest_plausible_heap_addr;
|
||||
register ptr_t least_ha = (ptr_t)GC_least_plausible_heap_addr;
|
||||
# define GC_greatest_plausible_heap_addr greatest_ha
|
||||
# define GC_least_plausible_heap_addr least_ha
|
||||
|
||||
@@ -1651,8 +1651,8 @@ GC_INNER void GC_push_all_stack(ptr_t bottom, ptr_t top)
|
||||
word * t = (word *)(((word) top) & ~(ALIGNMENT-1));
|
||||
register word *p;
|
||||
register word *lim;
|
||||
register ptr_t greatest_ha = GC_greatest_plausible_heap_addr;
|
||||
register ptr_t least_ha = GC_least_plausible_heap_addr;
|
||||
register ptr_t greatest_ha = (ptr_t)GC_greatest_plausible_heap_addr;
|
||||
register ptr_t least_ha = (ptr_t)GC_least_plausible_heap_addr;
|
||||
# define GC_greatest_plausible_heap_addr greatest_ha
|
||||
# define GC_least_plausible_heap_addr least_ha
|
||||
|
||||
@@ -1716,8 +1716,8 @@ STATIC void GC_push_marked1(struct hblk *h, hdr *hhdr)
|
||||
/* Allow registers to be used for some frequently accessed */
|
||||
/* global variables. Otherwise aliasing issues are likely */
|
||||
/* to prevent that. */
|
||||
ptr_t greatest_ha = GC_greatest_plausible_heap_addr;
|
||||
ptr_t least_ha = GC_least_plausible_heap_addr;
|
||||
ptr_t greatest_ha = (ptr_t)GC_greatest_plausible_heap_addr;
|
||||
ptr_t least_ha = (ptr_t)GC_least_plausible_heap_addr;
|
||||
mse * mark_stack_top = GC_mark_stack_top;
|
||||
mse * mark_stack_limit = GC_mark_stack_limit;
|
||||
|
||||
@@ -1766,8 +1766,8 @@ STATIC void GC_push_marked2(struct hblk *h, hdr *hhdr)
|
||||
word *p;
|
||||
word *plim;
|
||||
|
||||
ptr_t greatest_ha = GC_greatest_plausible_heap_addr;
|
||||
ptr_t least_ha = GC_least_plausible_heap_addr;
|
||||
ptr_t greatest_ha = (ptr_t)GC_greatest_plausible_heap_addr;
|
||||
ptr_t least_ha = (ptr_t)GC_least_plausible_heap_addr;
|
||||
mse * mark_stack_top = GC_mark_stack_top;
|
||||
mse * mark_stack_limit = GC_mark_stack_limit;
|
||||
|
||||
@@ -1817,8 +1817,8 @@ STATIC void GC_push_marked4(struct hblk *h, hdr *hhdr)
|
||||
word *p;
|
||||
word *plim;
|
||||
|
||||
ptr_t greatest_ha = GC_greatest_plausible_heap_addr;
|
||||
ptr_t least_ha = GC_least_plausible_heap_addr;
|
||||
ptr_t greatest_ha = (ptr_t)GC_greatest_plausible_heap_addr;
|
||||
ptr_t least_ha = (ptr_t)GC_least_plausible_heap_addr;
|
||||
mse * mark_stack_top = GC_mark_stack_top;
|
||||
mse * mark_stack_limit = GC_mark_stack_limit;
|
||||
|
||||
|
||||
+2
-2
@@ -77,7 +77,7 @@ static int n_root_sets = 0;
|
||||
#ifndef THREADS
|
||||
/* Primarily for debugging support: */
|
||||
/* Is the address p in one of the registered static root sections? */
|
||||
GC_INNER GC_bool GC_is_static_root(ptr_t p)
|
||||
GC_INNER GC_bool GC_is_static_root(void *p)
|
||||
{
|
||||
static int last_root_set = MAX_ROOT_SETS;
|
||||
int i;
|
||||
@@ -454,7 +454,7 @@ GC_INNER void GC_exclude_static_roots_inner(void *start, void *finish)
|
||||
if (0 == GC_excl_table_entries) {
|
||||
next = 0;
|
||||
} else {
|
||||
next = GC_next_exclusion(start);
|
||||
next = GC_next_exclusion((ptr_t)start);
|
||||
}
|
||||
if (0 != next) {
|
||||
size_t i;
|
||||
|
||||
@@ -408,7 +408,7 @@ GC_API void * GC_CALL GC_base(void * p)
|
||||
bottom_index *bi;
|
||||
hdr *candidate_hdr;
|
||||
|
||||
r = p;
|
||||
r = (ptr_t)p;
|
||||
if (!EXPECT(GC_is_initialized, TRUE)) return 0;
|
||||
h = HBLKPTR(r);
|
||||
GET_BI(r, bi);
|
||||
@@ -1890,8 +1890,8 @@ GC_API GC_warn_proc GC_CALL GC_get_warn_proc(void)
|
||||
if (!GC_write_disabled)
|
||||
# endif
|
||||
{
|
||||
if (WRITE(GC_stderr, (void *)msg, strlen(msg)) >= 0)
|
||||
(void)WRITE(GC_stderr, (void *)("\n"), 1);
|
||||
if (WRITE(GC_stderr, msg, strlen(msg)) >= 0)
|
||||
(void)WRITE(GC_stderr, "\n", 1);
|
||||
}
|
||||
# else
|
||||
__android_log_assert("*" /* cond */, GC_ANDROID_LOG_TAG, "%s\n", msg);
|
||||
@@ -1965,12 +1965,12 @@ GC_API void ** GC_CALL GC_new_free_list_inner(void)
|
||||
result = GC_INTERNAL_MALLOC((MAXOBJGRANULES+1) * sizeof(ptr_t), PTRFREE);
|
||||
if (NULL == result) ABORT("Failed to allocate freelist for new kind");
|
||||
BZERO(result, (MAXOBJGRANULES+1)*sizeof(ptr_t));
|
||||
return result;
|
||||
return (void **)result;
|
||||
}
|
||||
|
||||
GC_API void ** GC_CALL GC_new_free_list(void)
|
||||
{
|
||||
void *result;
|
||||
void ** result;
|
||||
DCL_LOCK_STATE;
|
||||
LOCK();
|
||||
result = GC_new_free_list_inner();
|
||||
|
||||
+1
-1
@@ -187,5 +187,5 @@ GC_INNER void GC_new_hblk(size_t gran, int kind)
|
||||
/* Build the free list */
|
||||
GC_obj_kinds[kind].ok_freelist[gran] =
|
||||
GC_build_fl(h, GRANULES_TO_WORDS(gran), clear,
|
||||
GC_obj_kinds[kind].ok_freelist[gran]);
|
||||
(ptr_t)GC_obj_kinds[kind].ok_freelist[gran]);
|
||||
}
|
||||
|
||||
@@ -1788,7 +1788,7 @@ void GC_register_data_segments(void)
|
||||
|
||||
/* Is p the base of one of the malloc heap sections we already know */
|
||||
/* about? */
|
||||
STATIC GC_bool GC_is_malloc_heap_base(ptr_t p)
|
||||
STATIC GC_bool GC_is_malloc_heap_base(void *p)
|
||||
{
|
||||
struct GC_malloc_heap_list *q = GC_malloc_heap_l;
|
||||
|
||||
@@ -1849,7 +1849,7 @@ void GC_register_data_segments(void)
|
||||
|
||||
/* Is p the start of either the malloc heap, or of one of our */
|
||||
/* heap sections? */
|
||||
GC_INNER GC_bool GC_is_heap_base(ptr_t p)
|
||||
GC_INNER GC_bool GC_is_heap_base(void *p)
|
||||
{
|
||||
unsigned i;
|
||||
# ifndef REDIRECT_MALLOC
|
||||
@@ -1889,7 +1889,7 @@ void GC_register_data_segments(void)
|
||||
limit = new_limit;
|
||||
} else {
|
||||
if (base != limit) GC_add_roots_inner(base, limit, FALSE);
|
||||
base = p;
|
||||
base = (char *)p;
|
||||
limit = new_limit;
|
||||
}
|
||||
}
|
||||
|
||||
+8
-8
@@ -723,9 +723,9 @@ GC_API void GC_CALL GC_register_altstack(void *stack, GC_word stack_size,
|
||||
LOCK();
|
||||
me = GC_lookup_thread(self);
|
||||
if (me != NULL) {
|
||||
me->stack = stack;
|
||||
me->stack = (ptr_t)stack;
|
||||
me->stack_size = stack_size;
|
||||
me->altstack = altstack;
|
||||
me->altstack = (ptr_t)altstack;
|
||||
me->altstack_size = altstack_size;
|
||||
} else {
|
||||
/* This happens if we are called before GC_thr_init. */
|
||||
@@ -1230,9 +1230,9 @@ GC_INNER void GC_thr_init(void)
|
||||
# endif
|
||||
t -> flags = DETACHED | MAIN_THREAD;
|
||||
if (THREAD_EQUAL(self, main_pthread_id)) {
|
||||
t -> stack = main_stack;
|
||||
t -> stack = (ptr_t)main_stack;
|
||||
t -> stack_size = main_stack_size;
|
||||
t -> altstack = main_altstack;
|
||||
t -> altstack = (ptr_t)main_altstack;
|
||||
t -> altstack_size = main_altstack_size;
|
||||
}
|
||||
}
|
||||
@@ -1663,13 +1663,13 @@ GC_INLINE void GC_record_stack_base(GC_thread me,
|
||||
const struct GC_stack_base *sb)
|
||||
{
|
||||
# ifndef GC_DARWIN_THREADS
|
||||
me -> stop_info.stack_ptr = sb -> mem_base;
|
||||
me -> stop_info.stack_ptr = (ptr_t)sb->mem_base;
|
||||
# endif
|
||||
me -> stack_end = sb -> mem_base;
|
||||
me -> stack_end = (ptr_t)sb->mem_base;
|
||||
if (me -> stack_end == NULL)
|
||||
ABORT("Bad stack base in GC_register_my_thread");
|
||||
# ifdef IA64
|
||||
me -> backing_store_end = sb -> reg_base;
|
||||
me -> backing_store_end = (ptr_t)sb->reg_base;
|
||||
# endif
|
||||
}
|
||||
|
||||
@@ -1760,7 +1760,7 @@ GC_INNER_PTHRSTART GC_thread GC_start_rtn_prepare_thread(
|
||||
void **pstart_arg,
|
||||
struct GC_stack_base *sb, void *arg)
|
||||
{
|
||||
struct start_info * si = arg;
|
||||
struct start_info * si = (struct start_info *)arg;
|
||||
pthread_t self = pthread_self();
|
||||
GC_thread me;
|
||||
DCL_LOCK_STATE;
|
||||
|
||||
+2
-2
@@ -159,7 +159,7 @@ void (GC_CALLBACK *GC_is_visible_print_proc)(void * p) =
|
||||
|
||||
#ifndef THREADS
|
||||
/* Could p be a stack address? */
|
||||
STATIC GC_bool GC_on_stack(ptr_t p)
|
||||
STATIC GC_bool GC_on_stack(void *p)
|
||||
{
|
||||
# ifdef STACK_GROWS_DOWN
|
||||
if ((word)p >= (word)GC_approx_sp()
|
||||
@@ -215,7 +215,7 @@ GC_API void * GC_CALL GC_is_visible(void *p)
|
||||
} else {
|
||||
/* p points to the heap. */
|
||||
word descr;
|
||||
ptr_t base = GC_base(p); /* Should be manually inlined? */
|
||||
ptr_t base = (ptr_t)GC_base(p); /* Should be manually inlined? */
|
||||
|
||||
if (base == 0) goto fail;
|
||||
if (HBLKPTR(base) != HBLKPTR(p)) hhdr = HDR((word)p);
|
||||
|
||||
@@ -351,7 +351,7 @@ STATIC void GC_reclaim_small_nonempty_block(struct hblk *hbp,
|
||||
GC_reclaim_check(hbp, hhdr, sz);
|
||||
} else {
|
||||
*flh = GC_reclaim_generic(hbp, hhdr, sz, ok -> ok_init,
|
||||
*flh, &GC_bytes_found);
|
||||
(ptr_t)(*flh), &GC_bytes_found);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -366,7 +366,7 @@ STATIC void GC_reclaim_small_nonempty_block(struct hblk *hbp,
|
||||
|
||||
hhdr -> hb_last_reclaimed = (unsigned short) GC_gc_no;
|
||||
flh_next = GC_reclaim_generic(hbp, hhdr, sz, ok -> ok_init,
|
||||
*flh, &GC_bytes_found);
|
||||
(ptr_t)(*flh), &GC_bytes_found);
|
||||
if (hhdr -> hb_n_marks)
|
||||
*flh = flh_next;
|
||||
else {
|
||||
@@ -585,17 +585,16 @@ void GC_print_block_list(void)
|
||||
/* Currently for debugger use only: */
|
||||
GC_API void GC_CALL GC_print_free_list(int kind, size_t sz_in_granules)
|
||||
{
|
||||
ptr_t flh;
|
||||
void *flh_next;
|
||||
int n;
|
||||
|
||||
GC_ASSERT(kind < MAXOBJKINDS);
|
||||
GC_ASSERT(sz_in_granules <= MAXOBJGRANULES);
|
||||
flh = GC_obj_kinds[kind].ok_freelist[sz_in_granules];
|
||||
for (n = 0; flh; n++) {
|
||||
struct hblk *block = HBLKPTR(flh);
|
||||
flh_next = GC_obj_kinds[kind].ok_freelist[sz_in_granules];
|
||||
for (n = 0; flh_next; n++) {
|
||||
GC_printf("Free object in heap block %p [%d]: %p\n",
|
||||
(void *)block, n, (void *)flh);
|
||||
flh = obj_link(flh);
|
||||
(void *)HBLKPTR(flh_next), n, flh_next);
|
||||
flh_next = obj_link(flh_next);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -273,13 +273,13 @@ GC_INNER void GC_mark_thread_local_fls_for(GC_tlfs p)
|
||||
|
||||
for (j = 0; j < TINY_FREELISTS; ++j) {
|
||||
for (i = 0; i < THREAD_FREELISTS_KINDS; ++i) {
|
||||
q = p -> _freelists[i][j];
|
||||
q = (ptr_t)p->_freelists[i][j];
|
||||
if ((word)q > HBLKSIZE)
|
||||
GC_set_fl_marks(q);
|
||||
}
|
||||
# ifdef GC_GCJ_SUPPORT
|
||||
if (EXPECT(j > 0, TRUE)) {
|
||||
q = p -> gcj_freelists[j];
|
||||
q = (ptr_t)p->gcj_freelists[j];
|
||||
if ((word)q > HBLKSIZE)
|
||||
GC_set_fl_marks(q);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user