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 @@ -1548,7 +1548,7 @@ static void addToGlobalSymTab(Symbol *sy
23 #define BINARY_NUMERIC_OPERATION(operator) \
26 - DISASM_RT(PC-1, 1); \
31 @@ -1559,7 +1559,7 @@ static void addToGlobalSymTab(Symbol *sy
32 #define UNARY_NUMERIC_OPERATION(operator) \
35 - DISASM_RT(PC-1, 1); \
39 PUSH_INT(operator n); \
40 @@ -1579,7 +1579,7 @@ static int pushSymVal(void)
49 @@ -1629,7 +1629,7 @@ static int pushImmed(void)
58 @@ -1643,7 +1643,7 @@ static int pushArgVal(void)
67 @@ -1659,7 +1659,7 @@ static int pushArgVal(void)
69 static int pushArgCount(void)
75 PUSH_INT(FP_GET_ARG_COUNT(FrameP));
76 @@ -1672,7 +1672,7 @@ static int pushArgArray(void)
77 DataValue argVal, *argArray;
78 Boolean needArgCopy = False;
84 nArgs = FP_GET_ARG_COUNT(FrameP);
85 @@ -1713,7 +1713,7 @@ static int pushArraySymVal(void)
94 @@ -1756,7 +1756,7 @@ static int anonArrayOpen(void)
102 /* make an empty array */
103 @@ -1787,7 +1787,7 @@ static int anonArraySkip(void)
107 - DISASM_RT(PC-1, 1);
112 @@ -1819,7 +1819,7 @@ static int anonArrayNextVal(void)
114 char numString[TYPE_INT_STR_SIZE(int)];
116 - DISASM_RT(PC-1, 1);
121 @@ -1856,9 +1856,10 @@ static int anonArrayIndexVal(void)
122 int nextIndex, index;
129 - DISASM_RT(PC-2, 2);
130 STACKDUMP(nDim+3, 3);
133 @@ -1903,7 +1904,7 @@ static int anonArrayClose(void)
135 DataValue next_index;
137 - DISASM_RT(PC-1, 1);
141 /* remove top two elements */
142 @@ -1953,9 +1954,10 @@ static int namedArg1orN(Boolean isFirst)
143 DataValue exprVal, argsArray;
150 - DISASM_RT(PC-2, 2);
151 STACKDUMP(nDim + (isFirst ? 2 : 1), 3);
154 @@ -1999,7 +2001,7 @@ static int swapTop2(void)
158 - DISASM_RT(PC-1, 1);
163 @@ -2024,7 +2026,7 @@ static int assign(void)
167 - DISASM_RT(PC-1, 2);
172 @@ -2071,7 +2073,7 @@ static int popStack(void)
176 - DISASM_RT(PC-1, 1);
181 @@ -2088,7 +2090,7 @@ static int dupStack(void)
185 - DISASM_RT(PC-1, 1);
190 @@ -2110,7 +2112,7 @@ static int add(void)
191 DataValue leftVal, rightVal, resultArray;
194 - DISASM_RT(PC-1, 1);
199 @@ -2182,7 +2184,7 @@ static int subtract(void)
200 DataValue leftVal, rightVal, resultArray;
203 - DISASM_RT(PC-1, 1);
208 @@ -2254,7 +2256,7 @@ static int divide(void)
212 - DISASM_RT(PC-1, 1);
217 @@ -2270,7 +2272,7 @@ static int modulo(void)
221 - DISASM_RT(PC-1, 1);
226 @@ -2327,7 +2329,7 @@ static int eq(void)
230 - DISASM_RT(PC-1, 1);
235 @@ -2383,7 +2385,7 @@ static int bitAnd(void)
236 DataValue leftVal, rightVal, resultArray;
239 - DISASM_RT(PC-1, 1);
244 @@ -2443,7 +2445,7 @@ static int bitOr(void)
245 DataValue leftVal, rightVal, resultArray;
248 - DISASM_RT(PC-1, 1);
253 @@ -2526,7 +2528,7 @@ static int power(void)
257 - DISASM_RT(PC-1, 1);
262 @@ -2650,9 +2652,10 @@ static int concat(void)
270 - DISASM_RT(PC-2, 2);
273 /* remember: concatenateNwithSep() succeeds with a non-positive number */
274 @@ -2809,10 +2812,11 @@ static int callSubroutine(void)
283 - DISASM_RT(PC-3, 3);
284 STACKDUMP(nArgs > 0 ? nArgs : -nArgs, 3);
286 return callSubroutineFromSymbol(sym, nArgs);
287 @@ -2846,7 +2850,7 @@ static int callSubroutineUnpackArray(voi
288 SparseArrayEntry *iter;
289 DataValue dvEntry, dvArray, argArray;
291 - DISASM_RT(PC-1, 1);
296 @@ -2996,7 +3000,7 @@ static int returnValOrNone(int valOnStac
297 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 @@ -3028,7 +3032,7 @@ static int branch(void)
309 - DISASM_RT(PC-1, 2);
314 @@ -3058,7 +3062,7 @@ static int branchIf(Boolean trueOrFalse)
318 - DISASM_RT(PC-1, 2);
323 @@ -3082,7 +3086,7 @@ static int branchNever(void)
327 - DISASM_RT(PC-1, 2);
332 @@ -3445,9 +3449,10 @@ static int arrayRef(void)
333 char *keyString = NULL;
340 - DISASM_RT(PC-2, 2);
341 STACKDUMP(nDim+1, 3);
344 @@ -3495,9 +3500,10 @@ static int arrayAssign(void)
352 - DISASM_RT(PC-2, 1);
353 STACKDUMP(nDim+2, 3);
356 @@ -3547,10 +3553,11 @@ static int arrayRefAndAssignSetup(void)
357 char *keyString = NULL;
365 - DISASM_RT(PC-3, 3);
366 STACKDUMP(nDim + (binaryOp ? 2 : 1), 3);
369 @@ -3601,7 +3608,7 @@ static int beginArrayIter(void)
370 DataValue *iteratorValPtr;
373 - DISASM_RT(PC-1, 2);
378 @@ -3660,7 +3667,7 @@ static int arrayIter(void)
382 - DISASM_RT(PC-1, 4);
387 @@ -3736,7 +3743,7 @@ static int beginArrayIterArray(void)
391 - DISASM_RT(PC-1, 2);
396 @@ -3838,7 +3845,7 @@ static int arrayIterArray(void)
398 Boolean keyFound = False;
400 - DISASM_RT(PC-1, 4);
405 @@ -3940,7 +3947,7 @@ static int inArray(void)
409 - DISASM_RT(PC-1, 1);
414 @@ -3984,9 +3991,10 @@ static int deleteArrayElement(void)
415 char *keyString = NULL;
422 - DISASM_RT(PC-2, 2);
423 STACKDUMP(nDim + 1, 3);
426 @@ -4074,7 +4082,7 @@ static int arrayAssignNext(void)
427 DataValue srcValue, dstArray;
430 - DISASM_RT(PC-1, 1);
435 @@ -4116,7 +4124,7 @@ static int arrayNextNumIdx(void)
437 SparseArrayEntry *iter;
439 - DISASM_RT(PC-1, 1);