void forward_object_xts(void) { begin_scan(); CELL obj; while((obj = next_object()) != F) { if(type_of(obj) == WORD_TYPE) { F_WORD *word = untag_object(obj); word->code = forward_xt(word->code); if(word->profiling) word->profiling = forward_xt(word->profiling); } else if(type_of(obj) == QUOTATION_TYPE) { F_QUOTATION *quot = untag_object(obj); if(quot->compiledp != F) quot->code = forward_xt(quot->code); } else if(type_of(obj) == CALLSTACK_TYPE) { F_CALLSTACK *stack = untag_object(obj); iterate_callstack_object(stack,forward_frame_xt); } } /* End the heap scan */ gc_off = false; }
void factor_vm::primitive_callstack_to_array() { data_root<callstack> callstack(ctx->pop(),this); stack_frame_accumulator accum(this); iterate_callstack_object(callstack.untagged(),accum); accum.frames.trim(); ctx->push(accum.frames.elements.value()); }
inline void factorvm::vmprim_callstack_to_array() { gc_root<callstack> callstack(dpop(),this); stack_frame_accumulator accum(this); iterate_callstack_object(callstack.untagged(),accum); accum.frames.trim(); dpush(accum.frames.elements.value()); }
void factor_vm::forward_object_xts() { begin_scan(); cell obj; while(to_boolean(obj = next_object())) { switch(tagged<object>(obj).type()) { case WORD_TYPE: { word *w = untag<word>(obj); if(w->code) w->code = code->forward_code_block(w->code); if(w->profiling) w->profiling = code->forward_code_block(w->profiling); update_word_xt(obj); } break; case QUOTATION_TYPE: { quotation *quot = untag<quotation>(obj); if(quot->code) { quot->code = code->forward_code_block(quot->code); set_quot_xt(quot,quot->code); } } break; case CALLSTACK_TYPE: { callstack *stack = untag<callstack>(obj); callframe_forwarder forwarder(this); iterate_callstack_object(stack,forwarder); } break; default: break; } } end_scan(); }
void factor_vm::primitive_callstack_to_array() { data_root<callstack> callstack(ctx->pop(),this); stack_frame_accumulator accum(this); iterate_callstack_object(callstack.untagged(),accum); /* The callstack iterator visits frames in reverse order (top to bottom) */ std::reverse( (stack_frame_in_array*)accum.frames.elements->data(), (stack_frame_in_array*)(accum.frames.elements->data() + accum.frames.count)); accum.frames.trim(); ctx->push(accum.frames.elements.value()); }
void factor_vm::forward_object_xts() { begin_scan(); cell obj; while((obj = next_object()) != F) { switch(tagged<object>(obj).type()) { case WORD_TYPE: { word *w = untag<word>(obj); if(w->code) w->code = forward_xt(w->code); if(w->profiling) w->profiling = forward_xt(w->profiling); } break; case QUOTATION_TYPE: { quotation *quot = untag<quotation>(obj); if(quot->code) quot->code = forward_xt(quot->code); } break; case CALLSTACK_TYPE: { callstack *stack = untag<callstack>(obj); xt_forwarder forwarder(this); iterate_callstack_object(stack,forwarder); } break; default: break; } } end_scan(); }
static void fixup_callstack_object(callstack *stack) { iterate_callstack_object(stack,fixup_stack_frame); }
void fixup_callstack_object(F_CALLSTACK *stack) { iterate_callstack_object(stack,fixup_stack_frame); }
void factor_vm::fixup_callstack_object(callstack *stack, cell code_relocation_base) { stack_frame_fixupper fixupper(this,code_relocation_base); iterate_callstack_object(stack,fixupper); }
inline void factor_vm::iterate_callstack_object(callstack* stack, Iterator& iterator) { no_fixup none; iterate_callstack_object(stack, iterator, none); }