Beispiel #1
0
/* Compile a word definition with the non-optimizing compiler. Allocates memory */
void factor_vm::jit_compile_word(cell word_, cell def_, bool relocating)
{
	data_root<word> word(word_,this);
	data_root<quotation> def(def_,this);

	/* Refuse to compile this word more than once, because quot_compiled_p()
	depends on the identity of its code block */
	if(word->code && word.value() == special_objects[LAZY_JIT_COMPILE_WORD])
		return;

	code_block *compiled = jit_compile_quot(word.value(),def.value(),relocating);
	word->code = compiled;

	if(to_boolean(word->pic_def)) jit_compile_quot(word->pic_def,relocating);
	if(to_boolean(word->pic_tail_def)) jit_compile_quot(word->pic_tail_def,relocating);
}
Beispiel #2
0
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;
}
Beispiel #3
0
void factor_vm::primitive_set_innermost_stack_frame_quot()
{
	data_root<callstack> stack(ctx->pop(),this);
	data_root<quotation> quot(ctx->pop(),this);

	stack.untag_check(this);
	quot.untag_check(this);

	jit_compile_quot(quot.value(),true);

	void *inner = stack->top();
	void *addr = frame_return_address(inner);
	code_block *block = code->code_block_for_address((cell)addr);
	cell offset = block->offset(addr);
	set_frame_return_address(inner, (char*)quot->entry_point + offset);
}