fix potential problem with checking accessible module-bound ids; avoid unnecessary pagemap update in GC

svn: r12702
This commit is contained in:
Matthew Flatt 2008-12-04 20:47:10 +00:00
parent 34ba6054da
commit 6dabd5cb31
3 changed files with 9 additions and 2 deletions

View File

@ -1621,7 +1621,10 @@ void GC_mark(const void *const_p)
/* now either fetch where we're going to put this object or make /* now either fetch where we're going to put this object or make
a new page if we couldn't find a page with space to spare */ a new page if we couldn't find a page with space to spare */
if(work) { if(work) {
pagemap_add(gc->page_maps, work); if (!work->added) {
pagemap_add(gc->page_maps, work);
work->added = 1;
}
work->marked_on = 1; work->marked_on = 1;
if (work->mprotected) { if (work->mprotected) {
work->mprotected = 0; work->mprotected = 0;
@ -1642,6 +1645,7 @@ void GC_mark(const void *const_p)
if(work->next) if(work->next)
work->next->prev = work; work->next->prev = work;
pagemap_add(gc->page_maps, work); pagemap_add(gc->page_maps, work);
work->added = 1;
gc->gen1_pages[type] = work; gc->gen1_pages[type] = work;
newplace = PTR(NUM(work->addr) + PREFIX_SIZE); newplace = PTR(NUM(work->addr) + PREFIX_SIZE);
} }
@ -1992,6 +1996,7 @@ static void remove_all_gen1_pages_from_pagemap(NewGC *gc)
add_protect_page_range(protect_range, work->addr, work->big_page ? round_to_apage_size(work->size) : APAGE_SIZE, APAGE_SIZE, 1); add_protect_page_range(protect_range, work->addr, work->big_page ? round_to_apage_size(work->size) : APAGE_SIZE, APAGE_SIZE, 1);
} }
pagemap_remove(pagemap, work); pagemap_remove(pagemap, work);
work->added = 0;
} }
} }
flush_protect_page_ranges(protect_range, 1); flush_protect_page_ranges(protect_range, 1);

View File

@ -22,6 +22,7 @@ typedef struct mpage {
unsigned char marked_on ; unsigned char marked_on ;
unsigned char has_new ; unsigned char has_new ;
unsigned char mprotected ; unsigned char mprotected ;
unsigned char added ;
unsigned short live_size; unsigned short live_size;
void **backtrace; void **backtrace;
} mpage; } mpage;

View File

@ -3212,7 +3212,8 @@ Scheme_Object *scheme_check_accessible_in_module(Scheme_Env *env, Scheme_Object
supplied (not both). For unprotected access, both prot_insp supplied (not both). For unprotected access, both prot_insp
and stx+certs should be supplied. */ and stx+certs should be supplied. */
{ {
symbol = scheme_tl_id_sym(env, symbol, NULL, 0, NULL, NULL); if (!SCHEME_SYMBOLP(symbol))
symbol = scheme_tl_id_sym(env, symbol, NULL, 0, NULL, NULL);
if (scheme_is_kernel_env(env) if (scheme_is_kernel_env(env)
|| ((env->module->primitive && !env->module->provide_protects)) || ((env->module->primitive && !env->module->provide_protects))