]> granicus.if.org Git - gc/commitdiff
Move finalize.c global variables outside to alloc.c and misc.c
authorIvan Maidanski <ivmai@mail.ru>
Fri, 3 Feb 2012 18:11:28 +0000 (22:11 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Fri, 3 Feb 2012 18:11:28 +0000 (22:11 +0400)
(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.

alloc.c
finalize.c
misc.c

diff --git a/alloc.c b/alloc.c
index 8e83262ad043ccb6962668dbbda52e9e6b3d47ba..a8231281e5d29be4a9dc4511cb02baaa8d189659 100644 (file)
--- 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.                       */
index 949777733612d6ed6bac41f2e04eaab19aa18c87..a4c7ef5a0e69400b0d2e457e6cb3626f43c26f80 100644 (file)
 
 #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 5dadaab272d6fd296998ded917707a521046565e..3d6a579bfad45dd9da6944f8e6445959d9e09626 100644 (file)
--- 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. */