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 @@ -1549,7 +1549,7 @@ static void addToGlobalSymTab(Symbol *sy
23 #define BINARY_NUMERIC_OPERATION(operator) \
26 - DISASM_RT(PC-1, 1); \
31 @@ -1560,7 +1560,7 @@ static void addToGlobalSymTab(Symbol *sy
32 #define UNARY_NUMERIC_OPERATION(operator) \
35 - DISASM_RT(PC-1, 1); \
39 PUSH_INT(operator n); \
40 @@ -1580,7 +1580,7 @@ static int pushSymVal(void)
49 @@ -1635,7 +1635,7 @@ static int pushImmed(void)
58 @@ -1649,7 +1649,7 @@ static int pushArgVal(void)
67 @@ -1665,7 +1665,7 @@ static int pushArgVal(void)
69 static int pushArgCount(void)
75 PUSH_INT(FP_GET_ARG_COUNT(FrameP));
76 @@ -1678,7 +1678,7 @@ static int pushArgArray(void)
77 DataValue argVal, *argArray;
78 Boolean needArgCopy = False;
84 nArgs = FP_GET_ARG_COUNT(FrameP);
85 @@ -1719,7 +1719,7 @@ static int pushArraySymVal(void)
94 @@ -1762,7 +1762,7 @@ static int anonArrayOpen(void)
102 /* make an empty array */
103 @@ -1793,7 +1793,7 @@ static int anonArraySkip(void)
107 - DISASM_RT(PC-1, 1);
112 @@ -1825,7 +1825,7 @@ static int anonArrayNextVal(void)
114 char numString[TYPE_INT_STR_SIZE(int)];
116 - DISASM_RT(PC-1, 1);
121 @@ -1862,9 +1862,10 @@ static int anonArrayIndexVal(void)
122 int nextIndex, index;
129 - DISASM_RT(PC-2, 2);
130 STACKDUMP(nDim+3, 3);
133 @@ -1909,7 +1910,7 @@ static int anonArrayClose(void)
135 DataValue next_index;
137 - DISASM_RT(PC-1, 1);
141 /* remove top two elements */
142 @@ -1959,9 +1960,10 @@ static int namedArg1orN(Boolean isFirst)
143 DataValue exprVal, argsArray;
150 - DISASM_RT(PC-2, 2);
151 STACKDUMP(nDim + (isFirst ? 2 : 1), 3);
154 @@ -2005,7 +2007,7 @@ static int swapTop2(void)
158 - DISASM_RT(PC-1, 1);
163 @@ -2030,7 +2032,7 @@ static int assign(void)
167 - DISASM_RT(PC-1, 2);
172 @@ -2077,7 +2079,7 @@ static int popStack(void)
176 - DISASM_RT(PC-1, 1);
181 @@ -2094,7 +2096,7 @@ static int dupStack(void)
185 - DISASM_RT(PC-1, 1);
190 @@ -2116,7 +2118,7 @@ static int add(void)
191 DataValue leftVal, rightVal, resultArray;
194 - DISASM_RT(PC-1, 1);
199 @@ -2188,7 +2190,7 @@ static int subtract(void)
200 DataValue leftVal, rightVal, resultArray;
203 - DISASM_RT(PC-1, 1);
208 @@ -2260,7 +2262,7 @@ static int divide(void)
212 - DISASM_RT(PC-1, 1);
217 @@ -2276,7 +2278,7 @@ static int modulo(void)
221 - DISASM_RT(PC-1, 1);
226 @@ -2333,7 +2335,7 @@ static int eq(void)
230 - DISASM_RT(PC-1, 1);
235 @@ -2389,7 +2391,7 @@ static int bitAnd(void)
236 DataValue leftVal, rightVal, resultArray;
239 - DISASM_RT(PC-1, 1);
244 @@ -2449,7 +2451,7 @@ static int bitOr(void)
245 DataValue leftVal, rightVal, resultArray;
248 - DISASM_RT(PC-1, 1);
253 @@ -2532,7 +2534,7 @@ static int power(void)
257 - DISASM_RT(PC-1, 1);
262 @@ -2656,9 +2658,10 @@ static int concat(void)
270 - DISASM_RT(PC-2, 2);
273 /* remember: concatenateNwithSep() succeeds with a non-positive number */
274 @@ -2829,10 +2832,11 @@ static int callSubroutine(void)
283 - DISASM_RT(PC-3, 3);
284 STACKDUMP(nArgs > 0 ? nArgs : -nArgs, 3);
286 return callSubroutineFromSymbol(sym, nArgs);
287 @@ -2866,7 +2870,7 @@ static int callSubroutineUnpackArray(voi
288 SparseArrayEntry *iter;
289 DataValue dvEntry, dvArray, argArray;
291 - DISASM_RT(PC-1, 1);
296 @@ -3026,7 +3030,7 @@ static int returnValOrNone(int valOnStac
298 static DataValue noValue = {NO_TAG, {0}};
300 - DISASM_RT(PC-1, 1);
302 STACKDUMP(StackP - FrameP + FP_GET_ARG_COUNT(FrameP) + FP_TO_ARGS_DIST, 3);
304 /* return value is on the stack */
305 @@ -3056,7 +3060,7 @@ static int branch(void)
309 - DISASM_RT(PC-1, 2);
314 @@ -3086,7 +3090,7 @@ static int branchIf(Boolean trueOrFalse)
318 - DISASM_RT(PC-1, 2);
323 @@ -3110,7 +3114,7 @@ static int branchNever(void)
327 - DISASM_RT(PC-1, 2);
332 @@ -3473,9 +3477,10 @@ static int arrayRef(void)
333 char *keyString = NULL;
340 - DISASM_RT(PC-2, 2);
341 STACKDUMP(nDim+1, 3);
344 @@ -3523,9 +3528,10 @@ static int arrayAssign(void)
352 - DISASM_RT(PC-2, 1);
353 STACKDUMP(nDim+2, 3);
356 @@ -3575,10 +3581,11 @@ static int arrayRefAndAssignSetup(void)
357 char *keyString = NULL;
365 - DISASM_RT(PC-3, 3);
366 STACKDUMP(nDim + (binaryOp ? 2 : 1), 3);
369 @@ -3629,7 +3636,7 @@ static int beginArrayIter(void)
370 DataValue *iteratorValPtr;
373 - DISASM_RT(PC-1, 2);
378 @@ -3688,7 +3695,7 @@ static int arrayIter(void)
382 - DISASM_RT(PC-1, 4);
387 @@ -3764,7 +3771,7 @@ static int beginArrayIterArray(void)
391 - DISASM_RT(PC-1, 2);
396 @@ -3866,7 +3873,7 @@ static int arrayIterArray(void)
398 Boolean keyFound = False;
400 - DISASM_RT(PC-1, 4);
405 @@ -3968,7 +3975,7 @@ static int inArray(void)
409 - DISASM_RT(PC-1, 1);
414 @@ -4012,9 +4019,10 @@ static int deleteArrayElement(void)
415 char *keyString = NULL;
422 - DISASM_RT(PC-2, 2);
423 STACKDUMP(nDim + 1, 3);
426 @@ -4105,7 +4113,7 @@ static int arrayAssignNext(void)
427 DataValue srcValue, dstArray;
430 - DISASM_RT(PC-1, 1);
435 @@ -4147,7 +4155,7 @@ static int arrayNextNumIdx(void)
437 SparseArrayEntry *iter;
439 - DISASM_RT(PC-1, 1);