potion  0.2
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
vm-arm.c
Go to the documentation of this file.
1 
7 #include <stdio.h>
8 #include <stdlib.h>
9 #include <math.h>
10 #include "potion.h"
11 #include "internal.h"
12 #include "opcodes.h"
13 #include "asm.h"
14 
38 #define RBP(x) (0x18 + (x * sizeof(PN)))
39 
44 #define REG(x) (x == 0 ? 0 : (x == 1 ? 2 : x + 2))
45 #define REG_TMP 3
47 
48 #define ARM(ins, a, b, c, d) \
49  ASM((ins << 2) | ((a >> 2) & 0x3)); \
50  ASM((a << 5) | (b & 0x1F)); \
51  ASM(c); ASM(d)
52 #define ARM3(ins, a, b, c) \
53  ARM(ins, a, b, c >> 8, c)
54 #define ARM2(ins, a, b) \
55  ARM(ins, a, 0, b >> 8, b)
56 #define ARMN(ins, a) \
57  ASM(ins << 2); \
58  ASM(a >> 16); ASM(a >> 8); ASM(a)
59 
60 #define ARM_MOV(a, b) \
61  ARM(31, b, a, (b << 3) | 0x3, 0x78); // or rA,rB,rB
62 #define ARM_UNBOX() \
63  ARM(31, REG(op.a), REG(op.a), 0x0e, 0x70); /* srawi rA,rA,1 */ \
64  ARM(31, REG(op.b), REG(op.b), 0x0e, 0x70) /* srawi rB,rB,1 */
65 #define ARM_MATH(do) \
66  ARM_UNBOX(); \
67  do; /* add, sub, ... */ \
68  ARM(21, REG(op.a), REG(op.a), 0x08, 0x3c); /* rlwin rA,rA,1,0,30 */ \
69  ARM3(24, REG(op.a), REG(op.a), 1); /* ori rA,1 */ \
70  ARM(21, REG(op.b), REG(op.b), 0x08, 0x3c); /* rlwin rB,rB,1,0,30 */ \
71  ARM3(24, REG(op.b), REG(op.b), 1); /* ori rB,1 */
72 #define ARM_CMP(cmp) \
73  ARM_UNBOX(); \
74  ARM(31, 7 << 2, REG(op.a), REG(op.b) << 3, 0x40); /* cmplw cr7,rA,rB */ \
75  ASMI(cmp | 12); /* bCMP +12 */ \
76  ARM2(14, REG(op.a), PN_TRUE); /* li rA,TRUE */ \
77  ASMI(0x48000008); /* b +8 */ \
78  ARM2(14, REG(op.a), PN_FALSE); /* li rA,FALSE */
79 #define TAG_JMP(ins, jpos) \
80  if (jpos >= pos) { \
81  jmps[*jmpc].from = asmp[0]->len; \
82  ASMI(ins); \
83  jmps[*jmpc].to = jpos + 1; \
84  *jmpc = *jmpc + 1; \
85  } else if (jpos < pos) { \
86  int off = (offs[jpos + 1] - (asmp[0]->len)); \
87  if (ins == 0x48000000) \
88  ASMI(ins | (off & 0x3FFFFFF)); \
89  else \
90  ASMI(ins | (off & 0xFFFF)); \
91  } else { \
92  ASMI(ins); \
93  }
94 
95 void potion_arm_setup(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp) {
96  ARM3(47, 30, 1, 0xFFF8); // stmw r30,-8(r1)
97 }
98 
99 void potion_arm_stack(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, long rsp) {
100  rsp = -((rsp+31)&~(15));
101  ARM3(37, 1, 1, rsp); // stwu r1,-X(r1)
102  ARM_MOV(30, 1); // or r30,r1,r1
103 }
104 
105 void potion_arm_registers(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, long start) {
106 }
107 
108 void potion_arm_local(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, long reg, long arg) {
109 }
110 
111 void potion_arm_upvals(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, long lregs, long start, int upc) {
112 }
113 
114 void potion_arm_jmpedit(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, unsigned char *asmj, int dist) {
115  if (asmj[0] == 0x48) {
116  asmj[0] |= (dist >> 24) & 3;
117  asmj[1] = dist >> 16;
118  }
119  asmj[2] = dist >> 8;
120  asmj[3] = dist + 4;
121 }
122 
123 void potion_arm_move(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos) {
124  PN_OP op = PN_OP_AT(f->asmb, pos);
125  ARM_MOV(REG(op.a), REG(op.b)); // li rA,B
126 }
127 
128 void potion_arm_loadpn(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos) {
129  PN_OP op = PN_OP_AT(f->asmb, pos);
130  ARM2(14, REG(op.a), op.b); // li rA,B
131 }
132 
133 void potion_arm_loadk(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
134  PN_OP op = PN_OP_AT(f->asmb, pos);
135  PN val = PN_TUPLE_AT(f->values, op.b);
136  ARM2(15, REG(op.a), val >> 16); // lis rA,B
137  ARM3(24, REG(op.a), REG(op.a), val); // ori rA,B
138 }
139 
140 void potion_arm_self(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
141 }
142 
143 void potion_arm_getlocal(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long regs) {
144  PN_OP op = PN_OP_AT(f->asmb, pos);
145  ARM3(32, REG(op.a), 30, RBP(op.b)); // lwz rA,-B(rsp)
146 }
147 
148 void potion_arm_setlocal(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long regs) {
149  PN_OP op = PN_OP_AT(f->asmb, pos);
150  ARM3(36, REG(op.a), 30, RBP(op.b)); // stw rA,-B(rsp)
151 }
152 
153 void potion_arm_getupval(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long lregs) {
154 }
155 
156 void potion_arm_setupval(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long lregs) {
157 }
158 
159 void potion_arm_global(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
160 }
161 
162 void potion_arm_newtuple(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
163 }
164 
165 void potion_arm_gettuple(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
166 }
167 
168 void potion_arm_settuple(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
169 }
170 
171 void potion_arm_search(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
172 }
173 
174 void potion_arm_gettable(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
175 }
176 void potion_arm_settable(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
177 }
178 
179 void potion_arm_newlick(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
180 }
181 
182 void potion_arm_getpath(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
183 }
184 
185 void potion_arm_setpath(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
186 }
187 
188 void potion_arm_add(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
189  PN_OP op = PN_OP_AT(f->asmb, pos);
190  ARM_MATH({
191  ARM(31, REG(op.a), REG(op.a), REG(op.b) << 3 | 0x2, 0x14); // add rA,rA,rB
192  });
193 }
194 
195 void potion_arm_sub(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
196  PN_OP op = PN_OP_AT(f->asmb, pos);
197  ARM_MATH({
198  ARM(31, REG(op.a), REG(op.b), REG(op.a) << 3, 0x50); // subf rA,rA,rB
199  });
200 }
201 
202 void potion_arm_mult(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
203  PN_OP op = PN_OP_AT(f->asmb, pos);
204  ARM_MATH({
205  ARM(31, REG(op.a), REG(op.a), REG(op.b) << 3 | 0x1, 0xD6); // mullw rA,rA,rB
206  });
207 }
208 
209 void potion_arm_div(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
210  PN_OP op = PN_OP_AT(f->asmb, pos);
211  ARM_MATH({
212  ARM(31, REG(op.a), REG(op.a), REG(op.b) << 3 | 0x3, 0xD6); // divw rA,rA,rB
213  });
214 }
215 
216 void potion_arm_rem(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
217  PN_OP op = PN_OP_AT(f->asmb, pos);
218  ARM_MATH({
219  ARM(31, REG_TMP, REG(op.a), REG(op.b) << 3 | 0x3, 0xD6); // divw rD,rA,rB
220  ARM(31, REG_TMP, REG_TMP, REG(op.b) << 3 | 0x1, 0xD6); // mullw rD,rD,rB
221  ARM(31, REG(op.a), REG_TMP, REG(op.a) << 3, 0x50); // subf rA,rD,rA
222  });
223 }
224 
225 // TODO: need to keep rB in the saved registers, it gets clobbered.
226 void potion_arm_pow(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
227  PN_OP op = PN_OP_AT(f->asmb, pos);
228  ARM_MATH({
229  ARM_MOV(REG_TMP, REG(op.a)); // mov rD,rB
230  ARM(14, REG(op.b), REG(op.b), 0xFF, 0xFF); // addi rD,rD,-1
231  ARM(11, 7 << 2, REG(op.b), 0, 0); // cmpwi cr7,rD,0x0
232  ASMI(0x409D000C); // ble cr7,-12
233  ARM(31, REG(op.a), REG(op.a), REG_TMP << 3 | 0x1, 0xD6); // mullw rA,rA,rA
234  ASMI(0x4BFFFFF0); // b -16
235  });
236 }
237 
238 void potion_arm_neq(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos) {
239  PN_OP op = PN_OP_AT(f->asmb, pos);
240  ARM_CMP(0x419E0000); // beq
241 }
242 
243 void potion_arm_eq(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos) {
244  PN_OP op = PN_OP_AT(f->asmb, pos);
245  ARM_CMP(0x409E0000); // bne
246 }
247 
248 void potion_arm_lt(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos) {
249  PN_OP op = PN_OP_AT(f->asmb, pos);
250  ARM_CMP(0x409C0000); // bge
251 }
252 
253 void potion_arm_lte(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos) {
254  PN_OP op = PN_OP_AT(f->asmb, pos);
255  ARM_CMP(0x419D0000); // bgt
256 }
257 
258 void potion_arm_gt(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos) {
259  PN_OP op = PN_OP_AT(f->asmb, pos);
260  ARM_CMP(0x409D0000); // ble
261 }
262 
263 void potion_arm_gte(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos) {
264  PN_OP op = PN_OP_AT(f->asmb, pos);
265  ARM_CMP(0x419C0000); // blt
266 }
267 
268 void potion_arm_bitn(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
269 }
270 
271 void potion_arm_bitl(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
272  PN_OP op = PN_OP_AT(f->asmb, pos);
273  ARM_MATH({
274  ARM(31, REG(op.a), REG(op.a), REG(op.b) << 3, 0x30); // slw rA,rA,rB
275  });
276 }
277 
278 void potion_arm_bitr(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
279  PN_OP op = PN_OP_AT(f->asmb, pos);
280  ARM_MATH({
281  ARM(31, REG(op.a), REG(op.a), REG(op.b) << 3 | 0x6, 0x30); // sraw rA,rA,rB
282  });
283 }
284 
285 void potion_arm_def(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
286 }
287 
288 void potion_arm_bind(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
289 }
290 
291 void potion_arm_message(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
292 }
293 
294 void potion_arm_jmp(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, PN_OP *start, PNJumps *jmps, size_t *offs, int *jmpc) {
295  PN_OP op = PN_OP_AT(f->asmb, pos);
296  TAG_JMP(0x48000000, pos + op.a); // b
297 }
298 
299 void potion_arm_test_asm(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, int test) {
300 }
301 
302 void potion_arm_test(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos) {
303  potion_arm_test_asm(P, f, asmp, pos, 1);
304 }
305 
306 void potion_arm_not(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos) {
307  potion_arm_test_asm(P, f, asmp, pos, 0);
308 }
309 
310 void potion_arm_cmp(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos) {
311 }
312 
313 void potion_arm_testjmp(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, PN_OP *start, PNJumps *jmps, size_t *offs, int *jmpc) {
314  PN_OP op = PN_OP_AT(f->asmb, pos);
315  ARM(11, 7 << 2, REG(op.a), 0, PN_FALSE); // cmpwi cr7,rA,0x0
316  TAG_JMP(0x409E0000, pos + op.b); // bne
317 }
318 
319 void potion_arm_notjmp(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, PN_OP *start, PNJumps *jmps, size_t *offs, int *jmpc) {
320  PN_OP op = PN_OP_AT(f->asmb, pos);
321  ARM(11, 7 << 2, REG(op.a), 0, PN_FALSE); // cmpwi cr7,rA,0x0
322  TAG_JMP(0x419E0000, pos + op.b); // beq
323 }
324 
325 void potion_arm_named(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
326 }
327 
328 void potion_arm_call(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
329 }
330 
331 void potion_arm_callset(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
332 }
333 
334 void potion_arm_tailcall(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
335 }
336 
337 void potion_arm_return(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos) {
338  PN_OP op = PN_OP_AT(f->asmb, pos);
339  ARM_MOV(3, REG(op.a)); // or r3,rA,rA
340  ARM3(32, 1, 1, 0); // lwz r1,(r1)
341  ARM3(46, 30, 1, 0xFFF8); // lmw r30,-8(r1)
342  ASMI(0x4e800020); // blr
343 }
344 
345 void potion_arm_method(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_OP **pos, long lregs, long start, long regs) {
346 }
347 
348 void potion_arm_class(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
349 }
350 
351 void potion_arm_finish(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp) {
352 }
353 
354 void potion_arm_mcache(Potion *P, vPN(Vtable) vt, PNAsm * volatile *asmp) {
355 }
356 
357 void potion_arm_ivars(Potion *P, PN ivars, PNAsm * volatile *asmp) {
358 }
359 
360 MAKE_TARGET(arm);
void potion_arm_named(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-arm.c:325
#define ARM3(ins, a, b, c)
Definition: vm-arm.c:52
#define PN_TUPLE_AT(t, n)
Definition: potion.h:269
void potion_arm_gte(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos)
Definition: vm-arm.c:263
PN asmb
assembled instructions
Definition: potion.h:458
PN values
numbers, strings, etc.
Definition: potion.h:453
record labels to be patched
Definition: asm.h:20
#define vPN(t)
Definition: potion.h:132
void potion_arm_getpath(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-arm.c:182
void potion_arm_getlocal(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long regs)
Definition: vm-arm.c:143
void potion_arm_lte(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos)
Definition: vm-arm.c:253
void potion_arm_jmp(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, PN_OP *start, PNJumps *jmps, size_t *offs, int *jmpc)
Definition: vm-arm.c:294
void potion_arm_gettable(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-arm.c:174
void potion_arm_mult(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-arm.c:202
void potion_arm_neq(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos)
Definition: vm-arm.c:238
#define TAG_JMP(ins, jpos)
Definition: vm-arm.c:79
void potion_arm_testjmp(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, PN_OP *start, PNJumps *jmps, size_t *offs, int *jmpc)
Definition: vm-arm.c:313
void potion_arm_setlocal(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long regs)
Definition: vm-arm.c:148
void potion_arm_cmp(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos)
Definition: vm-arm.c:310
void potion_arm_gettuple(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-arm.c:165
#define ARM_CMP(cmp)
Definition: vm-arm.c:72
MAKE_TARGET(arm)
#define REG_TMP
The scratch space, register 3, is referred to as rD in the notation.
Definition: vm-arm.c:46
void potion_arm_global(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-arm.c:159
Definition: potion.h:577
void potion_arm_settable(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-arm.c:176
void potion_arm_not(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos)
Definition: vm-arm.c:306
void potion_arm_bitl(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-arm.c:271
the Potion VM instruction set (heavily based on Lua's)
void potion_arm_loadk(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-arm.c:133
void potion_arm_bind(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-arm.c:288
void potion_arm_ivars(Potion *P, PN ivars, PNAsm *volatile *asmp)
Definition: vm-arm.c:357
void potion_arm_add(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-arm.c:188
unsigned int PN_SIZE
Definition: potion.h:79
#define ARM(ins, a, b, c, d)
Definition: vm-arm.c:48
void potion_arm_newtuple(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-arm.c:162
void potion_arm_settuple(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-arm.c:168
void potion_arm_self(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-arm.c:140
void potion_arm_stack(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, long rsp)
Definition: vm-arm.c:99
void potion_arm_newlick(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-arm.c:179
void potion_arm_getupval(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long lregs)
Definition: vm-arm.c:153
#define PN_FALSE
Definition: potion.h:141
void potion_arm_message(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-arm.c:291
void potion_arm_test_asm(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, int test)
Definition: vm-arm.c:299
void potion_arm_bitn(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-arm.c:268
void potion_arm_eq(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos)
Definition: vm-arm.c:243
void potion_arm_sub(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-arm.c:195
some assembler macros
void potion_arm_class(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-arm.c:348
void potion_arm_test(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos)
Definition: vm-arm.c:302
void potion_arm_jmpedit(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, unsigned char *asmj, int dist)
Definition: vm-arm.c:114
void potion_arm_pow(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-arm.c:226
void potion_arm_div(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-arm.c:209
void potion_arm_gt(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos)
Definition: vm-arm.c:258
void potion_arm_finish(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp)
Definition: vm-arm.c:351
void potion_arm_callset(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-arm.c:331
void potion_arm_local(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, long reg, long arg)
Definition: vm-arm.c:108
a prototype is compiled source code, a closure block (lambda) non-volatile.
Definition: potion.h:445
non-API internal parts
#define ARM_MOV(a, b)
Definition: vm-arm.c:60
void potion_arm_rem(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-arm.c:216
void potion_arm_setup(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp)
Definition: vm-arm.c:95
#define PN_OP_AT(asmb, n)
Definition: opcodes.h:82
int a
< the op. See vm.c http://www.lua.org/doc/jucs05.pdf
Definition: opcodes.h:71
the global interpreter state P. currently singleton (not threads yet)
Definition: potion.h:644
The potion API.
void potion_arm_bitr(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-arm.c:278
void potion_arm_setpath(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-arm.c:185
#define ARM2(ins, a, b)
Definition: vm-arm.c:54
void potion_arm_method(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_OP **pos, long lregs, long start, long regs)
Definition: vm-arm.c:345
void potion_arm_def(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-arm.c:285
#define REG(x)
The EABI reserves GPR1 for a stack pointer, GPR3-GPR7 for function argument passing, and GPR3 for function return values.
Definition: vm-arm.c:44
void potion_arm_mcache(Potion *P, vPN(Vtable) vt, PNAsm *volatile *asmp)
Definition: vm-arm.c:354
volatile _PN PN
Definition: potion.h:81
void potion_arm_call(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-arm.c:328
int b
optional arg, the message
Definition: opcodes.h:73
#define ARM_MATH(do)
Definition: vm-arm.c:65
void potion_arm_lt(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos)
Definition: vm-arm.c:248
void potion_arm_search(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-arm.c:171
void potion_arm_return(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos)
Definition: vm-arm.c:337
void potion_arm_notjmp(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, PN_OP *start, PNJumps *jmps, size_t *offs, int *jmpc)
Definition: vm-arm.c:319
void potion_arm_setupval(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long lregs)
Definition: vm-arm.c:156
#define RBP(x)
Definition: vm-arm.c:38
void potion_arm_move(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos)
Definition: vm-arm.c:123
void potion_arm_loadpn(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos)
Definition: vm-arm.c:128
#define ASMI(pn)
Definition: asm.h:100
void potion_arm_upvals(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, long lregs, long start, int upc)
Definition: vm-arm.c:111
void potion_arm_tailcall(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-arm.c:334
void potion_arm_registers(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, long start)
Definition: vm-arm.c:105
PN_OP - a compressed three-address op (as 32bit int bitfield) TODO: expand to 64bit, check jit then.
Definition: opcodes.h:70