# New Ticket Created by [EMAIL PROTECTED] # Please include the string: [perl #22592] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=22592 >
These patches are a follow-up to the exploration and proposal http://nntp.x.perl.org/group/perl.perl6.internals/16081 Subject: Register access From: mcharity[at]vendian.org (Mitchell N Charity) Date: Fri, 30 May 2003 19:42:54 -0400 These patches differ from the proposal in two main respects: (1) The macro names are different, REGISTER_INT vs REG_INT. It turned out names like INT_REG were being used both as C macros, _and_ as .jit syntax. It seemed worth disambiguating these two. The annoyingly long REGISTER_INT was the best I came up with. (2) The macros are argument-less. REGISTER_INT vs REG_INT(n). So the normal usage looks like REGISTER_INT[n] vs REG_INT(n). I thought the square-brackets were, usually, visually clearer. And it allowed the macros to be used for the few bulk register manipulation cases, so _all_ instances of the string interpreter->ctx.FOO_reg.registers could be switched to the macros. These patches create macros #define REGISTER_INT interpreter->ctx.int_reg.registers #define REGISTER_NUM interpreter->ctx.num_reg.registers #define REGISTER_STR interpreter->ctx.string_reg.registers #define REGISTER_PMC interpreter->ctx.pmc_reg.registers and substitute them in everywhere. So register access looks like REGISTER_INT[n] Not, as originally proposed, like REGISTER_INT(n) which turned out to be less clear. The C macros INT_REG(n) etal are also replaced. The assorted OpTrans macros IREG(i) etal still exist, but are now defined using REGISTER_INT etal. The .jit syntax register references INT_REG[n] etal are left unchanged. The new macros were named REGISTER_mumble to avoid recreating the current confusion between C macros and jit syntax. (Currently, in jit-related files, "if it has square brackets, then it's .jit syntax, if it has parens, then it's a C macro". Except for the differently named STR_REG(n) vs STRING_REG[n]. Though the current C macros may not be accessible from .jit code? This naming collision seemed unfortunate.) I would have liked something shorter than REGISTER_INT[n] etal, specifically REG_INT[n] etal, but that seemed unacceptably similar to the INT_REG[n] .jit syntax. And REG_I[n] seemed too obscure. And... my creativity failed. Oh well -- it actually doesn't look too bad. Bogus ops2cgc.pl lines (note the "_reg->registers") like 'i' => "interpreter->ctx.int_reg->registers[cur_opcode[%ld]]", have been changed to 'i' => "REGISTER_INT[cur_opcode[%ld]]", etc. The method_util.c interpreter naming convention was changed ("interp" to "interpreter") so I could crush out some more register accesses. The file was already using both conventions, so this seemed reasonable. The second patch will change the interpreter naming convention in ./languages/imcc/optimizer.c's function subst_constants(), to get the two last register accesses. The problem is the rest of the file uses an "interp" convention. So it's a tradeoff. Either the function is slightly oddball, or two register accesses escape the macros. I suggest applying it. Wouldn't it be nice to have a single interpreter naming convention rather than two? How about "interp"? Sigh. Patches pass "make test" and "make quickfulltest" against snapshot parrot_2003-06-05_150000.tar.gz on a linux x86. No ChangeLog entry is included. Comments? Mitchell -- attachment 1 ------------------------------------------------------ url: http://rt.perl.org/rt2/attach/59029/43772/e962b0/register_macros_main.patch -- attachment 2 ------------------------------------------------------ url: http://rt.perl.org/rt2/attach/59029/43773/e22dd9/register_macros_secondary.patch
Only in .: TAGS diff -ur ../old/build_nativecall.pl ./build_nativecall.pl --- ../old/build_nativecall.pl Tue Mar 18 11:00:13 2003 +++ ./build_nativecall.pl Thu Jun 5 17:00:40 2003 @@ -39,13 +39,13 @@ v => "void *", ); -my (%ret_assign) = (p => "final_destination->data = return_data;\nPMC_REG(5) = final_destination;", - i => "INT_REG(5) = return_data;", - l => "INT_REG(5) = return_data;", - c => "INT_REG(5) = return_data;", - s => "INT_REG(5) = return_data;", - f => "NUM_REG(5) = return_data;", - d => "NUM_REG(5) = return_data;", +my (%ret_assign) = (p => "final_destination->data = return_data;\nREGISTER_PMC[5] = final_destination;", + i => "REGISTER_INT[5] = return_data;", + l => "REGISTER_INT[5] = return_data;", + c => "REGISTER_INT[5] = return_data;", + s => "REGISTER_INT[5] = return_data;", + f => "REGISTER_NUM[5] = return_data;", + d => "REGISTER_NUM[5] = return_data;", v => "", ); @@ -86,19 +86,6 @@ #include "parrot/parrot.h" -#if !defined(INT_REG) -# define INT_REG(x) interpreter->ctx.int_reg.registers[x] -#endif -#if !defined(NUM_REG) -# define NUM_REG(x) interpreter->ctx.num_reg.registers[x] -#endif -#if !defined(STR_REG) -# define STR_REG(x) interpreter->ctx.string_reg.registers[x] -#endif -#if !defined(PMC_REG) -# define PMC_REG(x) interpreter->ctx.pmc_reg.registers[x] -#endif - #if defined(HAS_JIT) && defined(I386) # include "parrot/jit.h" # define CAN_BUILD_CALL_FRAMES @@ -109,11 +96,11 @@ hackish, but that's just fine */ static void set_return_val(struct Parrot_Interp *interpreter, int stack, int ints, int strings, int pmcs, int nums) { - INT_REG(0) = stack; - INT_REG(1) = ints; - INT_REG(2) = strings; - INT_REG(3) = pmcs; - INT_REG(4) = nums; + REGISTER_INT[0] = stack; + REGISTER_INT[1] = ints; + REGISTER_INT[2] = strings; + REGISTER_INT[3] = pmcs; + REGISTER_INT[4] = nums; } HEAD @@ -178,25 +165,25 @@ sub make_arg { my ($argtype, $reg_ref) = @_; /p/ && do {my $regnum = $reg_ref->{p}++; - return "PMC_REG($regnum)->data"; + return "REGISTER_PMC[$regnum]->data"; }; /i/ && do {my $regnum = $reg_ref->{i}++; - return "(int)INT_REG($regnum)"; + return "(int)REGISTER_INT[$regnum]"; }; /l/ && do {my $regnum = $reg_ref->{i}++; - return "(long)INT_REG($regnum)"; + return "(long)REGISTER_INT[$regnum]"; }; /s/ && do {my $regnum = $reg_ref->{i}++; - return "(short)INT_REG($regnum)"; + return "(short)REGISTER_INT[$regnum]"; }; /f/ && do {my $regnum = $reg_ref->{n}++; - return "(float)NUM_REG($regnum)"; + return "(float)REGISTER_NUM[$regnum]"; }; /d/ && do {my $regnum = $reg_ref->{n}++; - return "(double)NUM_REG($regnum)"; + return "(double)REGISTER_NUM[$regnum]"; }; /t/ && do {my $regnum = $reg_ref->{s}++; - return "string_to_cstring(interpreter, STR_REG($regnum))"; + return "string_to_cstring(interpreter, REGISTER_STR[$regnum])"; }; /I/ && do { return "interpreter"; @@ -266,11 +253,11 @@ pointer = self->cache.struct_val; return_data = ($ret_type)(*pointer)($params); $ret_reg = return_data; - INT_REG(0) = $stack_returns; - INT_REG(1) = $int_returns; - INT_REG(2) = $string_returns; - INT_REG(3) = $pmc_returns; - INT_REG(4) = $num_returns; + REGISTER_INT[0] = $stack_returns; + REGISTER_INT[1] = $int_returns; + REGISTER_INT[2] = $string_returns; + REGISTER_INT[3] = $pmc_returns; + REGISTER_INT[4] = $num_returns; return; } EOR diff -ur ../old/classes/compiler.pmc ./classes/compiler.pmc --- ../old/classes/compiler.pmc Mon May 19 11:00:03 2003 +++ ./classes/compiler.pmc Thu Jun 5 17:12:29 2003 @@ -30,12 +30,11 @@ Parrot_push_i(interpreter); Parrot_push_s(interpreter); Parrot_push_p(interpreter); - interpreter->ctx.string_reg.registers[5] = (String*) code_ptr; + REGISTER_STR[5] = (String*) code_ptr; func(INTERP, SELF); /* return value PMC is in P5 */ stack_push(interpreter, &interpreter->ctx.user_stack, - interpreter->ctx.pmc_reg.registers[5], - STACK_ENTRY_PMC, STACK_CLEANUP_NULL); + REGISTER_PMC[5], STACK_ENTRY_PMC, STACK_CLEANUP_NULL); Parrot_pop_p(interpreter); Parrot_pop_s(interpreter); Parrot_pop_i(interpreter); diff -ur ../old/core.ops ./core.ops --- ../old/core.ops Fri May 30 03:00:14 2003 +++ ./core.ops Thu Jun 5 17:00:40 2003 @@ -4699,7 +4699,7 @@ inline op invoke() { opcode_t *dest; - PMC * p = interpreter->ctx.pmc_reg.registers[0]; + PMC * p = REGISTER_PMC[0]; dest = (opcode_t *)p->vtable->invoke(interpreter, p, expr NEXT()); diff -ur ../old/debug.c ./debug.c --- ../old/debug.c Tue May 27 19:00:20 2003 +++ ./debug.c Thu Jun 5 17:00:40 2003 @@ -737,7 +737,7 @@ /* set the user arguments */ userargv = pmc_new(interpreter, enum_class_PerlArray); - interpreter->ctx.pmc_reg.registers[0] = userargv; + REGISTER_PMC[0] = userargv; while (command && *command) { i = 0; @@ -890,11 +890,11 @@ STRING *m, *n; if (condition->type & PDB_cond_int) { - i = interpreter->ctx.int_reg.registers[condition->reg]; + i = REGISTER_INT[condition->reg]; if (condition->type & PDB_cond_const) j = *(INTVAL *)condition->value; else - j = interpreter->ctx.int_reg.registers[*(int *)condition->value]; + j = REGISTER_INT[*(int *)condition->value]; if (((condition->type & PDB_cond_gt) && (i > j)) || ((condition->type & PDB_cond_ge) && (i >= j)) || ((condition->type & PDB_cond_eq) && (i == j)) || @@ -905,11 +905,11 @@ return 0; } else if (condition->type & PDB_cond_num) { - k = interpreter->ctx.num_reg.registers[condition->reg]; + k = REGISTER_NUM[condition->reg]; if (condition->type & PDB_cond_const) l = *(FLOATVAL *)condition->value; else - l = interpreter->ctx.num_reg.registers[*(int *)condition->value]; + l = REGISTER_NUM[*(int *)condition->value]; if (((condition->type & PDB_cond_gt) && (k > l)) || ((condition->type & PDB_cond_ge) && (k >= l)) || ((condition->type & PDB_cond_eq) && (k == l)) || @@ -920,11 +920,11 @@ return 0; } else if (condition->type & PDB_cond_str) { - m = interpreter->ctx.string_reg.registers[condition->reg]; + m = REGISTER_STR[condition->reg]; if (condition->type & PDB_cond_const) n = (STRING *)condition->value; else - n = interpreter->ctx.string_reg.registers[*(int *)condition->value]; + n = REGISTER_STR[*(int *)condition->value]; if (((condition->type & PDB_cond_gt) && (string_compare(interpreter, m, n) > 0)) || ((condition->type & PDB_cond_ge) && diff -ur ../old/dod.c ./dod.c --- ../old/dod.c Sun Jun 1 03:00:14 2003 +++ ./dod.c Thu Jun 5 17:07:13 2003 @@ -109,9 +109,8 @@ /* Now, go run through the PMC registers and mark them as live */ /* First mark the current set. */ for (i = 0; i < NUM_REGISTERS; i++) { - if (interpreter->ctx.pmc_reg.registers[i]) { - pobject_lives(interpreter, - (PObj *)interpreter->ctx.pmc_reg.registers[i]); + if (REGISTER_PMC[i]) { + pobject_lives(interpreter, (PObj *)REGISTER_PMC[i]); } } @@ -213,7 +212,7 @@ * are pointing to valid buffers. This is not a good assumption, but it'll * do for now */ for (i = 0; i < NUM_REGISTERS; i++) { - Buffer *reg = (Buffer *)interpreter->ctx.string_reg.registers[i]; + Buffer *reg = (Buffer *)REGISTER_STR[i]; if (reg) pobject_lives(interpreter, reg); diff -ur ../old/embed.c ./embed.c --- ../old/embed.c Sun Jun 1 03:00:14 2003 +++ ./embed.c Thu Jun 5 17:00:40 2003 @@ -272,7 +272,7 @@ userargv = pmc_new_noinit(interpreter, enum_class_PerlArray); /* immediately anchor pmc to root set */ - interpreter->ctx.pmc_reg.registers[0] = userargv; + REGISTER_PMC[0] = userargv; VTABLE_init(interpreter, userargv); for (i = 0; i < argc; i++) { diff -ur ../old/include/parrot/interpreter.h ./include/parrot/interpreter.h --- ../old/include/parrot/interpreter.h Wed May 21 11:00:03 2003 +++ ./include/parrot/interpreter.h Thu Jun 5 17:00:40 2003 @@ -177,6 +177,11 @@ immediate destruction */ } Interp; +#define REGISTER_INT interpreter->ctx.int_reg.registers +#define REGISTER_NUM interpreter->ctx.num_reg.registers +#define REGISTER_STR interpreter->ctx.string_reg.registers +#define REGISTER_PMC interpreter->ctx.pmc_reg.registers + #define PCONST(i) PF_CONST(interpreter->code, (i)) #define PNCONST PF_NCONST(interpreter->code) diff -ur ../old/interpreter.c ./interpreter.c --- ../old/interpreter.c Sun Jun 1 03:00:14 2003 +++ ./interpreter.c Thu Jun 5 17:00:40 2003 @@ -111,20 +111,20 @@ case PARROT_ARG_KI: case PARROT_ARG_I: - pc_prederef[i] = (void *)&interpreter->ctx.int_reg.registers[pc[i]]; + pc_prederef[i] = (void *)®ISTER_INT[pc[i]]; break; case PARROT_ARG_N: - pc_prederef[i] = (void *)&interpreter->ctx.num_reg.registers[pc[i]]; + pc_prederef[i] = (void *)®ISTER_NUM[pc[i]]; break; case PARROT_ARG_K: case PARROT_ARG_P: - pc_prederef[i] = (void *)&interpreter->ctx.pmc_reg.registers[pc[i]]; + pc_prederef[i] = (void *)®ISTER_PMC[pc[i]]; break; case PARROT_ARG_S: - pc_prederef[i] = (void *)&interpreter->ctx.string_reg.registers[pc[i]]; + pc_prederef[i] = (void *)®ISTER_STR[pc[i]]; break; case PARROT_ARG_KIC: diff -ur ../old/jit/alpha/jit_emit.h ./jit/alpha/jit_emit.h --- ../old/jit/alpha/jit_emit.h Tue Feb 25 11:00:13 2003 +++ ./jit/alpha/jit_emit.h Thu Jun 5 17:00:40 2003 @@ -140,7 +140,7 @@ #define emit_l_s_r(pc, opcode, Ra, Rb, Parrot_reg) \ emit_mem(pc, opcode, Ra, Rb, \ - (((char *)Parrot_reg) - (char *)&interpreter->ctx.int_reg.registers[0])) + (((char *)Parrot_reg) - (char *)®ISTER_INT[0])) #define emit_ldq_b(pc, Ra, addr, Rb) \ emit_mem(pc, LDQ, Ra, Rb, addr) diff -ur ../old/jit/arm/jit_emit.h ./jit/arm/jit_emit.h --- ../old/jit/arm/jit_emit.h Tue Feb 25 11:00:13 2003 +++ ./jit/arm/jit_emit.h Thu Jun 5 17:14:59 2003 @@ -653,8 +653,7 @@ switch(op_type){ case PARROT_ARG_I: - offset = ((char *)&interpreter->ctx.int_reg.registers[val]) - - (char *)interpreter; + offset = ((char *)®ISTER_INT[val]) - (char *)interpreter; if (offset > 4095) { internal_exception(JIT_ERROR, "integer load register %d generates offset %d, larger than 4095\n", @@ -696,8 +695,7 @@ switch(op_type){ case PARROT_ARG_I: - offset = ((char *)&interpreter->ctx.int_reg.registers[val]) - - (char *)interpreter; + offset = ((char *)®ISTER_INT[val]) - (char *)interpreter; if (offset > 4095) { internal_exception(JIT_ERROR, "integer store register %d generates offset %d, larger than 4095\n", diff -ur ../old/jit/i386/jit_emit.h ./jit/i386/jit_emit.h --- ../old/jit/i386/jit_emit.h Sat May 24 19:00:23 2003 +++ ./jit/i386/jit_emit.h Thu Jun 5 17:17:19 2003 @@ -1408,7 +1408,7 @@ jit_emit_fload_m_i(pc, i); \ emitm_fstp((pc), (r+1)); \ } -/* NUM_REG(i) <= INT_CONST */ +/* NUM_REG <= INT_CONST */ # define jit_emit_mov_mi_ni(pc, mem, i) { \ jit_emit_fload_m_i(pc, i); \ jit_emit_fstore_m_n(pc, mem); \ @@ -1842,19 +1842,6 @@ jit_emit_finit(jit_info->native_ptr); } -# if !defined(INT_REG) -# define INT_REG(x) interpreter->ctx.int_reg.registers[x] -# endif -# if !defined(NUM_REG) -# define NUM_REG(x) interpreter->ctx.num_reg.registers[x] -# endif -# if !defined(STR_REG) -# define STR_REG(x) interpreter->ctx.string_reg.registers[x] -# endif -# if !defined(PMC_REG) -# define PMC_REG(x) interpreter->ctx.pmc_reg.registers[x] -# endif - static void call_func(Parrot_jit_info_t *jit_info, void *addr) { Parrot_jit_newfixup(jit_info); @@ -1925,13 +1912,13 @@ switch (op_info->types[i]) { case PARROT_ARG_S: jit_emit_mov_rm_i(jit_info->native_ptr, emit_EAX, - &STR_REG(p[i])); + ®ISTER_STR[p[i]]); emitm_pushl_r(jit_info->native_ptr, emit_EAX); break; case PARROT_ARG_K: case PARROT_ARG_P: jit_emit_mov_rm_i(jit_info->native_ptr, emit_EAX, - &PMC_REG(p[i])); + ®ISTER_PMC[p[i]]); /* push $i, the left most Pi stays in eax, which is used * below, to call the vtable method */ @@ -1942,15 +1929,15 @@ emitm_pushl_r(jit_info->native_ptr, MAP(i)); else { jit_emit_mov_rm_i(jit_info->native_ptr, emit_EAX, - &INT_REG(p[i])); + ®ISTER_INT[p[i]]); emitm_pushl_r(jit_info->native_ptr, emit_EAX); } break; case PARROT_ARG_KI: if (MAP(i)) - jit_emit_mov_mr_i(jit_info->native_ptr, &INT_REG(p[i]), - MAP(i)); - emitm_pushl_i(jit_info->native_ptr, &INT_REG(p[i])); + jit_emit_mov_mr_i(jit_info->native_ptr, + ®ISTER_INT[p[i]], MAP(i)); + emitm_pushl_i(jit_info->native_ptr, ®ISTER_INT[p[i]]); break; case PARROT_ARG_KIC: /* XXX INTVAL_SIZE, make auto var, push address */ @@ -1972,7 +1959,8 @@ emitm_fld(jit_info->native_ptr, MAP(i)); } else - jit_emit_fload_m_n(jit_info->native_ptr, &NUM_REG(p[i])); + jit_emit_fload_m_n(jit_info->native_ptr, + ®ISTER_NUM[p[i]]); goto store; case PARROT_ARG_NC: jit_emit_fload_m_n(jit_info->native_ptr, @@ -2005,8 +1993,8 @@ for (j = 0; j < ru[0].registers_used; j++) { int us = ru[0].reg_usage[j]; jit_emit_mov_mr_i(jit_info->native_ptr, - &INT_REG(us), - jit_info->intval_map[j]); + ®ISTER_INT[us], + jit_info->intval_map[j]); } emitm_pushl_i(jit_info->native_ptr, @@ -2055,20 +2043,23 @@ jit_emit_mov_rr_i(jit_info->native_ptr, MAP(1), emit_EAX); } else - jit_emit_mov_mr_i(jit_info->native_ptr, &INT_REG(p1), emit_EAX); + jit_emit_mov_mr_i(jit_info->native_ptr, ®ISTER_INT[p1], + emit_EAX); break; case PARROT_ARG_S: - jit_emit_mov_mr_i(jit_info->native_ptr, &STR_REG(p1), emit_EAX); + jit_emit_mov_mr_i(jit_info->native_ptr, ®ISTER_STR[p1], + emit_EAX); break; case PARROT_ARG_P: - jit_emit_mov_mr_i(jit_info->native_ptr, &PMC_REG(p1), emit_EAX); + jit_emit_mov_mr_i(jit_info->native_ptr, ®ISTER_PMC[p1], + emit_EAX); break; case PARROT_ARG_N: if (MAP(1)) { emitm_fstp(jit_info->native_ptr, (1 + MAP(1))); } else - jit_emit_fstore_m_n(jit_info->native_ptr, &NUM_REG(p1)); + jit_emit_fstore_m_n(jit_info->native_ptr, ®ISTER_NUM[p1]); break; default: internal_exception(1, "jit_vtable1r: ill LHS"); @@ -2267,7 +2258,7 @@ call_func(jit_info, (void (*)(void))pmc_new_noinit); /* result = eax = PMC */ jit_emit_mov_mr_i(jit_info->native_ptr, - &interpreter->ctx.pmc_reg.registers[p1], emit_EAX); + ®ISTER_PMC[p1], emit_EAX); emitm_pushl_r(jit_info->native_ptr, emit_EAX); /* push interpreter */ emitm_pushl_i(jit_info->native_ptr, interpreter); @@ -2542,7 +2533,7 @@ case 'f': /* get a double from next num reg and push it on stack */ jit_emit_fload_m_n(pc, - &NUM_REG(count_regs(sig, signature->strstart))); + ®ISTER_NUM[count_regs(sig, signature->strstart)]); /* make room for float */ emitm_addb_i_r(pc, -4, emit_ESP); emitm_fstps(pc, emit_ESP, emit_None, 1, 0); @@ -2550,7 +2541,7 @@ case 'd': /* get a double from next num reg and push it on stack */ jit_emit_fload_m_n(pc, - &NUM_REG(count_regs(sig, signature->strstart))); + ®ISTER_NUM[count_regs(sig, signature->strstart)]); /* make room for double */ emitm_addb_i_r(pc, -8, emit_ESP); emitm_fstpl(pc, emit_ESP, emit_None, 1, 0); @@ -2559,17 +2550,17 @@ case 'l': /* long */ case 'i': /* int */ jit_emit_mov_rm_i(pc, emit_EAX, - &INT_REG(count_regs(sig, signature->strstart))); + ®ISTER_INT[count_regs(sig, signature->strstart)]); emitm_pushl_r(pc, emit_EAX); break; case 's': /* short: movswl intreg, %eax */ emitm_movswl_r_m(pc, emit_EAX, 0, 0, 1, - &INT_REG(count_regs(sig, signature->strstart))); + ®ISTER_INT[count_regs(sig, signature->strstart)]); emitm_pushl_r(pc, emit_EAX); break; case 'c': /* char: movsbl intreg, %eax */ emitm_movsbl_r_m(pc, emit_EAX, 0, 0, 1, - &INT_REG(count_regs(sig, signature->strstart))); + ®ISTER_INT[count_regs(sig, signature->strstart)]); emitm_pushl_r(pc, emit_EAX); break; case 'p': /* push pmc->data */ @@ -2578,7 +2569,7 @@ * push %eax */ jit_emit_mov_rm_i(pc, emit_EDX, - &PMC_REG(count_regs(sig, signature->strstart))); + ®ISTER_PMC[count_regs(sig, signature->strstart)]); emitm_movl_m_r(pc, emit_EAX, emit_EDX, 0, 1, offsetof(struct PMC, data)); emitm_pushl_r(pc, emit_EAX); @@ -2588,7 +2579,7 @@ break; case 't': /* string, pass a cstring */ jit_emit_mov_rm_i(pc, emit_EAX, - &STR_REG(count_regs(sig, signature->strstart))); + ®ISTER_STR[count_regs(sig, signature->strstart)]); emitm_pushl_r(pc, emit_EAX); emitm_pushl_i(pc, interpreter); emitm_calll(pc, (char*)string_to_cstring - pc - 4); @@ -2622,21 +2613,21 @@ case 'f': case 'd': /* pop num from st(0) and mov to reg */ - jit_emit_fstore_m_n(pc, &NUM_REG(next_n++)); + jit_emit_fstore_m_n(pc, ®ISTER_NUM[next_n++]); break; case 's': /* movswl %ax, %edx */ emitm_movswl_r_r(pc, emit_EDX, emit_EAX); - jit_emit_mov_mr_i(pc, &INT_REG(next_i++), emit_EDX); + jit_emit_mov_mr_i(pc, ®ISTER_INT[next_i++], emit_EDX); break; case 'c': /* movsbl %al, %edx */ emitm_movsbl_r_r(pc, emit_EDX, emit_EAX); - jit_emit_mov_mr_i(pc, &INT_REG(next_i++), emit_EDX); + jit_emit_mov_mr_i(pc, ®ISTER_INT[next_i++], emit_EDX); break; case 'l': case 'i': - jit_emit_mov_mr_i(pc, &INT_REG(next_i++), emit_EAX); + jit_emit_mov_mr_i(pc, ®ISTER_INT[next_i++], emit_EAX); /* fall through */ case 'v': /* void - do nothing */ break; @@ -2653,7 +2644,7 @@ /* stuff return value into pmc->data */ emitm_movl_r_m(pc, emit_EDX, emit_EAX, 0, 1, offsetof(struct PMC, data)); - jit_emit_mov_mr_i(pc, &PMC_REG(next_p++), emit_EAX); + jit_emit_mov_mr_i(pc, ®ISTER_PMC[next_p++], emit_EAX); break; case 't': /* string, determine length, make string */ emitm_pushl_i(pc, 0); @@ -2667,7 +2658,7 @@ emitm_pushl_i(pc, interpreter); emitm_calll(pc, (char*)string_make - pc - 4); emitm_addb_i_r(pc, 24, emit_ESP); - jit_emit_mov_mr_i(pc, &STR_REG(next_s++), emit_EAX); + jit_emit_mov_mr_i(pc, ®ISTER_STR[next_s++], emit_EAX); break; default: internal_exception(1, @@ -2675,12 +2666,12 @@ break; } /* set return values passed on stack */ - jit_emit_mov_mi_i(pc, &INT_REG(0), 0); + jit_emit_mov_mi_i(pc, ®ISTER_INT[0], 0); /* set return values in I,S,P,N regs */ - jit_emit_mov_mi_i(pc, &INT_REG(1), next_i-5); - jit_emit_mov_mi_i(pc, &INT_REG(2), next_s-5); - jit_emit_mov_mi_i(pc, &INT_REG(3), next_p-5); - jit_emit_mov_mi_i(pc, &INT_REG(4), next_n-5); + jit_emit_mov_mi_i(pc, ®ISTER_INT[1], next_i-5); + jit_emit_mov_mi_i(pc, ®ISTER_INT[2], next_s-5); + jit_emit_mov_mi_i(pc, ®ISTER_INT[3], next_p-5); + jit_emit_mov_mi_i(pc, ®ISTER_INT[4], next_n-5); jit_emit_stack_frame_leave(pc); emitm_ret(pc); diff -ur ../old/jit/ppc/jit_emit.h ./jit/ppc/jit_emit.h --- ../old/jit/ppc/jit_emit.h Tue May 27 03:00:50 2003 +++ ./jit/ppc/jit_emit.h Thu Jun 5 17:00:40 2003 @@ -396,11 +396,11 @@ # define jit_emit_mov_rm_i(pc, reg, addr) \ jit_emit_lwz(pc, reg, (((char *)addr) - \ - ((char *)&interpreter->ctx.int_reg.registers[0])), r13) + ((char *)®ISTER_INT[0])), r13) # define jit_emit_mov_rm_n(pc, reg, addr) \ jit_emit_lfd(pc, reg, (((char *)addr) - \ - ((char *)&interpreter->ctx.int_reg.registers[0])), r13) + ((char *)®ISTER_INT[0])), r13) /* compare operation. * @@ -535,11 +535,11 @@ # define jit_emit_mov_mr_i(pc, addr, reg) \ jit_emit_stw(pc, reg, (((char *)addr) - \ - ((char *)&interpreter->ctx.int_reg.registers[0])), r13) + ((char *)®ISTER_INT[0])), r13) # define jit_emit_mov_mr_n(pc, addr, reg) \ jit_emit_stfd(pc, reg, (((char *)addr) - \ - ((char *)&interpreter->ctx.int_reg.registers[0])), r13) + ((char *)®ISTER_INT[0])), r13) /* * Load a 32-bit immediate value. If the lower 16 bits are bigger than diff -ur ../old/jit/sun4/jit_emit.h ./jit/sun4/jit_emit.h --- ../old/jit/sun4/jit_emit.h Sat Mar 8 11:00:19 2003 +++ ./jit/sun4/jit_emit.h Thu Jun 5 17:00:40 2003 @@ -420,25 +420,25 @@ break; case PARROT_ARG_I: - val = (int)&interpreter->ctx.int_reg.registers[val]; + val = (int)®ISTER_INT[val]; emitm_ld_i(jit_info->native_ptr, Parrot_jit_regbase, Parrot_jit_regoff(val, interpreter), hwreg); break; case PARROT_ARG_P: - val = (int)&interpreter->ctx.pmc_reg.registers[val]; + val = (int)®ISTER_PMC[val]; emitm_ld_i(jit_info->native_ptr, Parrot_jit_regbase, Parrot_jit_regoff(val, interpreter), hwreg); break; case PARROT_ARG_S: - val = (int)&interpreter->ctx.string_reg.registers[val]; + val = (int)®ISTER_STR[val]; emitm_ld_i(jit_info->native_ptr, Parrot_jit_regbase, Parrot_jit_regoff(val, interpreter), hwreg); break; case PARROT_ARG_N: - val = (int)&interpreter->ctx.num_reg.registers[val]; + val = (int)®ISTER_NUM[val]; emitm_ldd_i(jit_info->native_ptr, Parrot_jit_regbase, Parrot_jit_regoff(val, interpreter), hwreg); break; @@ -463,25 +463,25 @@ switch(op_type){ case PARROT_ARG_I: - val = (int)&interpreter->ctx.int_reg.registers[val]; + val = (int)®ISTER_INT[val]; emitm_st_i(jit_info->native_ptr, hwreg, Parrot_jit_regbase, Parrot_jit_regoff(val, interpreter)); break; case PARROT_ARG_P: - val = (int)&interpreter->ctx.pmc_reg.registers[val]; + val = (int)®ISTER_PMC[val]; emitm_st_i(jit_info->native_ptr, hwreg, Parrot_jit_regbase, Parrot_jit_regoff(val, interpreter)); break; case PARROT_ARG_S: - val = (int)&interpreter->ctx.string_reg.registers[val]; + val = (int)®ISTER_STR[val]; emitm_st_i(jit_info->native_ptr, hwreg, Parrot_jit_regbase, Parrot_jit_regoff(val, interpreter)); break; case PARROT_ARG_N: - val = (int)&interpreter->ctx.num_reg.registers[val]; + val = (int)®ISTER_NUM[val]; emitm_std_i(jit_info->native_ptr, hwreg, Parrot_jit_regbase, Parrot_jit_regoff(val, interpreter)); break; @@ -523,13 +523,13 @@ break; case PARROT_ARG_I: - val = (int)&interpreter->ctx.int_reg.registers[val]; + val = (int)®ISTER_INT[val]; emitm_ldf_i(jit_info->native_ptr, Parrot_jit_regbase, Parrot_jit_regoff(val, interpreter), hwreg); break; case PARROT_ARG_N: - val = (int)&interpreter->ctx.num_reg.registers[val]; + val = (int)®ISTER_NUM[val]; emitm_lddf_i(jit_info->native_ptr, Parrot_jit_regbase, Parrot_jit_regoff(val, interpreter), hwreg); break; @@ -553,13 +553,13 @@ switch(op_type){ case PARROT_ARG_I: - val = (int)&interpreter->ctx.int_reg.registers[val]; + val = (int)®ISTER_INT[val]; emitm_stf_i(jit_info->native_ptr, hwreg, Parrot_jit_regbase, Parrot_jit_regoff(val, interpreter)); break; case PARROT_ARG_N: - val = (int)&interpreter->ctx.num_reg.registers[val]; + val = (int)®ISTER_NUM[val]; emitm_stdf_i(jit_info->native_ptr, hwreg, Parrot_jit_regbase, Parrot_jit_regoff(val, interpreter)); break; diff -ur ../old/jit.c ./jit.c --- ../old/jit.c Sun Jun 1 03:00:14 2003 +++ ./jit.c Thu Jun 5 17:00:40 2003 @@ -770,9 +770,9 @@ { switch (typ) { case 0: - return (char*)&interpreter->ctx.int_reg.registers[i]; + return (char*)®ISTER_INT[i]; case 3: - return (char*)&interpreter->ctx.num_reg.registers[i]; + return (char*)®ISTER_NUM[i]; default: return 0; /* not currently */ } diff -ur ../old/jit2h.pl ./jit2h.pl --- ../old/jit2h.pl Sun Feb 23 11:00:14 2003 +++ ./jit2h.pl Thu Jun 5 17:00:40 2003 @@ -173,10 +173,10 @@ #include"parrot/jit_emit.h" #undef CONST -#define IREG(i) interpreter->ctx.int_reg.registers[jit_info->cur_op[i]] -#define NREG(i) interpreter->ctx.num_reg.registers[jit_info->cur_op[i]] -#define PREG(i) interpreter->ctx.pmc_reg.registers[jit_info->cur_op[i]] -#define SREG(i) interpreter->ctx.string_reg.registers[jit_info->cur_op[i]] +#define IREG(i) REGISTER_INT[jit_info->cur_op[i]] +#define NREG(i) REGISTER_NUM[jit_info->cur_op[i]] +#define PREG(i) REGISTER_PMC[jit_info->cur_op[i]] +#define SREG(i) REGISTER_STR[jit_info->cur_op[i]] #define CONST(i) interpreter->code->const_table->constants[jit_info->cur_op[i]] #ifndef MAP # define MAP(i) jit_info->optimizer->map_branch[jit_info->op_i + (i)] diff -ur ../old/jit_debug.c ./jit_debug.c --- ../old/jit_debug.c Sun Jun 1 03:00:14 2003 +++ ./jit_debug.c Thu Jun 5 17:00:40 2003 @@ -187,13 +187,13 @@ /* fake static var stabs */ for (i = 0; i < NUM_REGISTERS; i++) { fprintf(stabs, ".stabs \"I%d:S(0,12)\"," N_STSYM ",0,0,%p\n", i, - (char*)&interpreter->ctx.int_reg.registers[i]); + (char*)®ISTER_INT[i]); fprintf(stabs, ".stabs \"N%d:S(0,13)\"," N_STSYM ",0,0,%p\n", i, - (char*)&interpreter->ctx.num_reg.registers[i]); + (char*)®ISTER_NUM[i]); fprintf(stabs, ".stabs \"S%d:S(0,16)\"," N_STSYM ",0,0,%p\n", i, - (char*)&interpreter->ctx.string_reg.registers[i]); + (char*)®ISTER_STR[i]); fprintf(stabs, ".stabs \"P%d:S*(0,18)\"," N_STSYM ",0,0,%p\n", i, - (char*)&interpreter->ctx.pmc_reg.registers[i]); + (char*)®ISTER_PMC[i]); } } diff -ur ../old/key.c ./key.c --- ../old/key.c Mon May 19 11:00:03 2003 +++ ./key.c Thu Jun 5 17:00:40 2003 @@ -136,12 +136,12 @@ case KEY_integer_FLAG: return key->cache.int_val; case KEY_integer_FLAG | KEY_register_FLAG: - return interpreter->ctx.int_reg.registers[key->cache.int_val]; + return REGISTER_INT[key->cache.int_val]; case KEY_pmc_FLAG: return VTABLE_get_integer(interpreter, key->cache.pmc_val); case KEY_pmc_FLAG | KEY_register_FLAG: - reg = interpreter->ctx.pmc_reg.registers[key->cache.int_val]; + reg = REGISTER_PMC[key->cache.int_val]; return VTABLE_get_integer(interpreter, reg); default: internal_exception(INVALID_OPERATION, "Key not an integer!\n"); @@ -158,12 +158,12 @@ case KEY_number_FLAG: return key->cache.num_val; case KEY_number_FLAG | KEY_register_FLAG: - return interpreter->ctx.num_reg.registers[key->cache.int_val]; + return REGISTER_NUM[key->cache.int_val]; case KEY_pmc_FLAG: return VTABLE_get_number(interpreter, key->cache.pmc_val); case KEY_pmc_FLAG | KEY_register_FLAG: - reg = interpreter->ctx.pmc_reg.registers[key->cache.int_val]; + reg = REGISTER_PMC[key->cache.int_val]; return VTABLE_get_number(interpreter, reg); default: internal_exception(INVALID_OPERATION, "Key not a number!\n"); @@ -180,12 +180,12 @@ case KEY_string_FLAG: return key->cache.string_val; case KEY_string_FLAG | KEY_register_FLAG: - return interpreter->ctx.string_reg.registers[key->cache.int_val]; + return REGISTER_STR[key->cache.int_val]; case KEY_pmc_FLAG: return VTABLE_get_string(interpreter, key->cache.pmc_val); case KEY_pmc_FLAG | KEY_register_FLAG: - reg = interpreter->ctx.pmc_reg.registers[key->cache.int_val]; + reg = REGISTER_PMC[key->cache.int_val]; return VTABLE_get_string(interpreter, reg); default: internal_exception(INVALID_OPERATION, "Key not a string!\n"); @@ -200,7 +200,7 @@ case KEY_pmc_FLAG: return key->cache.pmc_val; case KEY_pmc_FLAG | KEY_register_FLAG: - return interpreter->ctx.pmc_reg.registers[key->cache.int_val]; + return REGISTER_PMC[key->cache.int_val]; default: internal_exception(INVALID_OPERATION, "Key not a PMC!\n"); return 0; diff -ur ../old/languages/imcc/optimizer.c ./languages/imcc/optimizer.c --- ../old/languages/imcc/optimizer.c Wed Jun 4 11:00:26 2003 +++ ./languages/imcc/optimizer.c Thu Jun 5 17:00:40 2003 @@ -468,11 +468,11 @@ if (i > 1) { /* fill source regs */ switch (ins->r[i-1]->set) { case 'I': - interpreter->ctx.int_reg.registers[i-1] = + REGISTER_INT[i-1] = (INTVAL)atoi(ins->r[i-1]->name); break; case 'N': - interpreter->ctx.num_reg.registers[i-1] = + REGISTER_NUM[i-1] = (FLOATVAL)atof(ins->r[i-1]->name); break; } diff -ur ../old/lib/Parrot/OpTrans/C.pm ./lib/Parrot/OpTrans/C.pm --- ../old/lib/Parrot/OpTrans/C.pm Tue Jan 21 11:00:17 2003 +++ ./lib/Parrot/OpTrans/C.pm Thu Jun 5 17:00:40 2003 @@ -24,10 +24,10 @@ #undef CONST #define REL_PC ((size_t)(cur_opcode - interpreter->code->byte_code)) #define CUR_OPCODE cur_opcode -#define IREG(i) interpreter->ctx.int_reg.registers[cur_opcode[i]] -#define NREG(i) interpreter->ctx.num_reg.registers[cur_opcode[i]] -#define PREG(i) interpreter->ctx.pmc_reg.registers[cur_opcode[i]] -#define SREG(i) interpreter->ctx.string_reg.registers[cur_opcode[i]] +#define IREG(i) REGISTER_INT[cur_opcode[i]] +#define NREG(i) REGISTER_NUM[cur_opcode[i]] +#define PREG(i) REGISTER_PMC[cur_opcode[i]] +#define SREG(i) REGISTER_STR[cur_opcode[i]] #define CONST(i) interpreter->code->const_table->constants[cur_opcode[i]] END } diff -ur ../old/lib/Parrot/OpTrans/CGoto.pm ./lib/Parrot/OpTrans/CGoto.pm --- ../old/lib/Parrot/OpTrans/CGoto.pm Fri Feb 7 11:00:12 2003 +++ ./lib/Parrot/OpTrans/CGoto.pm Thu Jun 5 17:00:40 2003 @@ -21,10 +21,10 @@ #undef CONST #define REL_PC ((size_t)(cur_opcode - interpreter->code->byte_code)) #define CUR_OPCODE cur_opcode -#define IREG(i) interpreter->ctx.int_reg.registers[cur_opcode[i]] -#define NREG(i) interpreter->ctx.num_reg.registers[cur_opcode[i]] -#define PREG(i) interpreter->ctx.pmc_reg.registers[cur_opcode[i]] -#define SREG(i) interpreter->ctx.string_reg.registers[cur_opcode[i]] +#define IREG(i) REGISTER_INT[cur_opcode[i]] +#define NREG(i) REGISTER_NUM[cur_opcode[i]] +#define PREG(i) REGISTER_PMC[cur_opcode[i]] +#define SREG(i) REGISTER_STR[cur_opcode[i]] #define CONST(i) interpreter->code->const_table->constants[cur_opcode[i]] END } diff -ur ../old/lib/Parrot/OpTrans/Compiled.pm ./lib/Parrot/OpTrans/Compiled.pm --- ../old/lib/Parrot/OpTrans/Compiled.pm Wed Feb 26 19:00:07 2003 +++ ./lib/Parrot/OpTrans/Compiled.pm Thu Jun 5 17:00:40 2003 @@ -17,10 +17,10 @@ { return <<END; #define REL_PC (cur_opcode - start_code) -#define IREG(i) interpreter->ctx.int_reg.registers[i] -#define NREG(i) interpreter->ctx.num_reg.registers[i] -#define PREG(i) interpreter->ctx.pmc_reg.registers[i] -#define SREG(i) interpreter->ctx.string_reg.registers[i] +#define IREG(i) REGISTER_INT[i] +#define NREG(i) REGISTER_NUM[i] +#define PREG(i) REGISTER_PMC[i] +#define SREG(i) REGISTER_STR[i] #define CONST(i) interpreter->code->const_table->constants[i] END } diff -ur ../old/method_util.c ./method_util.c --- ../old/method_util.c Mon May 19 11:00:03 2003 +++ ./method_util.c Thu Jun 5 17:09:26 2003 @@ -22,9 +22,9 @@ * */ PMC * -Parrot_new_csub(struct Parrot_Interp *interp, Parrot_csub_t func) +Parrot_new_csub(struct Parrot_Interp *interpreter, Parrot_csub_t func) { - PMC *ret = pmc_new(interp, enum_class_CSub); + PMC *ret = pmc_new(interpreter, enum_class_CSub); ret->cache.struct_val = (DPOINTER *)F2DPTR(func); return ret; } @@ -33,12 +33,12 @@ * Push non-prototyped arguments. */ void -Parrot_push_argv(struct Parrot_Interp *interp, INTVAL argc, PMC *argv[]) +Parrot_push_argv(struct Parrot_Interp *interpreter, INTVAL argc, PMC *argv[]) { - interp->ctx.int_reg.registers[0] = 0; /* no prototype */ - interp->ctx.int_reg.registers[1] = argc; + REGISTER_INT[0] = 0; /* no prototype */ + REGISTER_INT[1] = argc; while (argc--) { - stack_push(interp, &(interp->ctx.user_stack), argv[argc], + stack_push(interpreter, &(interpreter->ctx.user_stack), argv[argc], STACK_ENTRY_PMC, STACK_CLEANUP_NULL); } } @@ -47,15 +47,15 @@ * Pop non-prototyped arguments. */ INTVAL -Parrot_pop_argv(struct Parrot_Interp *interp, PMC ***argv) +Parrot_pop_argv(struct Parrot_Interp *interpreter, PMC ***argv) { INTVAL i; - INTVAL nret = interp->ctx.int_reg.registers[1]; + INTVAL nret = REGISTER_INT[1]; /* NOTE: not using GC'd memory -- free this yourself. */ *argv = (PMC **)mem_sys_allocate(nret * sizeof(PMC *)); for (i = 0; i < nret; i++) { - stack_pop(interp, &(interp->ctx.user_stack), &((*argv)[i]), + stack_pop(interpreter, &(interpreter->ctx.user_stack), &((*argv)[i]), STACK_ENTRY_PMC); } return nret; @@ -79,31 +79,31 @@ * Push prototyped arguments. */ void -Parrot_push_proto(struct Parrot_Interp *interp, +Parrot_push_proto(struct Parrot_Interp *interpreter, INTVAL intc, INTVAL *intv, INTVAL numc, FLOATVAL *numv, INTVAL strc, STRING **strv, INTVAL pmcc, PMC **pmcv) { int npush; /* overflow params */ - interp->ctx.int_reg.registers[0] = 1; /* with proto */ + REGISTER_INT[0] = 1; /* with proto */ npush = 0; - push_these(npush, interp, interp->ctx.int_reg.registers, intc, intv[i], + push_these(npush, interpreter, REGISTER_INT, intc, intv[i], &(intv[i]), STACK_ENTRY_INT); - push_these(npush, interp, interp->ctx.num_reg.registers, numc, numv[i], + push_these(npush, interpreter, REGISTER_NUM, numc, numv[i], &(numv[i]), STACK_ENTRY_FLOAT); - push_these(npush, interp, interp->ctx.string_reg.registers, strc, + push_these(npush, interpreter, REGISTER_STR, strc, strv[i], strv[i], STACK_ENTRY_STRING); - push_these(npush, interp, interp->ctx.pmc_reg.registers, pmcc, + push_these(npush, interpreter, REGISTER_PMC, pmcc, pmcv[i], pmcv[i], STACK_ENTRY_PMC); - interp->ctx.int_reg.registers[1] = npush; + REGISTER_INT[1] = npush; } /* * Initialize a method stash. */ void -Parrot_init_stash(struct Parrot_Interp *interp, struct method_rec_t *recp, +Parrot_init_stash(struct Parrot_Interp *interpreter, struct method_rec_t *recp, struct Stash *stash) { PMC *k; @@ -112,14 +112,14 @@ if (hash != NULL) return; - k = key_new(interp); - stash->stash_hash = hash = pmc_new(interp, enum_class_PerlHash); + k = key_new(interpreter); + stash->stash_hash = hash = pmc_new(interpreter, enum_class_PerlHash); while (recp->name != NULL) { - PMC *csub = Parrot_new_csub(interp, recp->sub); - STRING *name = string_make(interp, recp->name, strlen(recp->name), + PMC *csub = Parrot_new_csub(interpreter, recp->sub); + STRING *name = string_make(interpreter, recp->name, strlen(recp->name), NULL, 0, NULL); - key_set_string(interp, k, name); - VTABLE_set_pmc_keyed(interp, hash, NULL, csub, k); + key_set_string(interpreter, k, name); + VTABLE_set_pmc_keyed(interpreter, hash, NULL, csub, k); ++recp; } } @@ -128,12 +128,12 @@ * Lookup a method in a method stash. */ PMC * -Parrot_find_method(struct Parrot_Interp *interp, struct Stash *stash, PMC *key) +Parrot_find_method(struct Parrot_Interp *interpreter, struct Stash *stash, + PMC *key) { while (stash) { PMC *meth = - VTABLE_get_pmc_keyed(interp, stash->stash_hash, - key); + VTABLE_get_pmc_keyed(interpreter, stash->stash_hash, key); if (meth) return meth; stash = stash->parent_stash; @@ -145,8 +145,7 @@ * Mark entries in a stack structure during GC. */ void -mark_stack(struct Parrot_Interp *interpreter, - Stack_Chunk_t *cur_stack) +mark_stack(struct Parrot_Interp *interpreter, Stack_Chunk_t *cur_stack) { Stack_Entry_t *entry; size_t i; diff -ur ../old/ops2cgc.pl ./ops2cgc.pl --- ../old/ops2cgc.pl Mon Nov 4 06:17:08 2002 +++ ./ops2cgc.pl Thu Jun 5 17:00:40 2003 @@ -196,10 +196,10 @@ my %arg_maps = ( 'op' => "cur_opcode[%ld]", - 'i' => "interpreter->ctx.int_reg->registers[cur_opcode[%ld]]", - 'n' => "interpreter->ctx.num_reg->registers[cur_opcode[%ld]]", - 'p' => "interpreter->ctx.pmc_reg->registers[cur_opcode[%ld]]", - 's' => "interpreter->ctx.string_reg->registers[cur_opcode[%ld]]", + 'i' => "REGISTER_INT[cur_opcode[%ld]]", + 'n' => "REGISTER_NUM[cur_opcode[%ld]]", + 'p' => "REGISTER_PMC[cur_opcode[%ld]]", + 's' => "REGISTER_STR[cur_opcode[%ld]]", 'ic' => "cur_opcode[%ld]", 'nc' => "interpreter->code->const_table->constants[cur_opcode[%ld]]->number", diff -ur ../old/pbc2c.pl ./pbc2c.pl --- ../old/pbc2c.pl Mon Feb 3 11:00:17 2003 +++ ./pbc2c.pl Thu Jun 5 17:00:40 2003 @@ -245,7 +245,7 @@ /* setup P0, stolen from embed.c */ userargv = pmc_new(interpreter, enum_class_PerlArray); /* immediately anchor pmc to root set */ - interpreter->ctx.pmc_reg.registers[0] = userargv; + REGISTER_PMC[0] = userargv; for (i = 0; i < argc; i++) { /* Run through argv, adding everything to @ARGS. */ diff -ur ../old/register.c ./register.c --- ../old/register.c Thu May 22 03:00:21 2003 +++ ./register.c Thu Jun 5 17:00:40 2003 @@ -89,7 +89,7 @@ /* Do we even have anything? */ if (top->used > 0) { top->used--; - memcpy(&interpreter->ctx.int_reg.registers[NUM_REGISTERS/2], + memcpy(®ISTER_INT[NUM_REGISTERS/2], &top->IReg[top->used].registers[NUM_REGISTERS/2], sizeof(struct IReg)/2); top->free++; @@ -120,7 +120,7 @@ { int i; for (i = 0; i < NUM_REGISTERS; i++) { - interpreter->ctx.int_reg.registers[i] = 0; + REGISTER_INT[i] = 0; } } @@ -201,7 +201,7 @@ /* Do we even have anything? */ if (top->used > 0) { top->used--; - memcpy(&interpreter->ctx.string_reg.registers[NUM_REGISTERS/2], + memcpy(®ISTER_STR[NUM_REGISTERS/2], &top->SReg[top->used].registers[NUM_REGISTERS/2], sizeof(struct SReg)/2); top->free++; @@ -232,7 +232,7 @@ { int i; for (i = 0; i < NUM_REGISTERS; i++) { - interpreter->ctx.string_reg.registers[i] = NULL; + REGISTER_STR[i] = NULL; } } @@ -313,7 +313,7 @@ /* Do we even have anything? */ if (top->used > 0) { top->used--; - memcpy(&interpreter->ctx.num_reg.registers[NUM_REGISTERS/2], + memcpy(®ISTER_NUM[NUM_REGISTERS/2], &top->NReg[top->used].registers[NUM_REGISTERS/2], sizeof(struct NReg)/2); top->free++; @@ -344,7 +344,7 @@ { int i; for (i = 0; i < NUM_REGISTERS; i++) { - interpreter->ctx.num_reg.registers[i] = 0.0; + REGISTER_NUM[i] = 0.0; } } @@ -425,7 +425,7 @@ /* Do we even have anything? */ if (top->used > 0) { top->used--; - memcpy(&interpreter->ctx.pmc_reg.registers[NUM_REGISTERS/2], + memcpy(®ISTER_PMC[NUM_REGISTERS/2], &top->PReg[top->used].registers[NUM_REGISTERS/2], sizeof(struct PReg)/2); top->free++; @@ -456,7 +456,7 @@ { int i; for (i = 0; i < NUM_REGISTERS; i++) { - interpreter->ctx.pmc_reg.registers[i] = NULL; + REGISTER_PMC[i] = NULL; } } diff -ur ../old/trace.c ./trace.c --- ../old/trace.c Mon May 19 11:00:03 2003 +++ ./trace.c Thu Jun 5 17:11:43 2003 @@ -80,14 +80,14 @@ break; case KEY_integer_FLAG|KEY_register_FLAG: PIO_eprintf(interpreter, "I%vd=%vd", key->cache.int_val, - interpreter->ctx.int_reg.registers[key->cache.int_val]); + REGISTER_INT[key->cache.int_val]); break; case KEY_number_FLAG|KEY_register_FLAG: PIO_eprintf(interpreter, "I%vd=%vd", key->cache.int_val, - interpreter->ctx.num_reg.registers[key->cache.int_val]); + REGISTER_NUM[key->cache.int_val]); break; case KEY_string_FLAG|KEY_register_FLAG: - s = interpreter->ctx.string_reg.registers[key->cache.int_val]; + s = REGISTER_STR[key->cache.int_val]; escaped = PDB_escape(s->bufstart, s->strlen); PIO_eprintf(interpreter, "S%vd=\"%s\"", key->cache.int_val, escaped ? escaped : "(null"); @@ -96,7 +96,7 @@ break; case KEY_pmc_FLAG|KEY_register_FLAG: PIO_eprintf(interpreter, "P%vd=", key->cache.int_val); - trace_pmc_dump(interpreter, interpreter->ctx.pmc_reg.registers[key->cache.int_val]); + trace_pmc_dump(interpreter, REGISTER_PMC[key->cache.int_val]); break; default: PIO_eprintf(interpreter, "??"); @@ -161,11 +161,11 @@ break; case PARROT_ARG_I: PIO_eprintf(interpreter, "I%vd=%vd", *(pc + i), - interpreter->ctx.int_reg.registers[*(pc + i)]); + REGISTER_INT[*(pc + i)]); break; case PARROT_ARG_N: PIO_eprintf(interpreter, "N%vd=%vg", *(pc + i), - interpreter->ctx.num_reg.registers[*(pc + i)]); + REGISTER_NUM[*(pc + i)]); break; case PARROT_ARG_P: /* what does a PMC register look like? */ @@ -173,13 +173,13 @@ PARROT_ARGDIR_IN) { PIO_eprintf(interpreter, "P%vd=", *(pc + i)); trace_pmc_dump(interpreter, - interpreter->ctx.pmc_reg.registers[*(pc + i)]); + REGISTER_PMC[*(pc + i)]); } else PIO_eprintf(interpreter, "P%vd", *(pc + i)); break; case PARROT_ARG_S: - if (interpreter->ctx.string_reg.registers[*(pc + i)]) { + if (REGISTER_STR[*(pc + i)]) { escaped = PDB_escape(interpreter->ctx.string_reg. registers[*(pc + i)]->strstart, interpreter->ctx.string_reg. @@ -195,11 +195,11 @@ break; case PARROT_ARG_K: PIO_eprintf(interpreter, "P%vd=", *(pc + i)); - trace_key_dump(interpreter, interpreter->ctx.pmc_reg.registers[*(pc + i)]); + trace_key_dump(interpreter, REGISTER_PMC[*(pc + i)]); break; case PARROT_ARG_KI: PIO_eprintf(interpreter, "I%vd=[%vd]", *(pc + i), - interpreter->ctx.int_reg.registers[*(pc + i)]); + REGISTER_INT[*(pc + i)]); break; case PARROT_ARG_OP: /* this isn't handled, so at least report the error
diff -ur ../orig/languages/imcc/optimizer.c ./languages/imcc/optimizer.c --- ../orig/languages/imcc/optimizer.c Thu Jun 5 16:13:43 2003 +++ ./languages/imcc/optimizer.c Thu Jun 5 16:12:31 2003 @@ -493,7 +493,7 @@ * or abs_i_ic => set_i_ic */ static void -subst_constants(struct Parrot_Interp *interp) +subst_constants(struct Parrot_Interp *interpreter) { Instruction *ins, *tmp; const char *ops[] = { @@ -516,7 +516,7 @@ /* save interpreter ctx */ info(2, "\tsubst_constants\n"); ctx = mem_sys_allocate(sizeof(struct Parrot_Context)); - mem_sys_memcopy(ctx, &interp->ctx, sizeof(struct Parrot_Context)); + mem_sys_memcopy(ctx, &interpreter->ctx, sizeof(struct Parrot_Context)); /* construct a FLOATVAL_FMT with needed precision */ switch (NUMVAL_SIZE) { case 8: @@ -561,14 +561,14 @@ * separate context and make a constant * from the result */ - eval_ins(interp, ins, ins->opsize); + eval_ins(interpreter, ins, ins->opsize); /* result is in I0/N0 */ switch (ins->r[0]->set) { case 'I': - sprintf(b, INTVAL_FMT, interp->ctx.int_reg.registers[0]); + sprintf(b, INTVAL_FMT, REGISTER_INT[0]); break; case 'N': - sprintf(b, fmt, interp->ctx.num_reg.registers[0]); + sprintf(b, fmt, REGISTER_NUM[0]); break; } r = mk_const(str_dup(b), ins->r[0]->set); @@ -576,12 +576,12 @@ if (ins->opsize == 4) --ins->r[2]->use_count; ins->r[1] = r; - tmp = INS(interp, "set", "", ins->r, 2, 0, 0); + tmp = INS(interpreter, "set", "", ins->r, 2, 0, 0); debug(DEBUG_OPT1, "%s\n", ins_string(tmp)); subst_ins(ins, tmp, 1); ins = tmp; } - mem_sys_memcopy(&interp->ctx, ctx, sizeof(struct Parrot_Context)); + mem_sys_memcopy(&interpreter->ctx, ctx, sizeof(struct Parrot_Context)); mem_sys_free(ctx); }