/* Do some initialization that we do once only */ void do_stage1_init(void) { print_string("*** Stage 2 early init... "); fflush(stdout); CELL words = find_all_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; print_string("done\n"); fflush(stdout); }
void set_profiling(bool profiling) { if(profiling == profiling_p) return; profiling_p = profiling; /* Push everything to tenured space so that we can heap scan and allocate profiling blocks if necessary */ gc(); CELL words = find_all_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)); if(profiling) word->counter = tag_fixnum(0); update_word_xt(word); } UNREGISTER_ROOT(words); /* Update XTs in code heap */ iterate_code_heap(relocate_code_block); }
/* Copy literals referenced from all code blocks to newspace. Only for aging and nursery collections */ void factor_vm::trace_code_heap_roots() { code_heap_scans++; literal_reference_tracer tracer(this); iterate_code_heap(tracer); if(current_gc->collecting_accumulation_gen_p()) last_code_heap_scan = current_gc->collecting_gen; else last_code_heap_scan = current_gc->collecting_gen + 1; }
void relocate_code() { iterate_code_heap(fixup_code_block); }
/* Update pointers to words referenced from all code blocks. Only after defining a new word. */ void factor_vm::update_code_heap_words() { word_updater updater(this); iterate_code_heap(updater); }
void factor_vm::primitive_strip_stack_traces() { stack_trace_stripper stripper; iterate_code_heap(stripper); }
void factor_vm::relocate_code(cell data_relocation_base) { code_block_fixupper fixupper(this,data_relocation_base); iterate_code_heap(fixupper); }
/* Copy literals referenced from all code blocks to newspace */ void collect_literals(void) { iterate_code_heap(collect_literals_step); }