return (GC_store_debug_info(result, (word)lb, s, i));
}
- GC_API void GC_CALL GC_debug_change_stubborn(void *p)
+ GC_API void GC_CALL GC_debug_change_stubborn(const void *p)
{
- void * q = GC_base(p);
+ const void * q = GC_base((void *)p);
hdr * hhdr;
if (q == 0) {
GC_change_stubborn(q);
}
- GC_API void GC_CALL GC_debug_end_stubborn_change(void *p)
+ GC_API void GC_CALL GC_debug_end_stubborn_change(const void *p)
{
- void * q = GC_base(p);
+ const void * q = GC_base((void *)p);
hdr * hhdr;
if (q == 0) {
return GC_debug_malloc(lb, OPT_RA s, i);
}
- GC_API void GC_CALL GC_debug_change_stubborn(void * p GC_ATTR_UNUSED) {}
+ GC_API void GC_CALL GC_debug_change_stubborn(
+ const void * p GC_ATTR_UNUSED) {}
- GC_API void GC_CALL GC_debug_end_stubborn_change(void * p GC_ATTR_UNUSED) {}
+ GC_API void GC_CALL GC_debug_end_stubborn_change(
+ const void * p GC_ATTR_UNUSED) {}
#endif /* !STUBBORN_ALLOC */
GC_API void * GC_CALL GC_debug_malloc_atomic(size_t lb, GC_EXTRA_PARAMS)
}
GC_API int GC_CALL GC_general_register_disappearing_link(void * * link,
- void * obj)
+ const void * obj)
{
struct disappearing_link *curr_dl;
size_t index;
if (((word)link & (ALIGNMENT-1)) || link == NULL)
ABORT("Bad arg to GC_general_register_disappearing_link");
LOCK();
- GC_ASSERT(obj != NULL && GC_base(obj) == obj);
+ GC_ASSERT(obj != NULL && GC_base((void *)obj) == obj);
if (log_dl_table_size == -1
|| GC_dl_entries > ((word)1 << log_dl_table_size)) {
GC_grow_table((struct hash_chain_entry ***)(&dl_head),
} else {
dl_set_next(prev_dl, next_dl);
}
- GC_clear_mark_bit((ptr_t)curr_dl);
+ GC_clear_mark_bit(curr_dl);
GC_dl_entries--;
curr_dl = next_dl;
} else {
} else {
dl_set_next(prev_dl, next_dl);
}
- GC_clear_mark_bit((ptr_t)curr_dl);
+ GC_clear_mark_bit(curr_dl);
GC_dl_entries--;
curr_dl = next_dl;
} else {
#ifdef THREAD_LOCAL_ALLOC
STATIC void * GC_core_finalized_malloc(size_t lb,
- struct GC_finalizer_closure *fclos)
+ const struct GC_finalizer_closure *fclos)
#else
GC_API void * GC_CALL GC_finalized_malloc(size_t lb,
- struct GC_finalizer_closure *fclos)
+ const struct GC_finalizer_closure *fclos)
#endif
{
ptr_t op;
#ifdef THREAD_LOCAL_ALLOC
GC_API void * GC_CALL GC_finalized_malloc(size_t client_lb,
- struct GC_finalizer_closure *fclos)
+ const struct GC_finalizer_closure *fclos)
{
size_t lb = client_lb + sizeof(void *);
size_t lg = ROUNDED_UP_GRANULES(lb);
/* allowing more than one stubborn object to be changed at once, but it */
/* is acceptable to do so. The same applies to dropping stubborn */
/* objects that are still changeable. */
-GC_API void GC_CALL GC_change_stubborn(void *);
-GC_API void GC_CALL GC_end_stubborn_change(void *);
+GC_API void GC_CALL GC_change_stubborn(const void *);
+GC_API void GC_CALL GC_end_stubborn_change(const void *);
/* Return a pointer to the base (lowest address) of an object given */
/* a pointer to a location within the object. */
GC_API void * GC_CALL GC_debug_realloc(void * /* old_object */,
size_t /* new_size_in_bytes */, GC_EXTRA_PARAMS)
/* 'realloc' attr */ GC_ATTR_ALLOC_SIZE(2);
-GC_API void GC_CALL GC_debug_change_stubborn(void *);
-GC_API void GC_CALL GC_debug_end_stubborn_change(void *);
+GC_API void GC_CALL GC_debug_change_stubborn(const void *);
+GC_API void GC_CALL GC_debug_end_stubborn_change(const void *);
/* Routines that allocate objects with debug information (like the */
/* above), but just fill in dummy file and line number information. */
# define GC_CHANGE_STUBBORN(p) GC_debug_change_stubborn(p)
# define GC_END_STUBBORN_CHANGE(p) GC_debug_end_stubborn_change(p)
# define GC_GENERAL_REGISTER_DISAPPEARING_LINK(link, obj) \
- GC_general_register_disappearing_link(link, GC_base(obj))
+ GC_general_register_disappearing_link(link, \
+ GC_base((/* no const */ void *)(obj)))
# define GC_REGISTER_DISPLACEMENT(n) GC_debug_register_displacement(n)
#else
# define GC_MALLOC_ATOMIC(sz) GC_malloc_atomic(sz)
/* Only exists for backward compatibility. See below: */
GC_API int GC_CALL GC_general_register_disappearing_link(void ** /* link */,
- void * /* obj */);
+ const void * /* obj */);
/* A slight generalization of the above. *link is */
/* cleared when obj first becomes inaccessible. This */
/* can be used to implement weak pointers easily and */
/* efficient than GC_register_finalizer and friends. */
/* GC_init_finalized_malloc must be called before using this. */
GC_API void *GC_CALL GC_finalized_malloc(size_t /*size*/,
- struct GC_finalizer_closure * /*fc*/);
+ const struct GC_finalizer_closure * /*fc*/);
#endif
/* Slow/general mark bit manipulation. The caller must hold the */
/* allocation lock. GC_is_marked returns 1 (TRUE) or 0. */
GC_API int GC_CALL GC_is_marked(const void *);
-GC_API void GC_CALL GC_clear_mark_bit(void *);
-GC_API void GC_CALL GC_set_mark_bit(void *);
+GC_API void GC_CALL GC_clear_mark_bit(const void *);
+GC_API void GC_CALL GC_set_mark_bit(const void *);
#ifdef __cplusplus
} /* end of extern "C" */
}
/* Slow but general routines for setting/clearing/asking about mark bits */
-GC_API void GC_CALL GC_set_mark_bit(void *p)
+GC_API void GC_CALL GC_set_mark_bit(const void *p)
{
struct hblk *h = HBLKPTR(p);
hdr * hhdr = HDR(h);
}
}
-GC_API void GC_CALL GC_clear_mark_bit(void *p)
+GC_API void GC_CALL GC_clear_mark_bit(const void *p)
{
struct hblk *h = HBLKPTR(p);
hdr * hhdr = HDR(h);
return(GC_malloc(lb));
}
- GC_API void GC_CALL GC_end_stubborn_change(void *p)
+ GC_API void GC_CALL GC_end_stubborn_change(const void *p)
{
- GC_dirty(p);
+ GC_dirty((ptr_t)p);
}
- GC_API void GC_CALL GC_change_stubborn(void *p GC_ATTR_UNUSED)
+ GC_API void GC_CALL GC_change_stubborn(const void *p GC_ATTR_UNUSED)
{
}
return(GC_malloc(lb));
}
- GC_API void GC_CALL GC_end_stubborn_change(void *p GC_ATTR_UNUSED)
+ GC_API void GC_CALL GC_end_stubborn_change(const void *p GC_ATTR_UNUSED)
{
}
- GC_API void GC_CALL GC_change_stubborn(void *p GC_ATTR_UNUSED)
+ GC_API void GC_CALL GC_change_stubborn(const void *p GC_ATTR_UNUSED)
{
}
} else {
extra_count = my_extra;
}
- GC_END_STUBBORN_CHANGE((char *)r);
+ GC_END_STUBBORN_CHANGE(r);
return(r);
}
# endif
/* ditto: */
void check_marks_int_list(sexpr x)
{
- if (!GC_is_marked((ptr_t)x))
+ if (!GC_is_marked(x))
GC_printf("[unm:%p]", (void *)x);
else
GC_printf("[mkd:%p]", (void *)x);
if (is_nil(x)) {
GC_printf("NIL\n");
} else {
- if (!GC_is_marked((ptr_t)car(x)))
+ if (!GC_is_marked(car(x)))
GC_printf("[unm car:%p]", (void *)car(x));
GC_printf("(%d)", SEXPR_TO_INT(car(car(x))));
if (!is_nil(cdr(x))) {
}
live_indicators[my_index] = 13;
if (GC_GENERAL_REGISTER_DISAPPEARING_LINK(
- (void * *)(&(live_indicators[my_index])),
- (void *)result) != 0) {
+ (void * *)(&(live_indicators[my_index])), result) != 0) {
GC_printf("GC_general_register_disappearing_link failed\n");
FAIL;
}
FAIL;
}
if (GC_GENERAL_REGISTER_DISAPPEARING_LINK(
- (void * *)(&(live_indicators[my_index])),
- (void *)result) != 0) {
+ (void * *)(&(live_indicators[my_index])), result) != 0) {
GC_printf("GC_general_register_disappearing_link failed 2\n");
FAIL;
}