/* References to undefined symbols are patched up to call this function on image load. It finds the symbol and library, and throws an error. */ void factor_vm::undefined_symbol() { stack_frame *frame = innermost_stack_frame(ctx->callstack_bottom, ctx->callstack_top); code_block *compiled = frame_code(frame); cell return_address = (cell)FRAME_RETURN_ADDRESS(frame, this); find_symbol_at_address_visitor visitor(this, return_address); compiled->each_instruction_operand(visitor); if (!to_boolean(visitor.symbol)) critical_error("Can't find RT_DLSYM at return address", return_address); else general_error(ERROR_UNDEFINED_SYMBOL,visitor.symbol,visitor.library); }
void factor_vm::primitive_set_innermost_stack_frame_quot() { data_root<callstack> callstack(ctx->pop(),this); data_root<quotation> quot(ctx->pop(),this); callstack.untag_check(this); quot.untag_check(this); jit_compile_quot(quot.value(),true); stack_frame *inner = innermost_stack_frame(callstack.untagged()); cell offset = (char *)FRAME_RETURN_ADDRESS(inner,this) - (char *)inner->entry_point; inner->entry_point = quot->entry_point; FRAME_RETURN_ADDRESS(inner,this) = (char *)quot->entry_point + offset; }
stack_frame *innermost_stack_frame_quot(callstack *callstack) { stack_frame *inner = innermost_stack_frame(callstack); tagged<quotation>(frame_executing(inner)).untag_check(); return inner; }
void factor_vm::primitive_innermost_stack_frame_scan() { stack_frame *frame = innermost_stack_frame(untag_check<callstack>(ctx->pop())); ctx->push(frame_scan(frame)); }
/* Some primitives implementing a limited form of callstack mutation. Used by the single stepper. */ void factor_vm::primitive_innermost_stack_frame_executing() { stack_frame *frame = innermost_stack_frame(untag_check<callstack>(ctx->pop())); ctx->push(frame_executing_quot(frame)); }
/* Some primitives implementing a limited form of callstack mutation. Used by the single stepper. */ void factor_vm::primitive_innermost_stack_frame_executing() { dpush(frame_executing(innermost_stack_frame(untag_check<callstack>(dpop())))); }
/* Some primitives implementing a limited form of callstack mutation. Used by the single stepper. */ inline void factorvm::vmprim_innermost_stack_frame_executing() { dpush(frame_executing(innermost_stack_frame(untag_check<callstack>(dpop())))); }