re-fresh
[nedit-bw.git] / DISASM_RT-in-ContinueMacro.patch
blob5bef0073573f633a0fb465522e7ff2aae14fa9a8
1 ---
3 source/interpret.c | 70 +----------------------------------------------------
4 1 file changed, 2 insertions(+), 68 deletions(-)
6 diff --quilt old/source/interpret.c new/source/interpret.c
7 --- old/source/interpret.c
8 +++ new/source/interpret.c
9 @@ -131,7 +131,7 @@ static void disasmInternal(Inst *inst, i
10 static void stackdump(RestartData *context, int n, int extra);
11 static void stackdumpInternal(RestartData *context, int n, int extra);
12 #define STACKDUMP(n, x) stackdump(Interpreter, n, x)
13 -#define DISASM_RT() disasm(NULL, PC - 1, 1)
14 +#define DISASM_RT() disasm(NULL, Interpreter->last, 1)
15 #else /* #ifndef DEBUG_STACK */
16 #define STACKDUMP(n, x)
17 #define DISASM_RT()
18 @@ -696,6 +696,7 @@ int ContinueMacro(RestartData *continuat
19 #define OP(name, fn) case OP_##name:
20 #include "ops.h"
21 #undef OP
22 + DISASM_RT();
23 status = (OpFns[inst->val.op])();
24 break;
25 default:
26 @@ -1468,7 +1469,6 @@ static void addToGlobalSymTab(Symbol *sy
27 #define BINARY_NUMERIC_OPERATION(operator) \
28 do { \
29 int n1, n2; \
30 - DISASM_RT(); \
31 STACKDUMP(2, 3); \
32 POP_INT(n2); \
33 POP_INT(n1); \
34 @@ -1479,7 +1479,6 @@ static void addToGlobalSymTab(Symbol *sy
35 #define UNARY_NUMERIC_OPERATION(operator) \
36 do { \
37 int n; \
38 - DISASM_RT(); \
39 STACKDUMP(1, 3); \
40 POP_INT(n); \
41 PUSH_INT(operator n); \
42 @@ -1498,7 +1497,6 @@ static int pushSymVal(void)
43 Symbol *s;
44 DataValue symVal = {NO_TAG, {0}};
46 - DISASM_RT();
47 STACKDUMP(0, 3);
49 GET_SYM(s, False);
50 @@ -1563,7 +1561,6 @@ static int pushImmed(void)
52 int immed;
54 - DISASM_RT();
55 STACKDUMP(0, 3);
57 GET_IMMED(immed);
58 @@ -1584,7 +1581,6 @@ static int pushString(void)
60 const char *str;
62 - DISASM_RT();
63 STACKDUMP(0, 3);
65 GET_STR(str);
66 @@ -1598,7 +1594,6 @@ static int pushArgVal(void)
68 int nArgs, argNum;
70 - DISASM_RT();
71 STACKDUMP(1, 3);
73 POP_INT(argNum);
74 @@ -1614,7 +1609,6 @@ static int pushArgVal(void)
76 static int pushArgCount(void)
78 - DISASM_RT();
79 STACKDUMP(0, 3);
81 PUSH_INT(FP_GET_ARG_COUNT(FrameP));
82 @@ -1627,7 +1621,6 @@ static int pushArgArray(void)
83 DataValue argVal, *argArray;
84 Boolean needArgCopy = False;
86 - DISASM_RT();
87 STACKDUMP(0, 3);
89 nArgs = FP_GET_ARG_COUNT(FrameP);
90 @@ -1668,7 +1661,6 @@ static int pushArraySymVal(void)
91 DataValue *dataPtr;
92 int initEmpty;
94 - DISASM_RT();
95 STACKDUMP(0, 3);
97 GET_IMMED(initEmpty);
98 @@ -1706,7 +1698,6 @@ static int anonArrayOpen(void)
100 DataValue dataVal;
102 - DISASM_RT();
103 STACKDUMP(0, 3);
105 /* make an empty array */
106 @@ -1737,7 +1728,6 @@ static int anonArraySkip(void)
107 DataValue anonArray;
108 int nextIndex;
110 - DISASM_RT();
111 STACKDUMP(2, 3);
113 POP(anonArray);
114 @@ -1769,7 +1759,6 @@ static int anonArrayNextVal(void)
115 int nextIndex;
116 char numString[TYPE_INT_STR_SIZE(int)];
118 - DISASM_RT();
119 STACKDUMP(3, 3);
121 POP(exprVal);
122 @@ -1806,8 +1795,6 @@ static int anonArrayIndexVal(void)
123 int nextIndex, index;
124 int nDim;
126 - DISASM_RT();
128 GET_IMMED(nDim);
130 STACKDUMP(nDim+3, 3);
131 @@ -1854,7 +1841,6 @@ static int anonArrayClose(void)
132 DataValue anonArray;
133 DataValue next_index;
135 - DISASM_RT();
136 STACKDUMP(2, 3);
138 /* remove top two elements */
139 @@ -1904,8 +1890,6 @@ static int namedArg1orN(Boolean isFirst)
140 DataValue exprVal, argsArray;
141 int nDim, index;
143 - DISASM_RT();
145 GET_IMMED(nDim);
147 STACKDUMP(nDim + (isFirst ? 2 : 1), 3);
148 @@ -1951,7 +1935,6 @@ static int swapTop2(void)
150 DataValue dv1, dv2;
152 - DISASM_RT();
153 STACKDUMP(2, 3);
155 POP(dv1);
156 @@ -1976,7 +1959,6 @@ static int assign(void)
157 DataValue *dataPtr;
158 DataValue value;
160 - DISASM_RT();
161 STACKDUMP(1, 3);
163 GET_SYM(sym, True);
164 @@ -2009,7 +1991,6 @@ static int popStack(void)
166 DataValue val;
168 - DISASM_RT();
169 STACKDUMP(1, 4);
171 POP(val);
172 @@ -2026,7 +2007,6 @@ static int dupStack(void)
174 DataValue value;
176 - DISASM_RT();
177 STACKDUMP(1, 3);
179 PEEK(value, 0);
180 @@ -2046,8 +2026,6 @@ static int peekPush(void)
182 int index;
184 - DISASM_RT();
186 GET_IMMED(index);
188 STACKDUMP(index + 1, 3);
189 @@ -2069,8 +2047,6 @@ static int peekPop(void)
190 DataValue value;
191 int index, i;
193 - DISASM_RT();
195 GET_IMMED(index);
197 STACKDUMP(index + 1, 3);
198 @@ -2092,8 +2068,6 @@ static int peekDup(void)
199 DataValue value;
200 int index;
202 - DISASM_RT();
204 GET_IMMED(index);
206 STACKDUMP(index + 1, 3);
207 @@ -2117,7 +2091,6 @@ static int add(void)
208 DataValue leftVal, rightVal, resultArray;
209 int n1, n2;
211 - DISASM_RT();
212 STACKDUMP(2, 3);
214 PEEK(rightVal, 0);
215 @@ -2189,7 +2162,6 @@ static int subtract(void)
216 DataValue leftVal, rightVal, resultArray;
217 int n1, n2;
219 - DISASM_RT();
220 STACKDUMP(2, 3);
222 PEEK(rightVal, 0);
223 @@ -2261,7 +2233,6 @@ static int divide(void)
225 int n1, n2;
227 - DISASM_RT();
228 STACKDUMP(2, 3);
230 POP_INT(n2);
231 @@ -2277,7 +2248,6 @@ static int modulo(void)
233 int n1, n2;
235 - DISASM_RT();
236 STACKDUMP(2, 3);
238 POP_INT(n2);
239 @@ -2334,7 +2304,6 @@ static int eq(void)
241 DataValue v1, v2;
243 - DISASM_RT();
244 STACKDUMP(2, 3);
246 POP(v1);
247 @@ -2390,7 +2359,6 @@ static int bitAnd(void)
248 DataValue leftVal, rightVal, resultArray;
249 int n1, n2;
251 - DISASM_RT();
252 STACKDUMP(2, 3);
254 PEEK(rightVal, 0);
255 @@ -2450,7 +2418,6 @@ static int bitOr(void)
256 DataValue leftVal, rightVal, resultArray;
257 int n1, n2;
259 - DISASM_RT();
260 STACKDUMP(2, 3);
262 PEEK(rightVal, 0);
263 @@ -2533,7 +2500,6 @@ static int power(void)
265 int n1, n2, n3;
267 - DISASM_RT();
268 STACKDUMP(2, 3);
270 POP_INT(n2);
271 @@ -2574,7 +2540,6 @@ static int booleanize(void)
272 DataValue dv;
273 int res;
275 - DISASM_RT();
276 STACKDUMP(1, 3);
278 POP(dv);
279 @@ -2687,8 +2652,6 @@ static int concat(void)
281 int nExpr;
283 - DISASM_RT();
285 GET_IMMED(nExpr);
287 STACKDUMP(nExpr, 3);
288 @@ -2846,8 +2809,6 @@ static int callSubroutine(void)
289 Symbol *sym;
290 int nArgs;
292 - DISASM_RT();
294 GET_SYM(sym, False);
295 GET_IMMED(nArgs);
297 @@ -2884,8 +2845,6 @@ static int callSubroutineUnpackArray(voi
298 SparseArrayEntry *iter;
299 DataValue dvEntry, dvArray, argArray;
301 - DISASM_RT();
303 GET_SYM(sym, False);
304 GET_IMMED(nArgs);
306 @@ -3036,7 +2995,6 @@ static int returnValOrNone(int valOnStac
307 DataValue retVal;
308 static DataValue noValue = {NO_TAG, {0}};
310 - DISASM_RT();
311 STACKDUMP(StackP - FrameP + FP_GET_ARG_COUNT(FrameP) + FP_DIST_TO_ARGS, 3);
313 /* return value is on the stack */
314 @@ -3066,7 +3024,6 @@ static int branch(void)
316 Inst *addr;
318 - DISASM_RT();
319 STACKDUMP(0, 3);
321 GET_BRANCH(addr);
322 @@ -3096,7 +3053,6 @@ static int branchIf(Boolean trueOrFalse)
323 int value;
324 Inst *addr;
326 - DISASM_RT();
327 STACKDUMP(1, 3);
329 GET_BRANCH(addr);
330 @@ -3120,7 +3076,6 @@ static int branchNever(void)
332 Inst *addr;
334 - DISASM_RT();
335 STACKDUMP(0, 3);
337 GET_BRANCH(addr);
338 @@ -3483,8 +3438,6 @@ static int arrayRef(void)
339 char *keyString = NULL;
340 int nDim;
342 - DISASM_RT();
344 GET_IMMED(nDim);
346 STACKDUMP(nDim+1, 3);
347 @@ -3535,8 +3488,6 @@ static int arrayAssign(void)
348 int errNum;
349 int nDim;
351 - DISASM_RT();
353 GET_IMMED(nDim);
355 STACKDUMP(nDim+2, 3);
356 @@ -3588,8 +3539,6 @@ static int arrayRefAndAssignSetup(void)
357 char *keyString = NULL;
358 int binaryOp, nDim;
360 - DISASM_RT();
362 GET_IMMED(binaryOp);
363 GET_IMMED(nDim);
365 @@ -3635,7 +3584,6 @@ static int beginArrayIterCheckDim(int ch
366 DataValue arrayVal;
367 int errNum;
369 - DISASM_RT();
370 STACKDUMP(1 + !!checkDim, 3);
372 POP(arrayVal);
373 @@ -3719,7 +3667,6 @@ static int arrayIter(void)
374 Inst *branchAddr;
375 int withVal;
377 - DISASM_RT();
378 STACKDUMP(1, 4);
380 GET_IMMED(withVal);
381 @@ -3773,7 +3720,6 @@ static int endArrayIter(void)
383 DataValue iterator;
385 - DISASM_RT();
386 STACKDUMP(1, 3);
388 POP(iterator);
389 @@ -3870,7 +3816,6 @@ static int arrayIterArray(void)
390 int nDims, d;
391 Boolean keyFound = False;
393 - DISASM_RT();
394 STACKDUMP(2, 4);
396 GET_IMMED(withVal);
397 @@ -3957,7 +3902,6 @@ static int inArray(void)
398 char *keyStr;
399 int inResult = 0;
401 - DISASM_RT();
402 STACKDUMP(2, 3);
404 POP(theArray);
405 @@ -4001,8 +3945,6 @@ static int deleteArrayElement(void)
406 char *keyString = NULL;
407 int nDim;
409 - DISASM_RT();
411 GET_IMMED(nDim);
413 STACKDUMP(nDim + 1, 3);
414 @@ -4083,7 +4025,6 @@ static int readOnly(void)
416 Symbol *sym;
418 - DISASM_RT();
419 STACKDUMP(0, 3);
421 GET_SYM(sym, False);
422 @@ -4108,7 +4049,6 @@ static int arrayAssignNext(void)
423 DataValue srcValue, dstArray;
424 int errNum;
426 - DISASM_RT();
427 STACKDUMP(2, 3);
429 POP(srcValue);
430 @@ -4150,7 +4090,6 @@ static int arrayNextNumIdx(void)
431 DataValue srcArray;
432 SparseArrayEntry *iter;
434 - DISASM_RT();
435 STACKDUMP(1, 3);
437 POP(srcArray);
438 @@ -4171,7 +4110,6 @@ static int startLoop(void)
440 Inst *addr;
442 - DISASM_RT();
443 STACKDUMP(0, 3);
445 GET_BRANCH(addr);
446 @@ -4193,7 +4131,6 @@ static int endLoop(void)
447 int isCont = False;
448 Inst *continueAddr;
450 - DISASM_RT();
451 STACKDUMP(1, 3);
453 GET_BRANCH(continueAddr);
454 @@ -4230,7 +4167,6 @@ static int finalizeLoop(void)
455 int count;
456 int dec = -1;
458 - DISASM_RT();
459 STACKDUMP(2, 3);
461 /* restore loop count */
462 @@ -4258,7 +4194,6 @@ static int breakLoop(void)
464 int count;
466 - DISASM_RT();
467 STACKDUMP(1, 3);
469 POP_INT(count);
470 @@ -4280,7 +4215,6 @@ static int continueLoop(void)
472 int count;
474 - DISASM_RT();
475 STACKDUMP(1, 3);
477 POP_INT(count);