This set of patches just eliminates some casts, and some
"foo" in favor of (IMHO) clearer variable names.
I also removed the DO_OP macro as it seems unnecessary
for the current case, but perhaps I undervalue it?
==========================================================
--- build_interp_starter.bak.pl Sat Sep 15 15:42:03 2001
+++ build_interp_starter.pl Sat Sep 15 15:42:34 2001
@@ -29,13 +29,6 @@
# 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
-
# Spit out the OPCODE_FINGERPRINT macro
print INTERP <<EOI
==========================================================
--- interpreter.bak.h Sat Sep 15 15:37:31 2001
+++ interpreter.h Sat Sep 15 15:38:57 2001
@@ -11,6 +11,8 @@
#include "parrot/parrot.h"
+typedef IV * (*parrot_opcode_func)();
+
struct Perl_Interp {
struct IReg *int_reg; /* Current top of int reg stack */
struct NReg *num_reg; /* Current top of the float reg stack
*/
==========================================================
--- parrot/interpreter.c Fri Sep 14 10:08:00 2001
+++ interpreter.c Sat Sep 15 15:17:42 2001
@@ -12,8 +12,7 @@
runops (struct Perl_Interp *interpreter, IV *code) {
/* Move these out of the inner loop. No need to redeclare 'em each
time through */
- IV *(*func)();
- void **temp;
+ parrot_opcode_func c_func;
if (Parrot_num_string_constants == 0) {
printf("Warning: Bytecode does not include opcode table
fingerprint!\n");
@@ -33,7 +32,8 @@
}
while (*code) {
- DO_OP(code, temp, func, interpreter);
+ c_func = *(*interpreter->opcode_funcs)[*code];
+ code = (c_func)(code,interpreter);
}
}
@@ -91,12 +91,12 @@
/* The default opcode function table would be a good thing here... */
{
- void **foo;
- foo = mem_sys_allocate(2048 * sizeof(void *));
+ parrot_opcode_func *parrot_opcode_table;
+ parrot_opcode_table = mem_sys_allocate(2048 *
sizeof(parrot_opcode_func));
- BUILD_TABLE(foo);
+ BUILD_TABLE(parrot_opcode_table);
- interpreter->opcode_funcs = (void*)foo;
+ interpreter->opcode_funcs = parrot_opcode_table;
}
/* In case the I/O system needs something */
==========================================================
Michael
--
Michael Fischer 7.5 million years to run
[EMAIL PROTECTED] printf "%d", 0x2a;
-- deep thought