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 @@ -1551,7 +1551,7 @@ static void addToGlobalSymTab(Symbol *sy
23 #define BINARY_NUMERIC_OPERATION(operator) \
26 - DISASM_RT(PC-1, 1); \
31 @@ -1562,7 +1562,7 @@ static void addToGlobalSymTab(Symbol *sy
32 #define UNARY_NUMERIC_OPERATION(operator) \
35 - DISASM_RT(PC-1, 1); \
39 PUSH_INT(operator n); \
40 @@ -1582,7 +1582,7 @@ static int pushSymVal(void)
49 @@ -1632,7 +1632,7 @@ static int pushImmed(void)
58 @@ -1646,7 +1646,7 @@ static int pushArgVal(void)
67 @@ -1662,7 +1662,7 @@ static int pushArgVal(void)
69 static int pushArgCount(void)
75 PUSH_INT(FP_GET_ARG_COUNT(FrameP));
76 @@ -1675,7 +1675,7 @@ static int pushArgArray(void)
77 DataValue argVal, *argArray;
78 Boolean needArgCopy = False;
84 nArgs = FP_GET_ARG_COUNT(FrameP);
85 @@ -1716,7 +1716,7 @@ static int pushArraySymVal(void)
94 @@ -1759,7 +1759,7 @@ static int anonArrayOpen(void)
102 /* make an empty array */
103 @@ -1790,7 +1790,7 @@ static int anonArraySkip(void)
107 - DISASM_RT(PC-1, 1);
112 @@ -1822,7 +1822,7 @@ static int anonArrayNextVal(void)
114 char numString[TYPE_INT_STR_SIZE(int)];
116 - DISASM_RT(PC-1, 1);
121 @@ -1859,9 +1859,10 @@ static int anonArrayIndexVal(void)
122 int nextIndex, index;
129 - DISASM_RT(PC-2, 2);
130 STACKDUMP(nDim+3, 3);
133 @@ -1906,7 +1907,7 @@ static int anonArrayClose(void)
135 DataValue next_index;
137 - DISASM_RT(PC-1, 1);
141 /* remove top two elements */
142 @@ -1956,9 +1957,10 @@ static int namedArg1orN(Boolean isFirst)
143 DataValue exprVal, argsArray;
150 - DISASM_RT(PC-2, 2);
151 STACKDUMP(nDim + (isFirst ? 2 : 1), 3);
154 @@ -2002,7 +2004,7 @@ static int swapTop2(void)
158 - DISASM_RT(PC-1, 1);
163 @@ -2027,7 +2029,7 @@ static int assign(void)
167 - DISASM_RT(PC-1, 2);
172 @@ -2074,7 +2076,7 @@ static int popStack(void)
176 - DISASM_RT(PC-1, 1);
181 @@ -2091,7 +2093,7 @@ static int dupStack(void)
185 - DISASM_RT(PC-1, 1);
190 @@ -2113,7 +2115,7 @@ static int add(void)
191 DataValue leftVal, rightVal, resultArray;
194 - DISASM_RT(PC-1, 1);
199 @@ -2185,7 +2187,7 @@ static int subtract(void)
200 DataValue leftVal, rightVal, resultArray;
203 - DISASM_RT(PC-1, 1);
208 @@ -2257,7 +2259,7 @@ static int divide(void)
212 - DISASM_RT(PC-1, 1);
217 @@ -2273,7 +2275,7 @@ static int modulo(void)
221 - DISASM_RT(PC-1, 1);
226 @@ -2330,7 +2332,7 @@ static int eq(void)
230 - DISASM_RT(PC-1, 1);
235 @@ -2386,7 +2388,7 @@ static int bitAnd(void)
236 DataValue leftVal, rightVal, resultArray;
239 - DISASM_RT(PC-1, 1);
244 @@ -2446,7 +2448,7 @@ static int bitOr(void)
245 DataValue leftVal, rightVal, resultArray;
248 - DISASM_RT(PC-1, 1);
253 @@ -2529,7 +2531,7 @@ static int power(void)
257 - DISASM_RT(PC-1, 1);
262 @@ -2653,9 +2655,10 @@ static int concat(void)
270 - DISASM_RT(PC-2, 2);
273 /* remember: concatenateNwithSep() succeeds with a non-positive number */
274 @@ -2812,10 +2815,11 @@ static int callSubroutine(void)
283 - DISASM_RT(PC-3, 3);
284 STACKDUMP(nArgs > 0 ? nArgs : -nArgs, 3);
286 return callSubroutineFromSymbol(sym, nArgs);
287 @@ -2849,7 +2853,7 @@ static int callSubroutineUnpackArray(voi
288 SparseArrayEntry *iter;
289 DataValue dvEntry, dvArray, argArray;
291 - DISASM_RT(PC-1, 1);
296 @@ -2999,7 +3003,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 @@ -3031,7 +3035,7 @@ static int branch(void)
309 - DISASM_RT(PC-1, 2);
314 @@ -3061,7 +3065,7 @@ static int branchIf(Boolean trueOrFalse)
318 - DISASM_RT(PC-1, 2);
323 @@ -3085,7 +3089,7 @@ static int branchNever(void)
327 - DISASM_RT(PC-1, 2);
332 @@ -3448,9 +3452,10 @@ static int arrayRef(void)
333 char *keyString = NULL;
340 - DISASM_RT(PC-2, 2);
341 STACKDUMP(nDim+1, 3);
344 @@ -3498,9 +3503,10 @@ static int arrayAssign(void)
352 - DISASM_RT(PC-2, 1);
353 STACKDUMP(nDim+2, 3);
356 @@ -3550,10 +3556,11 @@ static int arrayRefAndAssignSetup(void)
357 char *keyString = NULL;
365 - DISASM_RT(PC-3, 3);
366 STACKDUMP(nDim + (binaryOp ? 2 : 1), 3);
369 @@ -3604,7 +3611,7 @@ static int beginArrayIter(void)
370 DataValue *iteratorValPtr;
373 - DISASM_RT(PC-1, 2);
378 @@ -3663,7 +3670,7 @@ static int arrayIter(void)
382 - DISASM_RT(PC-1, 4);
387 @@ -3739,7 +3746,7 @@ static int beginArrayIterArray(void)
391 - DISASM_RT(PC-1, 2);
396 @@ -3841,7 +3848,7 @@ static int arrayIterArray(void)
398 Boolean keyFound = False;
400 - DISASM_RT(PC-1, 4);
405 @@ -3943,7 +3950,7 @@ static int inArray(void)
409 - DISASM_RT(PC-1, 1);
414 @@ -3987,9 +3994,10 @@ static int deleteArrayElement(void)
415 char *keyString = NULL;
422 - DISASM_RT(PC-2, 2);
423 STACKDUMP(nDim + 1, 3);
426 @@ -4077,7 +4085,7 @@ static int arrayAssignNext(void)
427 DataValue srcValue, dstArray;
430 - DISASM_RT(PC-1, 1);
435 @@ -4119,7 +4127,7 @@ static int arrayNextNumIdx(void)
437 SparseArrayEntry *iter;
439 - DISASM_RT(PC-1, 1);