diff --git a/vm/quotations.cpp b/vm/quotations.cpp old mode 100644 new mode 100755 index e96af39766..a093e0e9df --- a/vm/quotations.cpp +++ b/vm/quotations.cpp @@ -265,7 +265,7 @@ void quotation_jit::iterate_quotation() } } -void set_quot_xt(quotation *quot, code_block *code) +void factorvm::set_quot_xt(quotation *quot, code_block *code) { if(code->type != QUOTATION_TYPE) critical_error("Bad param to set_quot_xt",(cell)code); @@ -274,8 +274,13 @@ void set_quot_xt(quotation *quot, code_block *code) quot->xt = code->xt(); } +void set_quot_xt(quotation *quot, code_block *code) +{ + return vm->set_quot_xt(quot,code); +} + /* Allocates memory */ -void jit_compile(cell quot_, bool relocating) +void factorvm::jit_compile(cell quot_, bool relocating) { gc_root quot(quot_); if(quot->code) return; @@ -289,13 +294,23 @@ void jit_compile(cell quot_, bool relocating) if(relocating) relocate_code_block(compiled); } -PRIMITIVE(jit_compile) +void jit_compile(cell quot_, bool relocating) +{ + return vm->jit_compile(quot_,relocating); +} + +inline void factorvm::vmprim_jit_compile() { jit_compile(dpop(),true); } +PRIMITIVE(jit_compile) +{ + PRIMITIVE_GETVM()->vmprim_jit_compile(); +} + /* push a new quotation on the stack */ -PRIMITIVE(array_to_quotation) +inline void factorvm::vmprim_array_to_quotation() { quotation *quot = allot(sizeof(quotation)); quot->array = dpeek(); @@ -306,13 +321,23 @@ PRIMITIVE(array_to_quotation) drepl(tag(quot)); } -PRIMITIVE(quotation_xt) +PRIMITIVE(array_to_quotation) +{ + PRIMITIVE_GETVM()->vmprim_array_to_quotation(); +} + +inline void factorvm::vmprim_quotation_xt() { quotation *quot = untag_check(dpeek()); drepl(allot_cell((cell)quot->xt)); } -void compile_all_words() +PRIMITIVE(quotation_xt) +{ + PRIMITIVE_GETVM()->vmprim_quotation_xt(); +} + +void factorvm::compile_all_words() { gc_root words(find_all_words()); @@ -329,11 +354,16 @@ void compile_all_words() } - iterate_code_heap(relocate_code_block); + iterate_code_heap(factor::relocate_code_block); +} + +void compile_all_words() +{ + return vm->compile_all_words(); } /* Allocates memory */ -fixnum quot_code_offset_to_scan(cell quot_, cell offset) +fixnum factorvm::quot_code_offset_to_scan(cell quot_, cell offset) { gc_root quot(quot_); gc_root array(quot->array); @@ -345,7 +375,12 @@ fixnum quot_code_offset_to_scan(cell quot_, cell offset) return compiler.get_position(); } -VM_ASM_API cell lazy_jit_compile_impl(cell quot_, stack_frame *stack) +fixnum quot_code_offset_to_scan(cell quot_, cell offset) +{ + return vm->quot_code_offset_to_scan(quot_,offset); +} + +cell factorvm::lazy_jit_compile_impl(cell quot_, stack_frame *stack) { gc_root quot(quot_); stack_chain->callstack_top = stack; @@ -353,11 +388,21 @@ VM_ASM_API cell lazy_jit_compile_impl(cell quot_, stack_frame *stack) return quot.value(); } -PRIMITIVE(quot_compiled_p) +VM_ASM_API cell lazy_jit_compile_impl(cell quot_, stack_frame *stack) +{ + return vm->lazy_jit_compile_impl(quot_,stack); +} + +inline void factorvm::vmprim_quot_compiled_p() { tagged quot(dpop()); quot.untag_check(); dpush(tag_boolean(quot->code != NULL)); } +PRIMITIVE(quot_compiled_p) +{ + PRIMITIVE_GETVM()->vmprim_quot_compiled_p(); +} + } diff --git a/vm/vm.hpp b/vm/vm.hpp index 063627b9b1..bd3a01ac8f 100644 --- a/vm/vm.hpp +++ b/vm/vm.hpp @@ -455,6 +455,17 @@ struct factorvm { void box_value_struct(void *src, cell size); void box_small_struct(cell x, cell y, cell size); void box_medium_struct(cell x1, cell x2, cell x3, cell x4, cell size); + + //quotations + inline void vmprim_jit_compile(); + inline void vmprim_array_to_quotation(); + inline void vmprim_quotation_xt(); + void set_quot_xt(quotation *quot, code_block *code); + void jit_compile(cell quot_, bool relocating); + void compile_all_words(); + fixnum quot_code_offset_to_scan(cell quot_, cell offset); + cell lazy_jit_compile_impl(cell quot_, stack_frame *stack); + inline void vmprim_quot_compiled_p(); // next method here: