Move avoid_collection to NewGC struct

svn: r12267
This commit is contained in:
Kevin Tew 2008-11-05 21:06:07 +00:00
parent c2e28f8d70
commit dee6deb1be
2 changed files with 12 additions and 6 deletions

View File

@ -396,7 +396,7 @@ static void *allocate_big(size_t sizeb, int type)
sizeb = gcWORDS_TO_BYTES(sizew); sizeb = gcWORDS_TO_BYTES(sizew);
if((GC->gen0.current_size + sizeb) >= GC->gen0.max_size) { if((GC->gen0.current_size + sizeb) >= GC->gen0.max_size) {
if (!avoid_collection) if (!GC->dumping_avoid_collection)
garbage_collect(0); garbage_collect(0);
} }
GC->gen0.current_size += sizeb; GC->gen0.current_size += sizeb;
@ -500,7 +500,7 @@ inline static void *allocate(size_t sizeb, int type)
} }
/* WARNING: tries to avoid a collection but /* WARNING: tries to avoid a collection but
* malloc_pages can cause a collection due to check_used_against_max */ * malloc_pages can cause a collection due to check_used_against_max */
else if (avoid_collection) { else if (GC->dumping_avoid_collection) {
struct mpage *new_mpage= gen0_create_new_mpage(); struct mpage *new_mpage= gen0_create_new_mpage();
/* push page */ /* push page */
@ -1010,7 +1010,8 @@ static int is_finalizable_page(void *p)
#include "fnls.c" #include "fnls.c"
static Fnl *run_queue, *last_in_queue; static Fnl *run_queue;
static Fnl *last_in_queue;
inline static void mark_finalizer_structs(void) inline static void mark_finalizer_structs(void)
{ {
@ -1193,7 +1194,9 @@ struct gc_thread_info {
struct gc_thread_info *next; struct gc_thread_info *next;
}; };
static Mark_Proc normal_thread_mark = NULL, normal_custodian_mark = NULL, normal_cust_box_mark = NULL; static Mark_Proc normal_thread_mark = NULL;
static Mark_Proc normal_custodian_mark = NULL;
static Mark_Proc normal_cust_box_mark = NULL;
static struct gc_thread_info *threads = NULL; static struct gc_thread_info *threads = NULL;
@ -1828,7 +1831,7 @@ void GC_dump_with_traces(int flags,
reset_object_traces(); reset_object_traces();
if (for_each_found) if (for_each_found)
avoid_collection++; GC->dumping_avoid_collection++;
/* Traverse tagged pages to count objects: */ /* Traverse tagged pages to count objects: */
for (i = 0; i < MAX_DUMP_TAG; i++) { for (i = 0; i < MAX_DUMP_TAG; i++) {
@ -1918,7 +1921,7 @@ void GC_dump_with_traces(int flags,
} }
if (for_each_found) if (for_each_found)
--avoid_collection; --GC->dumping_avoid_collection;
} }
void GC_dump(void) void GC_dump(void)

View File

@ -87,11 +87,14 @@ typedef struct NewGC {
mpage *release_pages; mpage *release_pages;
int dumping_avoid_collection; /* dumping coutner flag */
int generations_available; int generations_available;
unsigned char full_needed_for_finalization :1; unsigned char full_needed_for_finalization :1;
unsigned char no_further_modifications :1; unsigned char no_further_modifications :1;
unsigned char gc_full :1; /* a flag saying if this is a full/major collection */ unsigned char gc_full :1; /* a flag saying if this is a full/major collection */
/* These collect information about memory usage, for use in GC_dump. */ /* These collect information about memory usage, for use in GC_dump. */
unsigned long peak_memory_use; unsigned long peak_memory_use;
unsigned long num_minor_collects; unsigned long num_minor_collects;