]> gitweb.factorcode.org Git - factor.git/blob - vm/quotations.hpp
VM: name change no_non_safepoint_words_p -> stack_frame_p
[factor.git] / vm / quotations.hpp
1 namespace factor {
2
3 struct quotation_jit : public jit {
4   data_root<array> elements;
5   bool compiling, relocate;
6
7   quotation_jit(cell owner, bool compiling, bool relocate, factor_vm* vm)
8       : jit(code_block_unoptimized, owner, vm),
9         elements(false_object, vm),
10         compiling(compiling),
11         relocate(relocate) {}
12   ;
13
14   void init_quotation(cell quot);
15   void emit_mega_cache_lookup(cell methods, fixnum index, cell cache);
16   bool primitive_call_p(cell i, cell length);
17   bool trivial_quotation_p(array* elements);
18   void emit_quotation(cell quot);
19   void emit_epilog(bool needed);
20   bool fast_if_p(cell i, cell length);
21   bool fast_dip_p(cell i, cell length);
22   bool fast_2dip_p(cell i, cell length);
23   bool fast_3dip_p(cell i, cell length);
24   bool mega_lookup_p(cell i, cell length);
25   bool declare_p(cell i, cell length);
26   bool special_subprimitive_p(cell obj);
27   cell word_stack_frame_size(cell obj);
28   bool stack_frame_p();
29   void iterate_quotation();
30
31   /* Allocates memory */
32   void word_call(cell word) {
33     emit_with_literal(parent->special_objects[JIT_WORD_CALL], word);
34   }
35
36   /* Allocates memory (literal(), emit())*/
37   void word_jump(cell word_) {
38     data_root<word> word(word_, parent);
39 #ifndef FACTOR_AMD64
40     literal(tag_fixnum(xt_tail_pic_offset));
41 #endif
42     literal(word.value());
43     emit(parent->special_objects[JIT_WORD_JUMP]);
44   }
45 };
46
47 VM_C_API cell lazy_jit_compile(cell quot, factor_vm* parent);
48
49 }