From: Ivan Maidanski Date: Fri, 3 Feb 2012 18:11:28 +0000 (+0400) Subject: Move finalize.c global variables outside to alloc.c and misc.c X-Git-Tag: gc7_3alpha2~135 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=379100c269d28475499457deb3af1d137058820b;p=gc Move finalize.c global variables outside to alloc.c and misc.c (to minimize number of linked global symbols of 'finalize' module in case finalization not unused) * alloc.c (GC_fo_entries): Move global variable definition from finalize.c. * finalize.c (GC_fo_entries): Likewise. * finalize.c (GC_finalize_on_demand, GC_java_finalization, GC_finalizer_notifier): Move global variable definition to misc.c. * misc.c (GC_finalize_on_demand, GC_java_finalization, GC_finalizer_notifier): Likewise. --- diff --git a/alloc.c b/alloc.c index 8e83262a..a8231281 100644 --- a/alloc.c +++ b/alloc.c @@ -1201,6 +1201,8 @@ GC_API int GC_CALL GC_expand_hp(size_t bytes) return(result); } +word GC_fo_entries = 0; /* used also in extra/MacOS.c */ + GC_INNER unsigned GC_fail_count = 0; /* How many consecutive GC/expansion failures? */ /* Reset by GC_allochblk. */ diff --git a/finalize.c b/finalize.c index 94977773..a4c7ef5a 100644 --- a/finalize.c +++ b/finalize.c @@ -16,18 +16,6 @@ #include "private/gc_pmark.h" -#ifdef FINALIZE_ON_DEMAND - int GC_finalize_on_demand = 1; -#else - int GC_finalize_on_demand = 0; -#endif - -#ifdef JAVA_FINALIZATION - int GC_java_finalization = 1; -#else - int GC_java_finalization = 0; -#endif - /* Type of mark procedure used for marking from finalizable object. */ /* This procedure normally does not mark the object, only its */ /* descendents. */ @@ -81,8 +69,6 @@ STATIC struct finalizable_object * GC_finalize_now = 0; static signed_word log_fo_table_size = -1; -word GC_fo_entries = 0; /* used also in extra/MacOS.c */ - GC_INNER void GC_push_finalizer_structures(void) { GC_push_all((ptr_t)(&dl_head), (ptr_t)(&dl_head) + sizeof(word)); @@ -889,10 +875,6 @@ GC_API int GC_CALL GC_invoke_finalizers(void) return count; } -/* All accesses to it should be synchronized to avoid data races. */ -GC_finalizer_notifier_proc GC_finalizer_notifier = - (GC_finalizer_notifier_proc)0; - static GC_word last_finalizer_notification = 0; GC_INNER void GC_notify_or_invoke_finalizers(void) diff --git a/misc.c b/misc.c index 5dadaab2..3d6a579b 100644 --- a/misc.c +++ b/misc.c @@ -129,6 +129,22 @@ GC_bool GC_quiet = 0; /* used also in pcr_interface.c */ int GC_all_interior_pointers = 0; #endif +#ifdef FINALIZE_ON_DEMAND + int GC_finalize_on_demand = 1; +#else + int GC_finalize_on_demand = 0; +#endif + +#ifdef JAVA_FINALIZATION + int GC_java_finalization = 1; +#else + int GC_java_finalization = 0; +#endif + +/* All accesses to it should be synchronized to avoid data races. */ +GC_finalizer_notifier_proc GC_finalizer_notifier = + (GC_finalizer_notifier_proc)0; + #ifdef GC_FORCE_UNMAP_ON_GCOLLECT /* Has no effect unless USE_MUNMAP. */ /* Has no effect on implicitly-initiated garbage collections. */