3 source/interpret.c | 100 ++++++++++++++++++++++++++++-------------------------
4 1 file changed, 54 insertions(+), 46 deletions(-)
6 diff --quilt old/source/interpret.c new/source/interpret.c
7 --- old/source/interpret.c
8 +++ new/source/interpret.c
9 @@ -136,10 +136,10 @@ static void disasmInternal(Inst *inst, i
10 static void stackdump(int n, int extra);
11 static void stackdumpInternal(int n, int extra);
12 #define STACKDUMP(n, x) stackdump(n, x)
13 -#define DISASM_RT(i, n) disasm(NULL, i, n)
14 +#define DISASM_RT() disasm(NULL, PC - 1, 1)
15 #else /* #ifndef DEBUG_STACK */
16 #define STACKDUMP(n, x)
17 -#define DISASM_RT(i, n)
19 #endif /* #ifndef DEBUG_STACK */
21 /* Global symbols and function definitions, is null initialized */
22 @@ -1560,7 +1560,7 @@ static void addToGlobalSymTab(Symbol *sy
23 #define BINARY_NUMERIC_OPERATION(operator) \
26 - DISASM_RT(PC-1, 1); \
31 @@ -1571,7 +1571,7 @@ static void addToGlobalSymTab(Symbol *sy
32 #define UNARY_NUMERIC_OPERATION(operator) \
35 - DISASM_RT(PC-1, 1); \
39 PUSH_INT(operator n); \
40 @@ -1591,7 +1591,7 @@ static int pushSymVal(void)
49 @@ -1646,7 +1646,7 @@ static int pushImmed(void)
58 @@ -1660,7 +1660,7 @@ static int pushArgVal(void)
67 @@ -1676,7 +1676,7 @@ static int pushArgVal(void)
69 static int pushArgCount(void)
75 PUSH_INT(FRAME_GET_ARG_COUNT());
76 @@ -1689,7 +1689,7 @@ static int pushArgArray(void)
77 DataValue argVal, *argArray;
78 Boolean needArgCopy = False;
84 nArgs = FRAME_GET_ARG_COUNT();
85 @@ -1730,7 +1730,7 @@ static int pushArraySymVal(void)
94 @@ -1773,7 +1773,7 @@ static int anonArrayOpen(void)
102 /* make an empty array */
103 @@ -1804,7 +1804,7 @@ static int anonArraySkip(void)
107 - DISASM_RT(PC-1, 1);
112 @@ -1836,7 +1836,7 @@ static int anonArrayNextVal(void)
114 char numString[TYPE_INT_STR_SIZE(int)];
116 - DISASM_RT(PC-1, 1);
121 @@ -1873,9 +1873,10 @@ static int anonArrayIndexVal(void)
122 int nextIndex, index;
129 - DISASM_RT(PC-2, 2);
130 STACKDUMP(nDim+3, 3);
133 @@ -1920,7 +1921,7 @@ static int anonArrayClose(void)
135 DataValue next_index;
137 - DISASM_RT(PC-1, 1);
141 /* remove top two elements */
142 @@ -1970,9 +1971,10 @@ static int namedArg1orN(Boolean isFirst)
143 DataValue exprVal, argsArray;
150 - DISASM_RT(PC-2, 2);
151 STACKDUMP(nDim + (isFirst ? 2 : 1), 3);
154 @@ -2016,7 +2018,7 @@ static int swapTop2(void)
158 - DISASM_RT(PC-1, 1);
163 @@ -2041,7 +2043,7 @@ static int assign(void)
167 - DISASM_RT(PC-1, 2);
172 @@ -2088,7 +2090,7 @@ static int popStack(void)
176 - DISASM_RT(PC-1, 1);
181 @@ -2105,7 +2107,7 @@ static int dupStack(void)
185 - DISASM_RT(PC-1, 1);
190 @@ -2127,7 +2129,7 @@ static int add(void)
191 DataValue leftVal, rightVal, resultArray;
194 - DISASM_RT(PC-1, 1);
199 @@ -2199,7 +2201,7 @@ static int subtract(void)
200 DataValue leftVal, rightVal, resultArray;
203 - DISASM_RT(PC-1, 1);
208 @@ -2271,7 +2273,7 @@ static int divide(void)
212 - DISASM_RT(PC-1, 1);
217 @@ -2287,7 +2289,7 @@ static int modulo(void)
221 - DISASM_RT(PC-1, 1);
226 @@ -2344,7 +2346,7 @@ static int eq(void)
230 - DISASM_RT(PC-1, 1);
235 @@ -2400,7 +2402,7 @@ static int bitAnd(void)
236 DataValue leftVal, rightVal, resultArray;
239 - DISASM_RT(PC-1, 1);
244 @@ -2460,7 +2462,7 @@ static int bitOr(void)
245 DataValue leftVal, rightVal, resultArray;
248 - DISASM_RT(PC-1, 1);
253 @@ -2543,7 +2545,7 @@ static int power(void)
257 - DISASM_RT(PC-1, 1);
262 @@ -2667,9 +2669,10 @@ static int concat(void)
270 - DISASM_RT(PC-2, 2);
273 /* remember: concatenateNwithSep() succeeds with a non-positive number */
274 @@ -2840,10 +2843,11 @@ static int callSubroutine(void)
283 - DISASM_RT(PC-3, 3);
284 STACKDUMP(nArgs > 0 ? nArgs : -nArgs, 3);
286 return callSubroutineFromSymbol(sym, nArgs);
287 @@ -2877,7 +2881,7 @@ static int callSubroutineUnpackArray(voi
288 SparseArrayEntry *iter;
289 DataValue dvEntry, dvArray, argArray;
291 - DISASM_RT(PC-1, 1);
296 @@ -3037,7 +3041,7 @@ static int returnValOrNone(int valOnStac
298 static DataValue noValue = {NO_TAG, {0}};
300 - DISASM_RT(PC-1, 1);
302 STACKDUMP(StackP - FrameP + FRAME_GET_ARG_COUNT() + FP_TO_ARGS_DIST, 3);
304 /* return value is on the stack */
305 @@ -3067,7 +3071,7 @@ static int branch(void)
309 - DISASM_RT(PC-1, 2);
314 @@ -3097,7 +3101,7 @@ static int branchIf(Boolean trueOrFalse)
318 - DISASM_RT(PC-1, 2);
323 @@ -3121,7 +3125,7 @@ static int branchNever(void)
327 - DISASM_RT(PC-1, 2);
332 @@ -3487,9 +3491,10 @@ static int arrayRef(void)
333 char *keyString = NULL;
340 - DISASM_RT(PC-2, 2);
341 STACKDUMP(nDim+1, 3);
344 @@ -3537,9 +3542,10 @@ static int arrayAssign(void)
352 - DISASM_RT(PC-2, 1);
353 STACKDUMP(nDim+2, 3);
356 @@ -3589,10 +3595,11 @@ static int arrayRefAndAssignSetup(void)
357 char *keyString = NULL;
365 - DISASM_RT(PC-3, 3);
366 STACKDUMP(nDim + (binaryOp ? 2 : 1), 3);
369 @@ -3643,7 +3650,7 @@ static int beginArrayIter(void)
370 DataValue *iteratorValPtr;
373 - DISASM_RT(PC-1, 2);
378 @@ -3702,7 +3709,7 @@ static int arrayIter(void)
382 - DISASM_RT(PC-1, 4);
387 @@ -3778,7 +3785,7 @@ static int beginArrayIterArray(void)
391 - DISASM_RT(PC-1, 2);
396 @@ -3880,7 +3887,7 @@ static int arrayIterArray(void)
398 Boolean keyFound = False;
400 - DISASM_RT(PC-1, 4);
405 @@ -3982,7 +3989,7 @@ static int inArray(void)
409 - DISASM_RT(PC-1, 1);
414 @@ -4026,9 +4033,10 @@ static int deleteArrayElement(void)
415 char *keyString = NULL;
422 - DISASM_RT(PC-2, 2);
423 STACKDUMP(nDim + 1, 3);
426 @@ -4119,7 +4127,7 @@ static int arrayAssignNext(void)
427 DataValue srcValue, dstArray;
430 - DISASM_RT(PC-1, 1);
435 @@ -4161,7 +4169,7 @@ static int arrayNextNumIdx(void)
437 SparseArrayEntry *iter;
439 - DISASM_RT(PC-1, 1);