7 growable_byte_array code;
8 growable_byte_array relocation;
9 growable_array literals;
10 bool computing_offset_p;
15 explicit jit(cell jit_type, cell owner, factor_vm *vm);
16 void compute_position(cell offset);
18 void emit_relocation(cell code_template);
19 void emit(cell code_template);
21 void literal(cell literal) { literals.add(literal); }
22 void emit_with(cell code_template_, cell literal_);
24 void push(cell literal) {
25 emit_with(parent_vm->userenv[JIT_PUSH_IMMEDIATE],literal);
28 void word_jump(cell word) {
29 literal(tag_fixnum(xt_tail_pic_offset));
31 emit(parent_vm->userenv[JIT_WORD_JUMP]);
34 void word_call(cell word) {
35 emit_with(parent_vm->userenv[JIT_WORD_CALL],word);
38 void word_special(cell word) {
39 emit_with(parent_vm->userenv[JIT_WORD_SPECIAL],word);
42 void emit_subprimitive(cell word_) {
43 gc_root<word> word(word_,parent_vm);
44 gc_root<array> code_pair(word->subprimitive,parent_vm);
45 literals.append(parent_vm->untag<array>(array_nth(code_pair.untagged(),0)));
46 emit(array_nth(code_pair.untagged(),1));
49 void emit_class_lookup(fixnum index, cell type);
51 fixnum get_position() {
52 if(computing_offset_p)
54 /* If this is still on, emit() didn't clear it,
55 so the offset was out of bounds */
62 void set_position(fixnum position_) {
63 if(computing_offset_p)
68 code_block *to_code_block();