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