Move typedefs to newgc_internal.h
svn: r12245
This commit is contained in:
parent
6a4576c161
commit
01bed4a680
|
@ -33,6 +33,7 @@
|
|||
#include <string.h>
|
||||
#include "gc2.h"
|
||||
#include "gc2_dump.h"
|
||||
#include "newgc_internal.h"
|
||||
#include "../src/schpriv.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
|
@ -1295,7 +1296,6 @@ static unsigned short weak_box_tag;
|
|||
static unsigned short ephemeron_tag;
|
||||
|
||||
#define is_marked(p) marked(p)
|
||||
typedef short Type_Tag;
|
||||
|
||||
#define weak_box_resolve(p) GC_resolve(p)
|
||||
|
||||
|
|
55
src/mzscheme/gc2/newgc_internal.h
Normal file
55
src/mzscheme/gc2/newgc_internal.h
Normal file
|
@ -0,0 +1,55 @@
|
|||
#include "commongc_internal.h"
|
||||
|
||||
typedef struct Gen0 {
|
||||
struct mpage *curr_alloc_page;
|
||||
struct mpage *pages;
|
||||
struct mpage *big_pages;
|
||||
unsigned long GC_gen0_alloc_page_ptr;
|
||||
unsigned long current_size;
|
||||
unsigned long max_size;
|
||||
} Gen0;
|
||||
|
||||
typedef struct NewGC {
|
||||
Gen0 gen0;
|
||||
struct NewGC *primoridal_gc;
|
||||
unsigned long max_heap_size;
|
||||
unsigned long max_pages_in_heap;
|
||||
unsigned long max_pages_for_use;
|
||||
unsigned long used_pages;
|
||||
unsigned long actual_pages_size;
|
||||
unsigned long in_unsafe_allocation_mode :1;
|
||||
void (*unsafe_allocation_abort)();
|
||||
|
||||
unsigned short weak_array_tag;
|
||||
unsigned short weak_box_tag;
|
||||
unsigned short ephemeron_tag;
|
||||
unsigned short cust_box_tag;
|
||||
|
||||
Roots roots;
|
||||
GC_Weak_Array *weak_arrays;
|
||||
GC_Weak_Box *weak_boxes;
|
||||
GC_Ephemeron *ephemerons;
|
||||
int num_last_seen_ephemerons;
|
||||
} NewGC;
|
||||
|
||||
void NewGC_initialize(NewGC *newgc) {
|
||||
memset(newgc, 0, sizeof(NewGC));
|
||||
newgc->primoridal_gc = NULL;
|
||||
newgc->max_heap_size = 0;
|
||||
newgc->max_pages_in_heap = 0;
|
||||
newgc->max_pages_for_use = 0;
|
||||
newgc->used_pages = 0;
|
||||
newgc->actual_pages_size = 0;
|
||||
newgc->in_unsafe_allocation_mode = 0;
|
||||
newgc->unsafe_allocation_abort = NULL;
|
||||
|
||||
newgc->roots.count = 0;
|
||||
newgc->roots.size = 0;
|
||||
newgc->roots.roots = NULL;
|
||||
newgc->roots.nothing_new = 0;
|
||||
|
||||
newgc->weak_arrays = NULL;
|
||||
newgc->weak_boxes = NULL;
|
||||
newgc->ephemerons = NULL;
|
||||
newgc->num_last_seen_ephemerons = 0;
|
||||
}
|
|
@ -11,16 +11,6 @@
|
|||
#define ROOTS_PTR_ALIGNMENT WORD_SIZE
|
||||
#define ROOTS_PTR_TO_INT(x) ((unsigned long)x)
|
||||
|
||||
typedef struct Roots {
|
||||
long count;
|
||||
long size;
|
||||
/* roots is a array of longs, logically grouped into start and end pairs.
|
||||
* [ start0, end0, start1, end1, ... ]
|
||||
*/
|
||||
unsigned long *roots;
|
||||
int nothing_new;
|
||||
} Roots;
|
||||
|
||||
static Roots *roots = &(Roots) { 0 ,0, 0, 0, };
|
||||
|
||||
|
||||
|
|
|
@ -25,18 +25,6 @@
|
|||
/* weak arrays */
|
||||
/******************************************************************************/
|
||||
|
||||
/* The GC_Weak_Array structure is not externally visible, but
|
||||
clients expect a specific structure. See README for more
|
||||
information. */
|
||||
typedef struct GC_Weak_Array {
|
||||
Type_Tag type;
|
||||
short keyex;
|
||||
long count;
|
||||
void *replace_val;
|
||||
struct GC_Weak_Array *next;
|
||||
void *data[1]; /* must be the 5th longword! */
|
||||
} GC_Weak_Array;
|
||||
|
||||
static GC_Weak_Array *weak_arrays;
|
||||
|
||||
static int size_weak_array(void *p)
|
||||
|
@ -144,18 +132,6 @@ static void zero_weak_arrays()
|
|||
/* weak boxes */
|
||||
/******************************************************************************/
|
||||
|
||||
/* The GC_Weak_Box struct is not externally visible, but
|
||||
first three fields are mandated by the GC interface */
|
||||
typedef struct GC_Weak_Box {
|
||||
Type_Tag type;
|
||||
short keyex;
|
||||
void *val;
|
||||
/* The rest is up to us: */
|
||||
void **secondary_erase;
|
||||
int soffset;
|
||||
struct GC_Weak_Box *next;
|
||||
} GC_Weak_Box;
|
||||
|
||||
static GC_Weak_Box *weak_boxes;
|
||||
|
||||
static int size_weak_box(void *p)
|
||||
|
@ -237,17 +213,6 @@ static void zero_weak_boxes()
|
|||
/* ephemeron */
|
||||
/******************************************************************************/
|
||||
|
||||
/* The GC_Ephemeron struct is not externally visible, but
|
||||
first three fields are mandated by the GC interface */
|
||||
typedef struct GC_Ephemeron {
|
||||
Type_Tag type;
|
||||
short keyex;
|
||||
void *key;
|
||||
void *val;
|
||||
/* The rest is up to us: */
|
||||
struct GC_Ephemeron *next;
|
||||
} GC_Ephemeron;
|
||||
|
||||
static GC_Ephemeron *ephemerons;
|
||||
|
||||
static int num_last_seen_ephemerons = 0;
|
||||
|
|
Loading…
Reference in New Issue
Block a user