Loading...
Searching...
No Matches
Go to the documentation of this file.
12#if defined(__x86_64__) || defined(__ppc64__)
17#elif defined(__GNUC__)
18#if defined(__x86_64__) || defined(__ppc64__)
24#error "Unsupported compiler"
29typedef unsigned short WORD;
31typedef unsigned long long QWORD;
40#define PROTO(proc) static INT proc();
41#define EXTERN(proc) INT proc();
44static INT proc_init();
45static INT proc_retn();
46static INT print_int();
47static INT print_str();
49#define MAX_MEMORY_LEN 100
57static jmp_buf _ipArray[10];
68#define PROC(proc_name) \
69 static int proc_name##DTCASE() \
84 p = (INT *)(m + sp); \
91 p = (INT *)(m + sp); \
97#define MOVL(dst, src) \
102#define ADD(dst, src) \
104 (dst) += (INT)(src); \
107#define SUB(dst, src) \
109 (dst) -= (INT)(src); \
112#define MUL(dst, src) \
114 (dst) *= (INT)(src); \
117#define DIV(dst, src) \
119 (dst) /= (INT)(src); \
131 flag = ((p1) == (p2)) ? FLAG_ZERO : 0; \
135 if (flag & FLAG_ZERO) \
141 if (!(flag & FLAG_ZERO)) \
158#define LEA(dst, src) \
160 (dst) = (void *)(src); \
163#define SETL(dst, src) \
165 *(INT *)(dst) = (src); \
168#define GETL(dst, src) \
170 (dst) = *(INT *)(src); \
177 static jmp_buf _ip; \
178 static jmp_buf _ipArray[10]; \
179 if (setjmp(_ip) == 0) \
181 memcpy(_ipArray[ip++], &_ip, sizeof(jmp_buf)); \
187#define INVOKE(proc) \
202 static jmp_buf _ip; \
203 static jmp_buf _ipArray[]; \
205 memcpy(&_ip, _ipArray[ip - 1], sizeof(jmp_buf)); \
210#define LOOP(index, start, end) \
211 MOVL(index, start); \
212 while (index < end) \
216#define ENDLOOP(index) \
226#define PROC_NAKED(proc_name) \
227 static INT proc_name() \
238static INT proc_init()
245static INT proc_retn()
253static INT print_int()
255 INT num = *(
INT *)(m +
sizeof(
INT) + sp);
256 return printf(
"%d", (
int)num);
259static INT print_str()
261 INT val = *(
INT *)(m +
sizeof(
INT) + sp);
262 return printf(
"%s", (
const char *)val);