3 /* Note that the XT is passed to the quotation in r12 */
5 ldr r12,[r0, #9] /* load quotation-xt slot */ ; \
10 ldr r12,[r0, #9] /* load quotation-xt slot */ ; \
13 #define SAVED_REGS_SIZE 32
15 #define FRAME (RESERVED_SIZE + SAVED_REGS_SIZE + 8)
17 #define LR_SAVE [sp, #-4]
18 #define RESERVED_SIZE 8
20 #define SAVE_LR str lr,LR_SAVE
22 #define LOAD_LR ldr lr,LR_SAVE
24 #define SAVE_AT(offset) (RESERVED_SIZE + 4 * offset)
26 #define SAVE(register,offset) str register,[sp, #SAVE_AT(offset)]
28 #define RESTORE(register,offset) ldr register,[sp, #SAVE_AT(offset)]
38 DEF(void,c_to_factor,(CELL quot)):
41 SAVE(r4,0) /* save GPRs */
42 /* don't save ds pointer */
43 /* don't save rs pointer */
49 SAVE(r0,8) /* save quotation since we're about to mangle it */
51 sub r0,sp,#4 /* pass call stack pointer as an argument */
52 bl MANGLE(save_callstack_bottom)
54 RESTORE(r0,8) /* restore quotation */
57 RESTORE(r11,7) /* restore GPRs */
62 /* don't restore rs pointer */
63 /* don't restore ds pointer */
69 /* The JIT compiles an 'mov r1',sp in front of every primitive call, since a
70 word which was defined as a primitive will not change its definition for the
71 lifetime of the image -- adding new primitives requires a bootstrap. However,
72 an undefined word can certainly become defined,
78 And calls to non-primitives do not have this one-instruction prologue, so we
79 set the XT of undefined words to this symbol. */
80 DEF(void,undefined,(CELL word)):
82 b MANGLE(undefined_error)
84 /* Here we have two entry points. The first one is taken when profiling is
86 DEF(void,docol_profiling,(CELL word)):
87 ldr r1,[r0, #25] /* load profile-count slot */
88 add r1,r1,#8 /* increment count */
89 str r1,[r0, #25] /* store profile-count slot */
90 DEF(void,docol,(CELL word)):
91 ldr r0,[r0, #13] /* load word-def slot */
94 /* We must pass the XT to the quotation in r12. */
95 DEF(void,primitive_call,(void)):
96 ldr r0,[r5], #-4 /* load quotation from data stack */
99 /* We must preserve r1 here in case we're calling a primitive */
100 DEF(void,primitive_execute,(void)):
101 ldr r0,[r5], #-4 /* load word from data stack */
102 ldr pc,[r0, #29] /* jump to word-xt */
104 DEF(void,set_callstack,(F_STACK_FRAME *to, F_STACK_FRAME *from, CELL length)):
105 sub sp,r0,r2 /* compute new stack pointer */
106 mov r0,sp /* start of destination of memcpy() */
107 sub sp,sp,#12 /* alignment */
108 bl MANGLE(memcpy) /* go */
109 add sp,sp,#16 /* point SP at innermost frame */
110 ldr pc,LR_SAVE /* return */
112 DEF(void,throw_impl,(CELL quot, F_STACK_FRAME *rewind_to)):
113 add sp,r1,#4 /* compute new stack pointer */
114 ldr lr,LR_SAVE /* we have rewound the stack; load return address */
115 JUMP_QUOT /* call the quotation */
117 DEF(void,lazy_jit_compile,(CELL quot)):
118 mov r1,sp /* save stack pointer */
120 bl MANGLE(lazy_jit_compile_impl)
122 JUMP_QUOT /* call the quotation */
126 .ascii " -export:c_to_factor"