/* Compile a word definition with the non-optimizing compiler. Allocates memory */ void factor_vm::jit_compile_word(cell word_, cell def_, bool relocate) { gc_root<word> word(word_,this); gc_root<quotation> def(def_,this); jit_compile(def.value(),relocate); word->code = def->code; if(to_boolean(word->pic_def)) jit_compile(word->pic_def,relocate); if(to_boolean(word->pic_tail_def)) jit_compile(word->pic_tail_def,relocate); }
void factor_vm::primitive_set_innermost_stack_frame_quot() { gc_root<callstack> callstack(dpop(),this); gc_root<quotation> quot(dpop(),this); callstack.untag_check(this); quot.untag_check(this); jit_compile(quot.value(),true); stack_frame *inner = innermost_stack_frame_quot(callstack.untagged()); cell offset = (char *)FRAME_RETURN_ADDRESS(inner,this) - (char *)inner->xt; inner->xt = quot->xt; FRAME_RETURN_ADDRESS(inner,this) = (char *)quot->xt + offset; }
int main(int argc, char *argv[]) { JIT_FUNCTION codes = jit_compile("++++++++---++"); printf("result: %d\n", codes()); return 0; }
int main() { Xbyak::CodeGenerator gen(20000); const JIT_FUNCTION codes = jit_compile(gen, "++++++++---++"); printf("result: %d\n", codes()); return 0; }