Attempt to cache mark_table use

svn: r12295
This commit is contained in:
Kevin Tew 2008-11-05 21:09:06 +00:00
parent f8add652eb
commit 7f2ee89d4f

View File

@ -1605,10 +1605,17 @@ void GC_mark(const void *const_p)
} }
/* this is the second mark routine. It's not quite as complicated. */ /* this is the second mark routine. It's not quite as complicated. */
inline static void internal_mark(PageMap pagemap, void *p) /* this is what actually does mark propagation */
static void propagate_marks(void)
{ {
struct mpage *page = pagemap_find_page(pagemap, p); void *p;
NewGC *gc = GC; NewGC *gc = GC;
PageMap pagemap = gc->page_maps;
Mark_Proc *mark_table = gc->mark_table;
while(pop_ptr(&p)) {
struct mpage *page = pagemap_find_page(pagemap, p);
GCDEBUG((DEBUGOUTF, "Popped pointer %p\n", p));
/* we can assume a lot here -- like it's a valid pointer with a page -- /* we can assume a lot here -- like it's a valid pointer with a page --
because we vet bad cases out in GC_mark, above */ because we vet bad cases out in GC_mark, above */
@ -1622,10 +1629,10 @@ inline static void internal_mark(PageMap pagemap, void *p)
case PAGE_TAGGED: case PAGE_TAGGED:
{ {
unsigned short tag = *(unsigned short*)start; unsigned short tag = *(unsigned short*)start;
if((unsigned long)gc->mark_table[tag] < PAGE_TYPES) { if((unsigned long)mark_table[tag] < PAGE_TYPES) {
/* atomic */ /* atomic */
} else } else
gc->mark_table[tag](start); break; mark_table[tag](start); break;
} }
case PAGE_ATOMIC: break; case PAGE_ATOMIC: break;
case PAGE_ARRAY: while(start < end) gcMARK(*(start++)); break; case PAGE_ARRAY: while(start < end) gcMARK(*(start++)); break;
@ -1633,7 +1640,7 @@ inline static void internal_mark(PageMap pagemap, void *p)
case PAGE_TARRAY: { case PAGE_TARRAY: {
unsigned short tag = *(unsigned short *)start; unsigned short tag = *(unsigned short *)start;
end -= INSET_WORDS; end -= INSET_WORDS;
while(start < end) start += gc->mark_table[tag](start); while(start < end) start += mark_table[tag](start);
break; break;
} }
} }
@ -1643,7 +1650,7 @@ inline static void internal_mark(PageMap pagemap, void *p)
set_backtrace_source(p, info->type); set_backtrace_source(p, info->type);
switch(info->type) { switch(info->type) {
case PAGE_TAGGED: gc->mark_table[*(unsigned short*)p](p); break; case PAGE_TAGGED: mark_table[*(unsigned short*)p](p); break;
case PAGE_ATOMIC: break; case PAGE_ATOMIC: break;
case PAGE_ARRAY: { case PAGE_ARRAY: {
void **start = p; void **start = p;
@ -1655,23 +1662,13 @@ inline static void internal_mark(PageMap pagemap, void *p)
void **start = p; void **start = p;
void **end = PPTR(info) + (info->size - INSET_WORDS); void **end = PPTR(info) + (info->size - INSET_WORDS);
unsigned short tag = *(unsigned short *)start; unsigned short tag = *(unsigned short *)start;
while(start < end) start += gc->mark_table[tag](start); while(start < end) start += mark_table[tag](start);
break; break;
} }
case PAGE_XTAGGED: GC_mark_xtagged(p); break; case PAGE_XTAGGED: GC_mark_xtagged(p); break;
} }
} }
} }
/* this is what actually does mark propagation */
static void propagate_marks(void)
{
void *p;
PageMap pagemap = GC->page_maps;
while(pop_ptr(&p)) {
GCDEBUG((DEBUGOUTF, "Popped pointer %p\n", p));
internal_mark(pagemap, p);
}
} }
void *GC_resolve(void *p) void *GC_resolve(void *p)