dan 01/09/11 15:21:17
Modified: . build_interp_starter.pl interpreter.c
Log:
Abstracted the runops function core into a macro for easy replacement
later.
Revision Changes Path
1.3 +10 -0 parrot/build_interp_starter.pl
Index: build_interp_starter.pl
===================================================================
RCS file: /home/perlcvs/parrot/build_interp_starter.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -r1.2 -r1.3
--- build_interp_starter.pl 2001/09/10 21:26:09 1.2
+++ build_interp_starter.pl 2001/09/11 22:21:16 1.3
@@ -31,3 +31,13 @@
$count++ unless $name eq 'end';
}
print INTERP "} while (0);\n";
+
+# Spit out the DO_OP function
+print INTERP <<EOI;
+
+#define DO_OP(w,x,y,z) do { \\
+ x = (void *)z->opcode_funcs; \\
+ (void *)y = x[*w]; \\
+ w = (y)(w,z); \\
+ } while (0);
+EOI
1.6 +2 -6 parrot/interpreter.c
Index: interpreter.c
===================================================================
RCS file: /home/perlcvs/parrot/interpreter.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -w -r1.5 -r1.6
--- interpreter.c 2001/09/10 21:40:33 1.5
+++ interpreter.c 2001/09/11 22:21:17 1.6
@@ -12,13 +12,9 @@
/* Move these out of the inner loop. No need to redeclare 'em each
time through */
IV *(*func)();
- void **foo;
+ void **temp;
while (*code) {
- foo = (void *)interpreter->opcode_funcs;
- (void *)func = foo[*code];
- // printf("code %i at %x\n", *code, code);
- code = func(code, interpreter);
- CHECK_EVENTS(interpreter);
+ DO_OP(code, temp, func, interpreter);
}
}