GC global usage moved to GC_get_GC()

svn: r12308
This commit is contained in:
Kevin Tew 2008-11-05 21:10:36 +00:00
parent 83fbfd72cb
commit 1f7e962fe6
7 changed files with 32 additions and 31 deletions

View File

@ -12,7 +12,7 @@ inline static int current_owner(NewGC *gc, Scheme_Custodian *c);
inline static void BTC_register_new_thread(void *t, void *c)
{
NewGC *gc = GC;
NewGC *gc = GC_get_GC();
GC_Thread_Info *work;
work = (GC_Thread_Info *)malloc(sizeof(GC_Thread_Info));
@ -26,7 +26,7 @@ inline static void BTC_register_new_thread(void *t, void *c)
inline static void BTC_register_thread(void *t, void *c)
{
NewGC *gc = GC;
NewGC *gc = GC_get_GC();
GC_Thread_Info *work;
work = ((Scheme_Thread *)t)->gc_info;
@ -136,7 +136,7 @@ inline static int current_owner(NewGC *gc, Scheme_Custodian *c)
void BTC_register_root_custodian(void *_c)
{
NewGC *gc = GC;
NewGC *gc = GC_get_GC();
Scheme_Custodian *c = (Scheme_Custodian *)_c;
if (gc->owner_table) {
@ -277,7 +277,7 @@ int BTC_thread_mark(void *p)
int BTC_custodian_mark(void *p)
{
NewGC *gc = GC;
NewGC *gc = GC_get_GC();
if(custodian_to_owner_set(gc, p) == gc->current_mark_owner)
return gc->normal_custodian_mark(p);
else
@ -442,7 +442,7 @@ static void BTC_do_accounting(NewGC *gc)
inline static void BTC_add_account_hook(int type,void *c1,void *c2,unsigned long b)
{
NewGC *gc = GC;
NewGC *gc = GC_get_GC();
AccountHook *work;
if(!gc->really_doing_accounting) {

View File

@ -19,6 +19,7 @@
static THREAD_LOCAL CompactGC *GC;
#define GCTYPE CompactGC
#define GC_get_GC() (GC)
/**************** Configuration ****************/

View File

@ -26,7 +26,7 @@ void GC_set_finalizer(void *p, int tagged, int level, void (*f)(void *p, void *d
void *data, void (**oldf)(void *p, void *data),
void **olddata)
{
GCTYPE *gc = GC;
GCTYPE *gc = GC_get_GC();
Fnl *fnl;
if (!is_finalizable_page(gc, p)) {

View File

@ -3,7 +3,7 @@
/*****************************************************************************/
void **GC_malloc_immobile_box(void *p)
{
GCTYPE *gc = GC;
GCTYPE *gc = GC_get_GC();
GC_Immobile_Box *ib = malloc(sizeof(GC_Immobile_Box));
if(!ib) GCERR((GCOUTF, "Couldn't allocate space for immobile box!\n"));
ib->p = p;
@ -16,7 +16,7 @@ void **GC_malloc_immobile_box(void *p)
void GC_free_immobile_box(void **b)
{
GCTYPE *gc = GC;
GCTYPE *gc = GC_get_GC();
GC_Immobile_Box *ib;
for(ib = gc->immobile_boxes; ib; ib = ib->next)

View File

@ -317,7 +317,7 @@ inline static void pagemap_remove_with_size(PageMap pagemap, mpage *page, long s
int GC_is_allocated(void *p)
{
NewGC *gc = GC;
NewGC *gc = GC_get_GC();
return !!pagemap_find_page(gc->page_maps, p);
}
@ -399,7 +399,7 @@ static inline int BTC_single_allocation_limit(NewGC *gc, size_t sizeb);
/* the core allocation functions */
static void *allocate_big(size_t sizeb, int type)
{
NewGC *gc = GC;
NewGC *gc = GC_get_GC();
mpage *bpage;
void *addr;
@ -524,7 +524,7 @@ inline static void *allocate(size_t sizeb, int type)
/* ensure that allocation will fit in a gen0 page */
newptr = GC_gen0_alloc_page_ptr + sizeb;
while (OVERFLOWS_GEN0(newptr)) {
gc = GC;
gc = GC_get_GC();
/* bring page size used up to date */
gc->gen0.curr_alloc_page->size = GC_gen0_alloc_page_ptr - NUM(gc->gen0.curr_alloc_page->addr);
gc->gen0.current_size += gc->gen0.curr_alloc_page->size;
@ -912,13 +912,13 @@ void GC_set_variable_stack(void **p)
void GC_set_stack_base(void *base)
{
NewGC *gc = GC;
NewGC *gc = GC_get_GC();
gc->stack_base = (unsigned long)base;
}
unsigned long GC_get_stack_base()
{
NewGC *gc = GC;
NewGC *gc = GC_get_GC();
return gc->stack_base;
}
@ -1079,7 +1079,7 @@ inline static void do_ordered_level3(NewGC *gc)
void GC_finalization_weak_ptr(void **p, int offset)
{
NewGC *gc = GC;
NewGC *gc = GC_get_GC();
Weak_Finalizer *wfnl;
gc->park[0] = p; wfnl = GC_malloc_atomic(sizeof(Weak_Finalizer));
@ -1302,7 +1302,7 @@ void GC_register_new_thread(void *t, void *c)
int designate_modified(void *p)
{
NewGC *gc = GC;
NewGC *gc = GC_get_GC();
struct mpage *page = pagemap_find_page(gc->page_maps, p);
if (gc->no_further_modifications) {
@ -1393,21 +1393,21 @@ void GC_init_type_tags(int count, int pair, int mutable_pair, int weakbox, int e
void GC_gcollect(void)
{
NewGC *gc = GC;
NewGC *gc = GC_get_GC();
garbage_collect(gc, 1);
}
void GC_register_traversers(short tag, Size_Proc size, Mark_Proc mark,
Fixup_Proc fixup, int constant_Size, int atomic)
{
NewGC *gc = GC;
NewGC *gc = GC_get_GC();
gc->mark_table[tag] = atomic ? (Mark_Proc)PAGE_ATOMIC : mark;
gc->fixup_table[tag] = fixup;
}
long GC_get_memory_use(void *o)
{
NewGC *gc = GC;
NewGC *gc = GC_get_GC();
#ifdef NEWGC_BTC_ACCOUNT
if(o) {
return BTC_get_memory_use(gc, o);
@ -1436,7 +1436,7 @@ void GC_mark(const void *const_p)
return;
}
gc = GC;
gc = GC_get_GC();
if(!(page = pagemap_find_page(gc->page_maps, p))) {
GCDEBUG((DEBUGOUTF,"Not marking %p (no page)\n",p));
return;
@ -1664,7 +1664,7 @@ static void propagate_marks(NewGC *gc)
void *GC_resolve(void *p)
{
NewGC *gc = GC;
NewGC *gc = GC_get_GC();
struct mpage *page = pagemap_find_page(gc->page_maps, p);
struct objhead *info;
@ -1692,7 +1692,7 @@ void GC_fixup(void *pp)
if(!p || (NUM(p) & 0x1))
return;
gc = GC;
gc = GC_get_GC();
if((page = pagemap_find_page(gc->page_maps, p))) {
struct objhead *info;
@ -1743,7 +1743,7 @@ void GC_dump_with_traces(int flags,
GC_print_tagged_value_proc print_tagged_value,
int path_length_limit)
{
NewGC *gc = GC;
NewGC *gc = GC_get_GC();
mpage *page;
int i;
static unsigned long counts[MAX_DUMP_TAG], sizes[MAX_DUMP_TAG];
@ -1852,7 +1852,7 @@ void GC_dump(void)
int GC_is_tagged(void *p)
{
NewGC *gc = GC;
NewGC *gc = GC_get_GC();
struct mpage *page;
page = pagemap_find_page(gc->page_maps, p);
return page && (page->page_type == PAGE_TAGGED);
@ -2568,7 +2568,7 @@ void GC_dump_variable_stack(void **var_stack,
void GC_free_all(void)
{
NewGC *gc = GC;
NewGC *gc = GC_get_GC();
int i;
mpage *work;
mpage *next;

View File

@ -80,7 +80,7 @@ static void sort_and_merge_roots(Roots *roots)
void GC_add_roots(void *start, void *end)
{
GCTYPE *gc = GC;
GCTYPE *gc = GC_get_GC();
Roots *roots = &gc->roots;
if (roots->count >= roots->size) {

View File

@ -35,7 +35,7 @@ static int size_weak_array(void *p)
static int mark_weak_array(void *p)
{
GCTYPE *gc = GC;
GCTYPE *gc = GC_get_GC();
GC_Weak_Array *a = (GC_Weak_Array *)p;
gcMARK(a->replace_val);
@ -84,7 +84,7 @@ static int fixup_weak_array(void *p)
void *GC_malloc_weak_array(size_t size_in_bytes, void *replace_val)
{
GCTYPE *gc = GC;
GCTYPE *gc = GC_get_GC();
GC_Weak_Array *w;
/* Allcation might trigger GC, so we use park: */
@ -139,7 +139,7 @@ static int size_weak_box(void *p)
static int mark_weak_box(void *p)
{
GCTYPE *gc = GC;
GCTYPE *gc = GC_get_GC();
GC_Weak_Box *wb = (GC_Weak_Box *)p;
gcMARK(wb->secondary_erase);
@ -164,7 +164,7 @@ static int fixup_weak_box(void *p)
void *GC_malloc_weak_box(void *p, void **secondary, int soffset)
{
GCTYPE *gc = GC;
GCTYPE *gc = GC_get_GC();
GC_Weak_Box *w;
/* Allcation might trigger GC, so we use park: */
@ -220,7 +220,7 @@ static int size_ephemeron(void *p)
static int mark_ephemeron(void *p)
{
GCTYPE *gc = GC;
GCTYPE *gc = GC_get_GC();
GC_Ephemeron *eph = (GC_Ephemeron *)p;
if (eph->val) {
@ -256,7 +256,7 @@ static int fixup_ephemeron(void *p)
void *GC_malloc_ephemeron(void *k, void *v)
{
GCTYPE *gc = GC;
GCTYPE *gc = GC_get_GC();
GC_Ephemeron *eph;
/* Allcation might trigger GC, so we use park: */