Don't JIT inside heap scan loop, too fragile

db4
Slava Pestov 2008-04-02 18:50:35 -05:00
parent 8fde3fb914
commit 7cd21081af
3 changed files with 24 additions and 8 deletions

View File

@ -730,7 +730,6 @@ void garbage_collection(CELL gen,
/* collect objects referenced from stacks and environment */
collect_roots();
/* collect objects referenced from older generations */
collect_cards();

View File

@ -36,22 +36,36 @@ void do_stage1_init(void)
fprintf(stderr,"*** Stage 2 early init... ");
fflush(stderr);
GROWABLE_ARRAY(words);
begin_scan();
CELL obj;
while((obj = next_object()) != F)
{
if(type_of(obj) == WORD_TYPE)
{
F_WORD *word = untag_object(obj);
default_word_code(word,false);
update_word_xt(word);
}
GROWABLE_ADD(words,obj);
}
/* End heap scan */
gc_off = false;
GROWABLE_TRIM(words);
REGISTER_ROOT(words);
CELL i;
CELL length = array_capacity(untag_object(words));
for(i = 0; i < length; i++)
{
F_WORD *word = untag_word(array_nth(untag_array(words),i));
REGISTER_UNTAGGED(word);
default_word_code(word,false);
UNREGISTER_UNTAGGED(word);
update_word_xt(word);
}
UNREGISTER_ROOT(words);
iterate_code_heap(relocate_code_block);
userenv[STAGE2_ENV] = T;

View File

@ -22,8 +22,11 @@ void fix_stacks(void)
be stored in registers, so callbacks must save and restore the correct values */
void save_stacks(void)
{
stack_chain->datastack = ds;
stack_chain->retainstack = rs;
if(stack_chain)
{
stack_chain->datastack = ds;
stack_chain->retainstack = rs;
}
}
/* called on entry into a compiled callback */