From 7bb2e52568b281ac4bf1026654f84eecc89216d0 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Sun, 29 Jan 2012 14:41:46 +0400 Subject: [PATCH] Move some GC_arrays non-pointer fields to module where they are used * 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 | 6 ++++++ include/private/gc_priv.h | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/alloc.c b/alloc.c index 2d6d6bf6..dc4ddeb3 100644 --- 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; diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h index d9f8651e..3584e40f 100644 --- a/include/private/gc_priv.h +++ b/include/private/gc_priv.h @@ -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 -- 2.40.0