USING: compiler definitions compiler.units tools.test arrays sequences words kernel
-accessors namespaces fry eval ;
+accessors namespaces fry eval quotations math ;
IN: compiler.units.tests
[ [ [ ] define-temp ] with-compilation-unit ] must-infer
[ ] [ "IN: compiler.units.tests << : nesting-test ( -- ) ; >>" eval( -- ) ] unit-test
observer remove-definition-observer
+
+! Make sure that non-optimized calls to a generic word which
+! hasn't been compiled yet work properly
+GENERIC: uncompiled-generic-test ( a -- b )
+
+M: integer uncompiled-generic-test 1 + ;
+
+<< [ uncompiled-generic-test ] [ jit-compile ] [ suffix! ] bi >>
+"q" set
+
+[ 4 ] [ 3 "q" get call ] unit-test
+
+FORGET: uncompiled-generic-test
else
{
quotation *quot = untag<quotation>(tagged_quot);
- if(quot->code)
+ if(quot_compiled_p(quot))
return (cell)quot->xt;
else
return (cell)w->xt;
void factor_vm::jit_compile_quot(cell quot_, bool relocating)
{
data_root<quotation> quot(quot_,this);
-
- if(quot->code == NULL || quot->code == lazy_jit_compile_block())
+ if(!quot_compiled_p(quot.untagged()))
{
code_block *compiled = jit_compile_quot(quot.value(),quot.value(),relocating);
set_quot_xt(quot.untagged(),compiled);
return parent->lazy_jit_compile(quot);
}
+bool factor_vm::quot_compiled_p(quotation *quot)
+{
+ return quot->code != NULL && quot->code != lazy_jit_compile_block();
+}
+
void factor_vm::primitive_quot_compiled_p()
{
tagged<quotation> quot(ctx->pop());
quot.untag_check(this);
- ctx->push(tag_boolean(quot->code != lazy_jit_compile_block()));
+ ctx->push(tag_boolean(quot_compiled_p(quot.untagged())));
}
cell factor_vm::find_all_quotations()
void jit_compile_quot(cell quot_, bool relocating);
fixnum quot_code_offset_to_scan(cell quot_, cell offset);
cell lazy_jit_compile(cell quot);
+ bool quot_compiled_p(quotation *quot);
void primitive_quot_compiled_p();
cell find_all_quotations();
void initialize_all_quotations();