Moved run_queue and last_in_queue to NewGC struct
svn: r12272
This commit is contained in:
parent
13f3eefa6c
commit
3577b42a1a
|
@ -11,20 +11,6 @@
|
||||||
park
|
park
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct finalizer {
|
|
||||||
char eager_level;
|
|
||||||
char tagged;
|
|
||||||
void *p;
|
|
||||||
GC_finalization_proc f;
|
|
||||||
void *data;
|
|
||||||
#if CHECKS
|
|
||||||
long size;
|
|
||||||
#endif
|
|
||||||
struct finalizer *next;
|
|
||||||
/* Patched after GC: */
|
|
||||||
struct finalizer *prev, *left, *right;
|
|
||||||
} Fnl;
|
|
||||||
|
|
||||||
static Fnl *finalizers, *splayed_finalizers;
|
static Fnl *finalizers, *splayed_finalizers;
|
||||||
static int num_fnls;
|
static int num_fnls;
|
||||||
|
|
||||||
|
|
|
@ -952,12 +952,9 @@ static int is_finalizable_page(void *p)
|
||||||
|
|
||||||
#include "fnls.c"
|
#include "fnls.c"
|
||||||
|
|
||||||
static Fnl *run_queue;
|
|
||||||
static Fnl *last_in_queue;
|
|
||||||
|
|
||||||
inline static void mark_finalizer_structs(void)
|
inline static void mark_finalizer_structs(void)
|
||||||
{
|
{
|
||||||
struct finalizer *fnl;
|
Fnl *fnl;
|
||||||
|
|
||||||
for(fnl = GC_resolve(finalizers); fnl; fnl = GC_resolve(fnl->next)) {
|
for(fnl = GC_resolve(finalizers); fnl; fnl = GC_resolve(fnl->next)) {
|
||||||
set_backtrace_source(fnl, BT_FINALIZER);
|
set_backtrace_source(fnl, BT_FINALIZER);
|
||||||
|
@ -965,28 +962,28 @@ inline static void mark_finalizer_structs(void)
|
||||||
set_backtrace_source(&finalizers, BT_ROOT);
|
set_backtrace_source(&finalizers, BT_ROOT);
|
||||||
gcMARK(fnl);
|
gcMARK(fnl);
|
||||||
}
|
}
|
||||||
for(fnl = run_queue; fnl; fnl = fnl->next) {
|
for(fnl = GC->run_queue; fnl; fnl = fnl->next) {
|
||||||
set_backtrace_source(fnl, BT_FINALIZER);
|
set_backtrace_source(fnl, BT_FINALIZER);
|
||||||
gcMARK(fnl->data);
|
gcMARK(fnl->data);
|
||||||
gcMARK(fnl->p);
|
gcMARK(fnl->p);
|
||||||
set_backtrace_source(&run_queue, BT_ROOT);
|
set_backtrace_source(&GC->run_queue, BT_ROOT);
|
||||||
gcMARK(fnl);
|
gcMARK(fnl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static void repair_finalizer_structs(void)
|
inline static void repair_finalizer_structs(void)
|
||||||
{
|
{
|
||||||
struct finalizer *fnl;
|
Fnl *fnl;
|
||||||
|
|
||||||
/* repair the base parts of the list */
|
/* repair the base parts of the list */
|
||||||
gcFIXUP(finalizers); gcFIXUP(run_queue);
|
gcFIXUP(finalizers); gcFIXUP(GC->run_queue);
|
||||||
/* then repair the stuff inside them */
|
/* then repair the stuff inside them */
|
||||||
for(fnl = finalizers; fnl; fnl = fnl->next) {
|
for(fnl = finalizers; fnl; fnl = fnl->next) {
|
||||||
gcFIXUP(fnl->data);
|
gcFIXUP(fnl->data);
|
||||||
gcFIXUP(fnl->p);
|
gcFIXUP(fnl->p);
|
||||||
gcFIXUP(fnl->next);
|
gcFIXUP(fnl->next);
|
||||||
}
|
}
|
||||||
for(fnl = run_queue; fnl; fnl = fnl->next) {
|
for(fnl = GC->run_queue; fnl; fnl = fnl->next) {
|
||||||
gcFIXUP(fnl->data);
|
gcFIXUP(fnl->data);
|
||||||
gcFIXUP(fnl->p);
|
gcFIXUP(fnl->p);
|
||||||
gcFIXUP(fnl->next);
|
gcFIXUP(fnl->next);
|
||||||
|
@ -995,7 +992,8 @@ inline static void repair_finalizer_structs(void)
|
||||||
|
|
||||||
inline static void check_finalizers(int level)
|
inline static void check_finalizers(int level)
|
||||||
{
|
{
|
||||||
struct finalizer *work = GC_resolve(finalizers), *prev = NULL;
|
Fnl *work = GC_resolve(finalizers);
|
||||||
|
Fnl *prev = NULL;
|
||||||
|
|
||||||
GCDEBUG((DEBUGOUTF, "CFNL: Checking level %i finalizers\n", level));
|
GCDEBUG((DEBUGOUTF, "CFNL: Checking level %i finalizers\n", level));
|
||||||
while(work) {
|
while(work) {
|
||||||
|
@ -1009,8 +1007,8 @@ inline static void check_finalizers(int level)
|
||||||
gcMARK(work->p);
|
gcMARK(work->p);
|
||||||
if(prev) prev->next = next;
|
if(prev) prev->next = next;
|
||||||
if(!prev) finalizers = next;
|
if(!prev) finalizers = next;
|
||||||
if(last_in_queue) last_in_queue = last_in_queue->next = work;
|
if(GC->last_in_queue) GC->last_in_queue = GC->last_in_queue->next = work;
|
||||||
if(!last_in_queue) run_queue = last_in_queue = work;
|
if(!GC->last_in_queue) GC->run_queue = GC->last_in_queue = work;
|
||||||
work->next = NULL;
|
work->next = NULL;
|
||||||
--num_fnls;
|
--num_fnls;
|
||||||
|
|
||||||
|
@ -2469,7 +2467,7 @@ static void garbage_collect(int force_full)
|
||||||
|
|
||||||
TIME_DONE();
|
TIME_DONE();
|
||||||
|
|
||||||
if (!run_queue)
|
if (!gc->run_queue)
|
||||||
next_gc_full = 0;
|
next_gc_full = 0;
|
||||||
|
|
||||||
/* run any queued finalizers, EXCEPT in the case where this collection was
|
/* run any queued finalizers, EXCEPT in the case where this collection was
|
||||||
|
@ -2487,12 +2485,12 @@ static void garbage_collect(int force_full)
|
||||||
GC->park[0] = NULL;
|
GC->park[0] = NULL;
|
||||||
GC->park[1] = NULL;
|
GC->park[1] = NULL;
|
||||||
|
|
||||||
while(run_queue) {
|
while(gc->run_queue) {
|
||||||
struct finalizer *f;
|
struct finalizer *f;
|
||||||
void **gcs;
|
void **gcs;
|
||||||
|
|
||||||
f = run_queue; run_queue = run_queue->next;
|
f = gc->run_queue; gc->run_queue = gc->run_queue->next;
|
||||||
if(!run_queue) last_in_queue = NULL;
|
if(!gc->run_queue) gc->last_in_queue = NULL;
|
||||||
|
|
||||||
GCDEBUG((DEBUGOUTF, "Running finalizers %p for pointer %p (lvl %i)\n",
|
GCDEBUG((DEBUGOUTF, "Running finalizers %p for pointer %p (lvl %i)\n",
|
||||||
f, f->p, f->eager_level));
|
f, f->p, f->eager_level));
|
||||||
|
|
|
@ -71,11 +71,31 @@ typedef struct Gen0 {
|
||||||
unsigned long max_size;
|
unsigned long max_size;
|
||||||
} Gen0;
|
} Gen0;
|
||||||
|
|
||||||
|
typedef struct finalizer {
|
||||||
|
char eager_level;
|
||||||
|
char tagged;
|
||||||
|
void *p;
|
||||||
|
GC_finalization_proc f;
|
||||||
|
void *data;
|
||||||
|
#if CHECKS
|
||||||
|
long size;
|
||||||
|
#endif
|
||||||
|
struct finalizer *next;
|
||||||
|
/* Patched after GC: */
|
||||||
|
struct finalizer *prev;
|
||||||
|
struct finalizer *left;
|
||||||
|
struct finalizer *right;
|
||||||
|
} Fnl;
|
||||||
|
|
||||||
typedef struct NewGC {
|
typedef struct NewGC {
|
||||||
Gen0 gen0;
|
Gen0 gen0;
|
||||||
Mark_Proc *mark_table; /* the table of mark procs */
|
Mark_Proc *mark_table; /* the table of mark procs */
|
||||||
Fixup_Proc *fixup_table; /* the table of repair procs */
|
Fixup_Proc *fixup_table; /* the table of repair procs */
|
||||||
|
|
||||||
|
/* Finalization */
|
||||||
|
Fnl *run_queue;
|
||||||
|
Fnl *last_in_queue;
|
||||||
|
|
||||||
struct NewGC *primoridal_gc;
|
struct NewGC *primoridal_gc;
|
||||||
unsigned long max_heap_size;
|
unsigned long max_heap_size;
|
||||||
unsigned long max_pages_in_heap;
|
unsigned long max_pages_in_heap;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user