Move some GC_arrays non-pointer fields to module where they are used
authorIvan Maidanski <ivmai@mail.ru>
Sun, 29 Jan 2012 10:41:46 +0000 (14:41 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Sun, 29 Jan 2012 10:41:46 +0000 (14:41 +0400)
* include/private/gc_priv.h (_GC_arrays): Move _max_heapsize and
_non_gc_bytes_at_gc fields to alloc.c.
* include/private/gc_priv.h (GC_max_heapsize, GC_non_gc_bytes_at_gc):
Remove.
* alloc.c (GC_non_gc_bytes_at_gc, GC_max_heapsize): Define global
variables as STATIC.

alloc.c
include/private/gc_priv.h

diff --git a/alloc.c b/alloc.c
index 2d6d6bf..dc4ddeb 100644 (file)
--- a/alloc.c
+++ b/alloc.c
@@ -235,6 +235,10 @@ static word min_bytes_allocd(void)
     }
 }
 
+STATIC word GC_non_gc_bytes_at_gc = 0;
+                /* Number of explicitly managed bytes of storage        */
+                /* at last collection.                                  */
+
 /* Return the number of bytes allocated, adjusted for explicit storage  */
 /* management, etc..  This number is used in deciding when to trigger   */
 /* collections.                                                         */
@@ -1097,6 +1101,8 @@ GC_INLINE word GC_min(word x, word y)
     return(x < y? x : y);
 }
 
+STATIC word GC_max_heapsize = 0;
+
 GC_API void GC_CALL GC_set_max_heap_size(GC_word n)
 {
     GC_max_heapsize = n;
index d9f8651..3584e40 100644 (file)
@@ -1023,7 +1023,6 @@ struct roots {
 
 struct _GC_arrays {
   word _heapsize;               /* Heap size in bytes.                  */
-  word _max_heapsize;
   word _requested_heapsize;     /* Heap size due to explicit expansion. */
   ptr_t _last_heap_addr;
   ptr_t _prev_heap_addr;
@@ -1056,9 +1055,6 @@ struct _GC_arrays {
         /* Approximate number of bytes in objects (and headers) */
         /* that became ready for finalization in the last       */
         /* collection.                                          */
-  word _non_gc_bytes_at_gc;
-        /* Number of explicitly managed bytes of storage        */
-        /* at last collection.                                  */
   word _bytes_freed;
         /* Number of explicitly deallocated bytes of memory     */
         /* since last collection.                               */
@@ -1220,10 +1216,8 @@ GC_API_PRIV GC_FAR struct _GC_arrays GC_arrays;
 #define GC_large_free_bytes GC_arrays._large_free_bytes
 #define GC_last_heap_addr GC_arrays._last_heap_addr
 #define GC_mark_procs GC_arrays._mark_procs
-#define GC_max_heapsize GC_arrays._max_heapsize
 #define GC_max_large_allocd_bytes GC_arrays._max_large_allocd_bytes
 #define GC_modws_valid_offsets GC_arrays._modws_valid_offsets
-#define GC_non_gc_bytes_at_gc GC_arrays._non_gc_bytes_at_gc
 #define GC_prev_heap_addr GC_arrays._prev_heap_addr
 #define GC_requested_heapsize GC_arrays._requested_heapsize
 #define GC_scratch_end_ptr GC_arrays._scratch_end_ptr