potion  0.2
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
vm-ppc.c
Go to the documentation of this file.
1 
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <math.h>
9 #include "potion.h"
10 #include "internal.h"
11 #include "opcodes.h"
12 #include "asm.h"
13 
37 #define RBP(x) (0x18 + (x * sizeof(PN)))
38 
43 #define REG(x) (x == 0 ? 0 : (x == 1 ? 2 : x + 2))
44 #define REG_TMP 3
46 
47 #define PPC(ins, a, b, c, d) \
48  ASM((ins << 2) | ((a >> 2) & 0x3)); \
49  ASM((a << 5) | (b & 0x1F)); \
50  ASM(c); ASM(d)
51 #define PPC3(ins, a, b, c) \
52  PPC(ins, a, b, c >> 8, c)
53 #define PPC2(ins, a, b) \
54  PPC(ins, a, 0, b >> 8, b)
55 #define PPCN(ins, a) \
56  ASM(ins << 2); \
57  ASM(a >> 16); ASM(a >> 8); ASM(a)
58 
59 #define PPC_MOV(a, b) \
60  PPC(31, b, a, (b << 3) | 0x3, 0x78); // or rA,rB,rB
61 #define PPC_UNBOX() \
62  PPC(31, REG(op.a), REG(op.a), 0x0e, 0x70); /* srawi rA,rA,1 */ \
63  PPC(31, REG(op.b), REG(op.b), 0x0e, 0x70) /* srawi rB,rB,1 */
64 #define PPC_MATH(do) \
65  PPC_UNBOX(); \
66  do; /* add, sub, ... */ \
67  PPC(21, REG(op.a), REG(op.a), 0x08, 0x3c); /* rlwin rA,rA,1,0,30 */ \
68  PPC3(24, REG(op.a), REG(op.a), 1); /* ori rA,1 */ \
69  PPC(21, REG(op.b), REG(op.b), 0x08, 0x3c); /* rlwin rB,rB,1,0,30 */ \
70  PPC3(24, REG(op.b), REG(op.b), 1); /* ori rB,1 */
71 #define PPC_CMP(cmp) \
72  PPC_UNBOX(); \
73  PPC(31, 7 << 2, REG(op.a), REG(op.b) << 3, 0x40); /* cmplw cr7,rA,rB */ \
74  ASMI(cmp | 12); /* bCMP +12 */ \
75  PPC2(14, REG(op.a), PN_TRUE); /* li rA,TRUE */ \
76  ASMI(0x48000008); /* b +8 */ \
77  PPC2(14, REG(op.a), PN_FALSE); /* li rA,FALSE */
78 #define TAG_JMP(ins, jpos) \
79  if (jpos >= pos) { \
80  jmps[*jmpc].from = asmp[0]->len; \
81  ASMI(ins); \
82  jmps[*jmpc].to = jpos + 1; \
83  *jmpc = *jmpc + 1; \
84  } else if (jpos < pos) { \
85  int off = (offs[jpos + 1] - (asmp[0]->len)); \
86  if (ins == 0x48000000) \
87  ASMI(ins | (off & 0x3FFFFFF)); \
88  else \
89  ASMI(ins | (off & 0xFFFF)); \
90  } else { \
91  ASMI(ins); \
92  }
93 
94 void potion_ppc_setup(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp) {
95  PPC3(47, 30, 1, 0xFFF8); // stmw r30,-8(r1)
96 }
97 
98 void potion_ppc_stack(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, long rsp) {
99  rsp = -((rsp+31)&~(15));
100  PPC3(37, 1, 1, rsp); // stwu r1,-X(r1)
101  PPC_MOV(30, 1); // or r30,r1,r1
102 }
103 
104 void potion_ppc_registers(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, long start) {
105 }
106 
107 void potion_ppc_local(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, long reg, long arg) {
108 }
109 
110 void potion_ppc_upvals(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, long lregs, long start, int upc) {
111 }
112 
113 void potion_ppc_jmpedit(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, unsigned char *asmj, int dist) {
114  if (asmj[0] == 0x48) {
115  asmj[0] |= (dist >> 24) & 3;
116  asmj[1] = dist >> 16;
117  }
118  asmj[2] = dist >> 8;
119  asmj[3] = dist + 4;
120 }
121 
122 void potion_ppc_move(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos) {
123  PN_OP op = PN_OP_AT(f->asmb, pos);
124  PPC_MOV(REG(op.a), REG(op.b)); // li rA,B
125 }
126 
127 void potion_ppc_loadpn(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos) {
128  PN_OP op = PN_OP_AT(f->asmb, pos);
129  PPC2(14, REG(op.a), op.b); // li rA,B
130 }
131 
132 void potion_ppc_loadk(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
133  PN_OP op = PN_OP_AT(f->asmb, pos);
134  PN val = PN_TUPLE_AT(f->values, op.b);
135  PPC2(15, REG(op.a), val >> 16); // lis rA,B
136  PPC3(24, REG(op.a), REG(op.a), val); // ori rA,B
137 }
138 
139 void potion_ppc_self(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
140 }
141 
142 void potion_ppc_getlocal(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long regs) {
143  PN_OP op = PN_OP_AT(f->asmb, pos);
144  PPC3(32, REG(op.a), 30, RBP(op.b)); // lwz rA,-B(rsp)
145 }
146 
147 void potion_ppc_setlocal(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long regs) {
148  PN_OP op = PN_OP_AT(f->asmb, pos);
149  PPC3(36, REG(op.a), 30, RBP(op.b)); // stw rA,-B(rsp)
150 }
151 
152 void potion_ppc_getupval(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long lregs) {
153 }
154 
155 void potion_ppc_setupval(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long lregs) {
156 }
157 
158 void potion_ppc_global(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
159 }
160 
161 void potion_ppc_newtuple(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
162 }
163 
164 void potion_ppc_gettuple(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
165 }
166 
167 void potion_ppc_settuple(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
168 }
169 
170 void potion_ppc_search(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
171 }
172 
173 void potion_ppc_gettable(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
174 }
175 void potion_ppc_settable(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
176 }
177 
178 void potion_ppc_newlick(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
179 }
180 
181 void potion_ppc_getpath(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
182 }
183 
184 void potion_ppc_setpath(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
185 }
186 
187 void potion_ppc_add(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
188  PN_OP op = PN_OP_AT(f->asmb, pos);
189  PPC_MATH({
190  PPC(31, REG(op.a), REG(op.a), REG(op.b) << 3 | 0x2, 0x14); // add rA,rA,rB
191  });
192 }
193 
194 void potion_ppc_sub(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
195  PN_OP op = PN_OP_AT(f->asmb, pos);
196  PPC_MATH({
197  PPC(31, REG(op.a), REG(op.b), REG(op.a) << 3, 0x50); // subf rA,rA,rB
198  });
199 }
200 
201 void potion_ppc_mult(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
202  PN_OP op = PN_OP_AT(f->asmb, pos);
203  PPC_MATH({
204  PPC(31, REG(op.a), REG(op.a), REG(op.b) << 3 | 0x1, 0xD6); // mullw rA,rA,rB
205  });
206 }
207 
208 void potion_ppc_div(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
209  PN_OP op = PN_OP_AT(f->asmb, pos);
210  PPC_MATH({
211  PPC(31, REG(op.a), REG(op.a), REG(op.b) << 3 | 0x3, 0xD6); // divw rA,rA,rB
212  });
213 }
214 
215 void potion_ppc_rem(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
216  PN_OP op = PN_OP_AT(f->asmb, pos);
217  PPC_MATH({
218  PPC(31, REG_TMP, REG(op.a), REG(op.b) << 3 | 0x3, 0xD6); // divw rD,rA,rB
219  PPC(31, REG_TMP, REG_TMP, REG(op.b) << 3 | 0x1, 0xD6); // mullw rD,rD,rB
220  PPC(31, REG(op.a), REG_TMP, REG(op.a) << 3, 0x50); // subf rA,rD,rA
221  });
222 }
223 
224 // TODO: need to keep rB in the saved registers, it gets clobbered.
225 void potion_ppc_pow(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
226  PN_OP op = PN_OP_AT(f->asmb, pos);
227  PPC_MATH({
228  PPC_MOV(REG_TMP, REG(op.a)); // mov rD,rB
229  PPC(14, REG(op.b), REG(op.b), 0xFF, 0xFF); // addi rD,rD,-1
230  PPC(11, 7 << 2, REG(op.b), 0, 0); // cmpwi cr7,rD,0x0
231  ASMI(0x409D000C); // ble cr7,-12
232  PPC(31, REG(op.a), REG(op.a), REG_TMP << 3 | 0x1, 0xD6); // mullw rA,rA,rA
233  ASMI(0x4BFFFFF0); // b -16
234  });
235 }
236 
237 void potion_ppc_neq(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos) {
238  PN_OP op = PN_OP_AT(f->asmb, pos);
239  PPC_CMP(0x419E0000); // beq
240 }
241 
242 void potion_ppc_eq(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos) {
243  PN_OP op = PN_OP_AT(f->asmb, pos);
244  PPC_CMP(0x409E0000); // bne
245 }
246 
247 void potion_ppc_lt(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos) {
248  PN_OP op = PN_OP_AT(f->asmb, pos);
249  PPC_CMP(0x409C0000); // bge
250 }
251 
252 void potion_ppc_lte(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos) {
253  PN_OP op = PN_OP_AT(f->asmb, pos);
254  PPC_CMP(0x419D0000); // bgt
255 }
256 
257 void potion_ppc_gt(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos) {
258  PN_OP op = PN_OP_AT(f->asmb, pos);
259  PPC_CMP(0x409D0000); // ble
260 }
261 
262 void potion_ppc_gte(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos) {
263  PN_OP op = PN_OP_AT(f->asmb, pos);
264  PPC_CMP(0x419C0000); // blt
265 }
266 
267 void potion_ppc_bitn(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
268 }
269 
270 void potion_ppc_bitl(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
271  PN_OP op = PN_OP_AT(f->asmb, pos);
272  PPC_MATH({
273  PPC(31, REG(op.a), REG(op.a), REG(op.b) << 3, 0x30); // slw rA,rA,rB
274  });
275 }
276 
277 void potion_ppc_bitr(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
278  PN_OP op = PN_OP_AT(f->asmb, pos);
279  PPC_MATH({
280  PPC(31, REG(op.a), REG(op.a), REG(op.b) << 3 | 0x6, 0x30); // sraw rA,rA,rB
281  });
282 }
283 
284 void potion_ppc_def(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
285 }
286 
287 void potion_ppc_bind(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
288 }
289 
290 void potion_ppc_message(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
291 }
292 
293 void potion_ppc_jmp(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, PN_OP *start, PNJumps *jmps, size_t *offs, int *jmpc) {
294  PN_OP op = PN_OP_AT(f->asmb, pos);
295  TAG_JMP(0x48000000, pos + op.a); // b
296 }
297 
298 void potion_ppc_test_asm(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, int test) {
299 }
300 
301 void potion_ppc_test(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos) {
302  potion_ppc_test_asm(P, f, asmp, pos, 1);
303 }
304 
305 void potion_ppc_not(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos) {
306  potion_ppc_test_asm(P, f, asmp, pos, 0);
307 }
308 
309 void potion_ppc_cmp(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos) {
310 }
311 
312 void potion_ppc_testjmp(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, PN_OP *start, PNJumps *jmps, size_t *offs, int *jmpc) {
313  PN_OP op = PN_OP_AT(f->asmb, pos);
314  PPC(11, 7 << 2, REG(op.a), 0, PN_FALSE); // cmpwi cr7,rA,0x0
315  TAG_JMP(0x409E0000, pos + op.b); // bne
316 }
317 
318 void potion_ppc_notjmp(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, PN_OP *start, PNJumps *jmps, size_t *offs, int *jmpc) {
319  PN_OP op = PN_OP_AT(f->asmb, pos);
320  PPC(11, 7 << 2, REG(op.a), 0, PN_FALSE); // cmpwi cr7,rA,0x0
321  TAG_JMP(0x419E0000, pos + op.b); // beq
322 }
323 
324 void potion_ppc_named(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
325 }
326 
327 void potion_ppc_call(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
328 }
329 
330 void potion_ppc_callset(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
331 }
332 
333 void potion_ppc_tailcall(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
334 }
335 
336 void potion_ppc_return(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos) {
337  PN_OP op = PN_OP_AT(f->asmb, pos);
338  PPC_MOV(3, REG(op.a)); // or r3,rA,rA
339  PPC3(32, 1, 1, 0); // lwz r1,(r1)
340  PPC3(46, 30, 1, 0xFFF8); // lmw r30,-8(r1)
341  ASMI(0x4e800020); // blr
342 }
343 
344 void potion_ppc_method(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_OP **pos, long lregs, long start, long regs) {
345 }
346 
347 void potion_ppc_class(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp, PN_SIZE pos, long start) {
348 }
349 
350 void potion_ppc_finish(Potion *P, struct PNProto * volatile f, PNAsm * volatile *asmp) {
351 }
352 
353 void potion_ppc_mcache(Potion *P, vPN(Vtable) vt, PNAsm * volatile *asmp) {
354 }
355 
356 void potion_ppc_ivars(Potion *P, PN ivars, PNAsm * volatile *asmp) {
357 }
358 
359 MAKE_TARGET(ppc);
#define PN_TUPLE_AT(t, n)
Definition: potion.h:269
void potion_ppc_ivars(Potion *P, PN ivars, PNAsm *volatile *asmp)
Definition: vm-ppc.c:356
PN asmb
assembled instructions
Definition: potion.h:458
void potion_ppc_newtuple(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-ppc.c:161
PN values
numbers, strings, etc.
Definition: potion.h:453
void potion_ppc_not(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos)
Definition: vm-ppc.c:305
record labels to be patched
Definition: asm.h:20
#define vPN(t)
Definition: potion.h:132
void potion_ppc_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-ppc.c:312
void potion_ppc_local(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, long reg, long arg)
Definition: vm-ppc.c:107
void potion_ppc_bitn(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-ppc.c:267
void potion_ppc_message(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-ppc.c:290
void potion_ppc_test(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos)
Definition: vm-ppc.c:301
void potion_ppc_sub(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-ppc.c:194
void potion_ppc_setupval(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long lregs)
Definition: vm-ppc.c:155
#define PPC_MATH(do)
Definition: vm-ppc.c:64
void potion_ppc_tailcall(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-ppc.c:333
#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-ppc.c:43
void potion_ppc_setup(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp)
Definition: vm-ppc.c:94
void potion_ppc_global(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-ppc.c:158
void potion_ppc_neq(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos)
Definition: vm-ppc.c:237
void potion_ppc_jmpedit(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, unsigned char *asmj, int dist)
Definition: vm-ppc.c:113
void potion_ppc_getlocal(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long regs)
Definition: vm-ppc.c:142
void potion_ppc_mcache(Potion *P, vPN(Vtable) vt, PNAsm *volatile *asmp)
Definition: vm-ppc.c:353
void potion_ppc_setlocal(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long regs)
Definition: vm-ppc.c:147
void potion_ppc_def(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-ppc.c:284
void potion_ppc_mult(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-ppc.c:201
#define REG_TMP
The scratch space, register 3, is referred to as rD in the notation.
Definition: vm-ppc.c:45
void potion_ppc_lt(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos)
Definition: vm-ppc.c:247
Definition: potion.h:577
#define PPC3(ins, a, b, c)
Definition: vm-ppc.c:51
#define TAG_JMP(ins, jpos)
Definition: vm-ppc.c:78
the Potion VM instruction set (heavily based on Lua's)
void potion_ppc_finish(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp)
Definition: vm-ppc.c:350
unsigned int PN_SIZE
Definition: potion.h:79
void potion_ppc_call(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-ppc.c:327
void potion_ppc_class(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-ppc.c:347
void potion_ppc_bitr(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-ppc.c:277
void potion_ppc_self(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-ppc.c:139
void potion_ppc_gte(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos)
Definition: vm-ppc.c:262
void potion_ppc_test_asm(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, int test)
Definition: vm-ppc.c:298
void potion_ppc_setpath(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-ppc.c:184
#define PPC_MOV(a, b)
Definition: vm-ppc.c:59
void potion_ppc_rem(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-ppc.c:215
MAKE_TARGET(ppc)
void potion_ppc_add(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-ppc.c:187
#define PPC_CMP(cmp)
Definition: vm-ppc.c:71
#define PN_FALSE
Definition: potion.h:141
#define PPC(ins, a, b, c, d)
Definition: vm-ppc.c:47
some assembler macros
void potion_ppc_eq(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos)
Definition: vm-ppc.c:242
void potion_ppc_stack(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, long rsp)
Definition: vm-ppc.c:98
void potion_ppc_registers(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, long start)
Definition: vm-ppc.c:104
#define RBP(x)
Definition: vm-ppc.c:37
void potion_ppc_search(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-ppc.c:170
void potion_ppc_cmp(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos)
Definition: vm-ppc.c:309
void potion_ppc_callset(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-ppc.c:330
a prototype is compiled source code, a closure block (lambda) non-volatile.
Definition: potion.h:445
void potion_ppc_upvals(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, long lregs, long start, int upc)
Definition: vm-ppc.c:110
non-API internal parts
void potion_ppc_div(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-ppc.c:208
void potion_ppc_lte(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos)
Definition: vm-ppc.c:252
void potion_ppc_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-ppc.c:293
void potion_ppc_pow(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-ppc.c:225
void potion_ppc_getupval(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long lregs)
Definition: vm-ppc.c:152
#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
void potion_ppc_settable(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-ppc.c:175
The potion API.
void potion_ppc_settuple(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-ppc.c:167
void potion_ppc_bind(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-ppc.c:287
void potion_ppc_named(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-ppc.c:324
#define PPC2(ins, a, b)
Definition: vm-ppc.c:53
void potion_ppc_loadk(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-ppc.c:132
void potion_ppc_gettuple(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-ppc.c:164
void potion_ppc_gettable(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-ppc.c:173
void potion_ppc_bitl(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-ppc.c:270
void potion_ppc_return(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos)
Definition: vm-ppc.c:336
volatile _PN PN
Definition: potion.h:81
void potion_ppc_newlick(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-ppc.c:178
void potion_ppc_gt(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos)
Definition: vm-ppc.c:257
int b
optional arg, the message
Definition: opcodes.h:73
void potion_ppc_move(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos)
Definition: vm-ppc.c:122
void potion_ppc_loadpn(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos)
Definition: vm-ppc.c:127
void potion_ppc_getpath(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_SIZE pos, long start)
Definition: vm-ppc.c:181
void potion_ppc_method(Potion *P, struct PNProto *volatile f, PNAsm *volatile *asmp, PN_OP **pos, long lregs, long start, long regs)
Definition: vm-ppc.c:344
#define ASMI(pn)
Definition: asm.h:100
void potion_ppc_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-ppc.c:318
PN_OP - a compressed three-address op (as 32bit int bitfield) TODO: expand to 64bit, check jit then.
Definition: opcodes.h:70