From: Ivan Maidanski Date: Wed, 25 Jan 2012 15:12:36 +0000 (+0400) Subject: Move GC_register_disclaim_proc to fnlz_mlc X-Git-Tag: gc7_3alpha2~184 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bb47cb244f2aeeccca704f3861efe227123b2e0c;p=gc Move GC_register_disclaim_proc to fnlz_mlc * misc.c (GC_register_disclaim_proc): Move definition to fnlz_mlc.c (to minimize linked code size in case "disclaim" finalization is unused). * misc.c: Do not include gc_disclaim.h. * fnlz_mlc.c (GC_register_disclaim_proc): Add GC_ASSERT for kind passed by the client. --- diff --git a/fnlz_mlc.c b/fnlz_mlc.c index 8626b0f3..b43569a0 100644 --- a/fnlz_mlc.c +++ b/fnlz_mlc.c @@ -71,6 +71,16 @@ GC_API void GC_CALL GC_init_finalized_malloc(void) UNLOCK(); } +GC_API void GC_CALL GC_register_disclaim_proc(int kind, GC_disclaim_proc proc, + void *cd, + int mark_unconditionally) +{ + GC_ASSERT((unsigned)kind < MAXOBJKINDS); + GC_obj_kinds[kind].ok_disclaim_proc = proc; + GC_obj_kinds[kind].ok_disclaim_cd = cd; + GC_obj_kinds[kind].ok_mark_unconditionally = (GC_bool)mark_unconditionally; +} + #ifdef THREAD_LOCAL_ALLOC STATIC void * GC_core_finalized_malloc(size_t lb, const struct GC_finalizer_closure *fclos) diff --git a/misc.c b/misc.c index 3cc29b6b..19ddb8be 100644 --- a/misc.c +++ b/misc.c @@ -15,10 +15,6 @@ #include "private/gc_pmark.h" -#ifdef ENABLE_DISCLAIM -# include "gc_disclaim.h" -#endif - #include #include #include @@ -1479,7 +1475,7 @@ GC_API void ** GC_CALL GC_new_free_list(void) } GC_API unsigned GC_CALL GC_new_kind_inner(void **fl, GC_word descr, - int adjust, int clear) + int adjust, int clear) { unsigned result = GC_n_kinds++; @@ -1527,18 +1523,6 @@ GC_API unsigned GC_CALL GC_new_proc(GC_mark_proc proc) return result; } -#ifdef ENABLE_DISCLAIM - GC_API void GC_CALL GC_register_disclaim_proc(int kind, - GC_disclaim_proc proc, - void *cd, - int mark_unconditionally) - { - GC_obj_kinds[kind].ok_disclaim_proc = proc; - GC_obj_kinds[kind].ok_disclaim_cd = cd; - GC_obj_kinds[kind].ok_mark_unconditionally = (GC_bool)mark_unconditionally; - } -#endif /* ENABLE_DISCLAIM */ - GC_API void * GC_CALL GC_call_with_stack_base(GC_stack_base_func fn, void *arg) { int dummy;