This is a not-yet-suitable for applying patch that removes the dependency on an
external assembler and disassembler for Just-In-Time compiler support.  All
assembly is done at run-time via macros. This is sufficient to allow some
flexibility in instruction selection at run-time, but a lot more work would be
needed to enable real optimizations like register allocation etc.  I would like
to know if anyone would be interested in helping make this worthy of applying,
and if it works/does not work for anyone.

In its current form, it should work on :

1) Any x86 OS, with the notable inclusion of windows OSes using visual studio
tools.

2) Sparc systems using 32-bit Intvals (64 bit Intvals still do not work).
Systems where perl identifies the cpu as 'sun4' work without changes. Systems
where the cpu is identified as 'sparc' can get by with a symlink from jit/sparc
to jit/sun4.

I haven't touched the alpha jit, Daniel ?

-- 
Jason



-- 
Jason
diff --exclude=CVS -urN parrot/Configure.pl parrot-jit/Configure.pl
--- parrot/Configure.pl Tue Mar 19 17:53:57 2002
+++ parrot-jit/Configure.pl     Sun Mar 24 18:46:57 2002
@@ -151,12 +151,22 @@
     ($osname, $cpuarch) = ($cpuarch, "");
 }
 
+if($cpuarch =~ /MSWin32/){
+    $cpuarch = 'i386';
+    $osname = 'MSWin32';
+}
+if(($osname =~ /cygwin/i) || ($cpuarch =~ /cygwin/i)){
+    $cpuarch = 'i386';
+}
+
+$cpuarch                  =~ s/i[456]86/i386/i;
+$cpuarch                  =~ s/sparc/sun4/i;
 $jitarchname              =  "$cpuarch-$osname";
-$jitarchname                 =~ s/i[456]86/i386/i;
 $jitarchname              =~ s/-(net|free|open)bsd$/-bsd/i;
 $jitcapable               = 0;
 
-if (-e "lib/Parrot/Jit/$jitarchname.pm") {
+
+if (-e "jit/$cpuarch") {
     $jitcapable = 1;
 }
 
@@ -276,7 +286,7 @@
     $c{cc_hasjit} = " -DHAS_JIT -D" . uc $jitcpuarch;
     $c{jit_h} = "\$(INC)/jit.h";
     $c{jit_struct_h} = "\$(INC)/jit_struct.h";
-    $c{jit_o} = "jit\$(O)";
+    $c{jit_o} = "jit\$(O) jit_cpu\$(O)";
 }
 
 #
diff --exclude=CVS -urN parrot/MANIFEST parrot-jit/MANIFEST
--- parrot/MANIFEST     Sun Mar 24 16:10:49 2002
+++ parrot-jit/MANIFEST Sun Mar 24 18:29:00 2002
@@ -149,9 +149,13 @@
 jit/i386/core.jit
 jit/i386/lib.jit
 jit/i386/string.jit
+jit/i386/core.cjt
+jit/i386/jit_emit.h
 jit/sun4/core.jit
 jit/sun4/lib.jit
 jit/sun4/string.jit
+jit/sun4/core.cjt
+jit/sun4/jit_emit.h
 jit2h.pl
 key.c
 languages/Makefile.in
diff --exclude=CVS -urN parrot/MANIFEST.SKIP parrot-jit/MANIFEST.SKIP
--- parrot/MANIFEST.SKIP        Thu Mar 21 18:39:49 2002
+++ parrot-jit/MANIFEST.SKIP    Thu Mar 21 21:15:54 2002
@@ -14,12 +14,14 @@
 ^vtable\.ops$
 ^include/parrot/vtable\.h$
 ^include/parrot/jit_struct\.h$
+^include/parrot/jit_emit\.h$
 ^include/parrot/oplib/core_ops\.h$
 ^include/parrot/oplib/core_ops_prederef\.h$
 
 ^core_ops\.c$
 ^core_ops_prederef\.c$
 ^vtable_ops\.c$
+^jit_cpu.c
 
 ^lib/Parrot/Jit\.pm$
 ^lib/Parrot/PMC\.pm$
diff --exclude=CVS -urN parrot/Makefile.in parrot-jit/Makefile.in
--- parrot/Makefile.in  Thu Mar 21 18:47:22 2002
+++ parrot-jit/Makefile.in      Sun Mar 24 18:31:48 2002
@@ -44,7 +44,7 @@
 
 GEN_OPSFILES = vtable.ops
 
-GEN_HEADERS = $(INC)/vtable.h ${jit_struct_h} $(INC)/oplib/core_ops.h \
+GEN_HEADERS = $(INC)/vtable.h $(INC)/oplib/core_ops.h \
 $(INC)/oplib/core_ops_prederef.h
 
 GEN_SOURCES = core_ops.c core_ops_prederef.c vtable_ops.c
@@ -69,7 +69,7 @@
 $(INC)/interp_guts.h ${jit_h} $(INC)/rx.h $(INC)/rxstacks.h \
 $(INC)/embed.h $(INC)/warnings.h $(INC)/misc.h
 
-ALL_H_FILES = $(GENERAL_H_FILES) ${jit_struct_h}
+ALL_H_FILES = $(GENERAL_H_FILES)
 
 CLASS_O_FILES = classes/default$(O) classes/array$(O) \
 classes/perlint$(O) classes/perlstring$(O) classes/perlnum$(O) \
@@ -286,7 +286,9 @@
 
 pmc$(O): $(GENERAL_H_FILES)
 
-jit$(O): $(GENERAL_H_FILES) ${jit_struct_h}
+jit$(O): $(GENERAL_H_FILES)
+
+jit_cpu$(O): $(GENERAL_H_FILES) $(INC)/jit_emit.h
 
 key$(O): $(GENERAL_H_FILES)
 
@@ -365,8 +367,11 @@
 $(INC)/vtable.h: vtable.tbl vtable_h.pl
        $(PERL) vtable_h.pl
 
-$(INC)/jit_struct.h: jit2h.pl lib/Parrot/OpLib/core.pm lib/Parrot/Jit.pm 
jit/${jitcpuarch}/core.jit jit/${jitcpuarch}/string.jit
-       $(PERL) jit2h.pl ${jitcpuarch} > $(INC)/jit_struct.h
+$(INC)/jit_emit.h: jit/${jitcpuarch}/jit_emit.h
+       $(PERL) -MFile::Copy=cp -e ${PQ}cp q|jit/${jitcpuarch}/jit_emit.h|, 
+q|$(INC)/jit_emit.h|${PQ}
+
+jit_cpu.c: lib/Parrot/OpLib/core.pm $(INC)/jit_emit.h jit/${jitcpuarch}/core.cjt
+       jit2h.pl ${jitcpuarch} jit_cpu.c
 
 docs: docs/.dummy
 
diff --exclude=CVS -urN parrot/include/parrot/exceptions.h 
parrot-jit/include/parrot/exceptions.h
--- parrot/include/parrot/exceptions.h  Sun Mar  3 22:17:21 2002
+++ parrot-jit/include/parrot/exceptions.h      Sun Mar 10 11:28:51 2002
@@ -47,6 +47,7 @@
 #define ALLOCATION_ERROR 1
 #define INTERNAL_PANIC 1
 #define OUT_OF_BOUNDS 1
+#define JIT_ERROR 1
 
 #endif
 
diff --exclude=CVS -urN parrot/include/parrot/jit.h parrot-jit/include/parrot/jit.h
--- parrot/include/parrot/jit.h Sun Mar  3 22:17:21 2002
+++ parrot-jit/include/parrot/jit.h     Wed Mar 13 09:00:36 2002
@@ -1,34 +1,51 @@
 /*
 ** jit.h
 **
-** $Id: jit.h,v 1.10 2002/03/04 03:17:21 josh Exp $
+** $Id: jit.h,v 1.8 2002/01/29 14:05:45 grunblatt Exp $
 */
 
 #ifndef JIT_H_GUARD
 #define JIT_H_GUARD
 
-#ifdef ALPHA
-void calculate_displacement(INTVAL *, INTVAL *, INTVAL *, INTVAL *);
-typedef void (*jit_f)(void *);
-#endif
-#ifdef I386
-typedef void (*jit_f)(void);
-#endif
-#ifdef SUN4
-static void write_lo_13(char *instr_end, ptrcast_t value);
-static void write_hi_22(char *instr_end, ptrcast_t value);
-static void write_22(char *instr_end, ptrcast_t value);
-static void write_30(char *instr_end, ptrcast_t value);
-static void write_32(char *instr_end, ptrcast_t value);
-typedef void (*jit_f)(void *int_reg, void *num_reg, void *str_reg);
-#endif
-
+typedef void (*jit_f)(struct Parrot_Interp *);
 
 #define MAX_SUBSTITUTION 3
 #define MAX_TEMP_INT_SUBSTITUTION 8
 
 jit_f build_asm(struct Parrot_Interp *, opcode_t *, opcode_t *, opcode_t *);
 
+/* Platform generic fixup information */
+typedef struct Parrot_jit_fixup_t {
+    int type;
+    ptrdiff_t native_offset;   /* Where to apply fixup */
+    union { 
+        opcode_t opcode;
+        void (*fptr)(void);
+    } param;                    /* Fixup specific data */
+
+    struct Parrot_jit_fixup_t *next;
+} Parrot_jit_fixup;
+
+/* Hold native code offsets/addresses */
+typedef union {
+    void *ptr;         /* Pointer to native code */
+    ptrdiff_t offset;  /* Offset of native code from arena_start */
+} Parrot_jit_opmap;
+
+typedef struct {
+    opcode_t *cur_op;
+    opcode_t op_i;
+    Parrot_jit_opmap *op_map;  /* Maps opcode offsets to native code */
+    UINTVAL map_size;
+    char *native_ptr;          /* Current pointer to native code */
+    char *arena_start;         /* Start of current native code segment */
+    ptrdiff_t arena_size;      /* in bytes */
+    Parrot_jit_fixup *fixups;   /* List of fixupes */
+} Parrot_jit_info;
+
+#define Parrot_jit_fixup_target(jit_info, fixup) \
+    ((jit_info)->arena_start + (fixup)->native_offset)
+
 typedef struct {
     int position;
     int number;
@@ -55,49 +72,7 @@
     info_t info[MAX_TEMP_INT_SUBSTITUTION];
 } temp_int_substitution_t;
 
-typedef struct {
-    const char *assembly;
-    unsigned int size;
-    int nargop;
-    /* &interpreter->xxx->register[pc[x]] */
-    substitution_t intval_register_address;
-    substitution_t floatval_register_address;
-    substitution_t string_register_address;
-    substitution_t pmc_r_a;
-    /* pc[x] || interpreter->code->const_table->constants[pc[x]]->number || 
interpreter->code->const_table->constants[pc[x]]->string || ?? */
-    substitution_t intval_constant_value;
-    substitution_t floatval_constant_value;     /* Not likely to be used */
-    string_substitution_t string_constant_value;
-    substitution_t pmc_c_v;
-    /* &pc[x] || &interpreter->code->const_table->constants[pc[x]]->number || 
&interpreter->code->const_table->constants[pc[x]]->string || ?? */
-    substitution_t intval_constant_address;
-    substitution_t floatval_constant_address;
-    string_substitution_t string_constant_address;
-    substitution_t pmc_c_a;
-    /* &(temporary variables) ... */
-    temp_int_substitution_t temporary_intval_address;
-    substitution_t temporary_floatval_address;
-    substitution_t temporary_string_address;
-    substitution_t temporary_char_address;
-    /* constants ... */
-    substitution_t constant_intval_value;
-    substitution_t c_floatval_v;        /* Not likely to be used */
-    substitution_t c_string_v;  /* Not likely to be used */
-    substitution_t c_char_v;
-    /* &constants ... */
-    substitution_t constant_intval_address;
-    substitution_t constant_floatval_address;
-    substitution_t c_string_a;
-    substitution_t constant_char_address;
-    /* where to branch */
-    substitution_t jump_int_const;
-    substitution_t fixup_a;
-    substitution_t fixup_o;
-    substitution_t libc_c;
-    substitution_t interpreter;
-    substitution_t cur_opcode;
-} opcode_assembly_t;
-
+typedef void (*jit_fn_t)(Parrot_jit_info *jit_info, struct Parrot_Interp * 
+interpreter);
 
 /* Don't ever count on any info here */
 
@@ -106,7 +81,21 @@
 
 extern FLOATVAL floatval_constants[1];
 extern char char_constants[];
-extern INTVAL *op_real_address;
+extern INTVAL *op_real_address; 
+
+typedef struct {
+    jit_fn_t fn;
+    int nargop;
+} jit_fn_info_t; 
+
+extern jit_fn_info_t op_jit[];
+
+void Parrot_jit_newfixup(Parrot_jit_info *jit_info);
+
+void Parrot_jit_begin(Parrot_jit_info *jit_info, struct Parrot_Interp * interpreter);
+void Parrot_jit_dofixup(Parrot_jit_info *jit_info, struct Parrot_Interp * 
+interpreter);
+void Parrot_jit_cpcf_op(Parrot_jit_info *jit_info, struct Parrot_Interp * 
+interpreter);
+void Parrot_jit_normal_op(Parrot_jit_info *jit_info, struct Parrot_Interp * 
+interpreter);
 
 #endif /* JIT_H_GUARD */
 
@@ -114,8 +103,8 @@
  * Local variables:
  * c-indentation-style: bsd
  * c-basic-offset: 4
- * indent-tabs-mode: nil
+ * indent-tabs-mode: nil 
  * End:
  *
  * vim: expandtab shiftwidth=4:
- */
+*/
diff --exclude=CVS -urN parrot/interpreter.c parrot-jit/interpreter.c
--- parrot/interpreter.c        Sat Mar 16 12:38:45 2002
+++ parrot-jit/interpreter.c    Mon Mar 18 09:44:47 2002
@@ -314,21 +314,7 @@
     code_end = interpreter->code->byte_code + code_size;
 
     jit_code = build_asm(interpreter, pc, code_start, code_end);
-#  ifdef ALPHA
-    (jit_code) ((void *)(((char *)&interpreter->int_reg.registers[0]) +
-                         0x7fff));
-#  endif
-#  ifdef I386
-    (jit_code) ();
-#  endif
-#  ifdef SUN4
-    (jit_code) ((void *)(&interpreter->int_reg.registers[0]),
-                (void *)&interpreter->num_reg.registers[0],
-                (void *)&interpreter->string_reg.registers[0]);
-#  endif
-
-#else
-    return;
+    (jit_code) (interpreter);
 #endif
 }
 
diff --exclude=CVS -urN parrot/jit/i386/core.cjt parrot-jit/jit/i386/core.cjt
--- parrot/jit/i386/core.cjt    Wed Dec 31 19:00:00 1969
+++ parrot-jit/jit/i386/core.cjt        Sat Mar  9 20:00:14 2002
@@ -0,0 +1,75 @@
+;
+;   i386_core.jit 
+;
+; $Id: core.jit,v 1.15 2002/01/31 03:20:42 grunblatt Exp $
+;
+
+Parrot_end {
+    NATIVECODE = emit_popl_r(NATIVECODE, emit_ESI);
+    emitm_ret(NATIVECODE);
+}
+
+Parrot_noop {
+    NATIVECODE = emit_nop(NATIVECODE);
+}
+
+Parrot_set_i_ic {
+    emitm_movl_i_m(NATIVECODE, *INT_CONST[2], emit_None, emit_None, emit_None,
+           &INT_REG[1]);
+}
+
+Parrot_set_i_i {
+    emitm_movl_m_r(NATIVECODE, emit_EAX, emit_None, emit_None, emit_None, 
+&INT_REG[2]);
+    emitm_movl_r_m(NATIVECODE, emit_EAX, emit_None, emit_None, emit_None, 
+&INT_REG[1]);
+}
+
+Parrot_set_n_nc {
+    emitm_fldl(NATIVECODE, emit_None, emit_None, emit_None, &NUM_CONST[2]);
+    emitm_fstpl(NATIVECODE, emit_None, emit_None, emit_None, &NUM_REG[1]);
+}
+
+Parrot_set_n_n {
+    emitm_fldl(NATIVECODE, emit_None, emit_None, emit_None, &NUM_REG[2]);
+    emitm_fstpl(NATIVECODE, emit_None, emit_None, emit_None, &NUM_REG[1]);
+}
+
+Parrot_mul_i_i_i {
+    emitm_movl_m_r(NATIVECODE, emit_EAX, emit_None, emit_None, emit_None, 
+&INT_REG[2]);
+    emitm_smull_r_m(NATIVECODE, emit_EAX, emit_None, emit_None, emit_None, 
+&INT_REG[3]);
+    emitm_movl_r_m(NATIVECODE, emit_EAX, emit_None, emit_None, emit_None, 
+&INT_REG[1]);
+}
+
+Parrot_sub_i_i_i {
+    emitm_movl_m_r(NATIVECODE, emit_EAX, emit_None, emit_None, emit_None, 
+&INT_REG[2]);
+    emitm_subl_m_r(NATIVECODE, emit_EAX, emit_None, emit_None, emit_None, 
+&INT_REG[3]);
+    emitm_movl_r_m(NATIVECODE, emit_EAX, emit_None, emit_None, emit_None, &INT_REG[1])
+}
+
+Parrot_set_n_i {
+    emitm_fildl(NATIVECODE, emit_None, emit_None, emit_None, &INT_REG[2]);
+    emitm_fstpl(NATIVECODE, emit_None, emit_None, emit_None, &NUM_REG[1]);
+}
+
+Parrot_div_n_n_n {
+    emitm_fldl(NATIVECODE, emit_None, emit_None, emit_None, &NUM_REG[2]);
+    emitm_fldl(NATIVECODE, emit_None, emit_None, emit_None, &NUM_REG[3]);
+    emitm_fdivp(NATIVECODE, 1);
+    emitm_fstpl(NATIVECODE, emit_None, emit_None, emit_None, &NUM_REG[1]);
+}
+
+Parrot_sub_n_n_n {
+    emitm_fldl(NATIVECODE, emit_None, emit_None, emit_None, &NUM_REG[2]);
+    emitm_fldl(NATIVECODE, emit_None, emit_None, emit_None, &NUM_REG[3]);
+    emitm_fsubp(NATIVECODE, 1);
+    emitm_fstpl(NATIVECODE, emit_None, emit_None, emit_None, &NUM_REG[1]);
+}
+
+Parrot_if_i_ic {
+    emitm_movl_m_r(NATIVECODE, emit_EAX, emit_None, emit_None, emit_None, 
+&INT_REG[1]);
+    emitm_cmpl_i_r(NATIVECODE, 0, emit_EAX);
+    emit_jcc(jit_info, emitm_jne, *INT_CONST[2]);
+}
+
+Parrot_branch_ic {
+    emit_jump(jit_info, *INT_CONST[1]);
+}
diff --exclude=CVS -urN parrot/jit/i386/jit_emit.h parrot-jit/jit/i386/jit_emit.h
--- parrot/jit/i386/jit_emit.h  Wed Dec 31 19:00:00 1969
+++ parrot-jit/jit/i386/jit_emit.h      Tue Mar 12 20:51:20 2002
@@ -0,0 +1,618 @@
+/* Register codes */
+#define emit_None 0 
+ 
+/* These are + 1 the real values */
+#define emit_EAX 1
+#define emit_ECX 2
+#define emit_EDX 3
+#define emit_EBX 4
+#define emit_ESP 5
+#define emit_EBP 6
+#define emit_ESI 7
+#define emit_EDI 8
+
+#define emit_b00 0
+#define emit_b01 1
+#define emit_b10 2
+#define emit_b11 3
+
+#define emit_b000 0
+#define emit_b001 1
+#define emit_b010 2
+#define emit_b011 3
+#define emit_b100 4
+#define emit_b101 5
+#define emit_b110 6
+#define emit_b111 7
+
+/* Mod R/M byte */
+#define emit_reg(x) ((x) << 3)
+#define emit_Mod(Mod) ((Mod) << 6)
+#define emit_reg_rm(x) ((x)-1)
+
+/* Mod values for Mod R/M Byte */
+#define emit_Mod_b00 emit_Mod(emit_b00)
+#define emit_Mod_b01 emit_Mod(emit_b01)
+#define emit_Mod_b10 emit_Mod(emit_b10)
+
+/* special R/M values */
+#define emit_rm_b101 emit_b101
+#define emit_rm_b100 emit_b100
+
+#define emit_r_m(pc, reg1, b, i, s, d) emit_r_X((pc), emit_reg((reg1)-1), (b), (i), 
+(s), (d))
+
+/* ESIB byte */
+#define emit_Scale(scale) ((scale) << 6) 
+#define emit_reg_Index(x) (((x)-1) << 3) 
+#define emit_reg_Base(x) ((x)-1)
+
+/* Scale factor values */
+#define emit_Scale_1 emit_Scale(0)
+#define emit_Scale_2 emit_Scale(1)
+#define emit_Scale_4 emit_Scale(2)
+#define emit_Scale_8 emit_Scale(3)
+
+#define emit_Index_None ((emit_b100) << 3)
+
+#define emit_alu_X_r(X, reg) ((emit_b11 << 6) | ((X) << 3) | ((reg)-1))
+#define emit_alu_r_r(reg1,reg2) emit_alu_X_r((reg1-1), (reg2))
+
+static int emit_is8bit(long disp){
+    return (((disp > -129) && (disp < 128)) ? 1 : 0);
+}
+
+static char *emit_disp8_32(char *pc, int disp){
+    if(emit_is8bit(disp)){
+       *(pc++) = (char)disp;
+       return pc;
+    }
+    else {
+       *(long *)pc = disp;
+       return pc + 4;
+    }
+}
+
+static void emit_sib(char *pc, int scale, int i, int base){
+    int scale_byte;
+
+    switch (scale){
+        case 1:
+            scale_byte = emit_Scale_1;
+            break;
+        case 2:
+            scale_byte = emit_Scale_2;
+            break;
+        case 4:
+            scale_byte = emit_Scale_4;
+            break;
+        case 8:
+            scale_byte = emit_Scale_8;
+            break;
+        default :
+            internal_exception(JIT_ERROR, "Invalid scale factor %d\n", scale);
+            break;
+    }
+
+    *pc = scale_byte | (i == emit_None ? emit_Index_None : emit_reg_Index(i)) |
+           emit_reg_Base(base);
+}
+
+static char *emit_r_X(char *pc, int reg_opcode, int base, int i, int scale,
+                   long disp)
+{
+    if((i && !scale) || (scale && !i)){
+       internal_exception(JIT_ERROR,
+                            "emit_r_X passed invalid scale+index combo\n");
+    }
+
+    if(base == emit_EBP){
+       /* modrm disp */
+       if(i == emit_None){
+           *(pc++) = (emit_is8bit(disp) ? emit_Mod_b01 : emit_Mod_b10 ) 
+                       | reg_opcode | emit_reg_rm(emit_EBP);
+           return emit_disp8_32(pc, disp);
+       }
+       /* modrm sib disp */
+       else { 
+           *(pc++) = (emit_is8bit ? emit_Mod_b01 : emit_Mod_b10 ) 
+                       | reg_opcode | emit_b100;
+           emit_sib(pc++, scale, i, base);
+           return emit_disp8_32(pc, disp);
+       }
+    }
+
+    /* modrm sib disp */
+    if(base == emit_ESP){
+       *(pc++) = (emit_is8bit(disp) ? emit_Mod_b01 : emit_Mod_b10 )
+                   | reg_opcode | emit_rm_b100;
+       emit_sib(pc++, scale, i, emit_ESP);
+       return emit_disp8_32(pc, disp);
+    }
+
+    /* modrm disp32 */
+    if(!base && !(i && scale) && !emit_is8bit(disp)){
+       *(pc++) = emit_Mod_b00 | reg_opcode | emit_rm_b101;
+       *(long *)pc = disp;
+       return pc + 4;
+    }
+
+    /* Ok, everything should be more regular here */
+    *(pc++) = (disp == 0 ? emit_Mod_b00 :
+                   (emit_is8bit(disp) ?
+                        emit_Mod_b01 : emit_Mod_b10) ) |
+               reg_opcode |
+               (!base || (scale && i) ? emit_rm_b100 : emit_reg_rm(base));
+
+    if(!base || (scale && i)){
+       emit_sib(pc++, scale, i, base);
+    }
+    if(disp)
+        pc = emit_disp8_32(pc, disp);
+
+    return pc;
+}
+
+/* CDQ - need this to do multiply */
+#define emitm_cdq(pc) *((pc)++) = 0x99
+
+/* RET */
+
+#define emitm_ret(pc) *((pc)++) = 0xc3
+
+/* NOP */
+
+static char *emit_nop(char *pc){
+    *(pc++) = 0x90;
+    return pc;
+}
+
+/* PUSHes */
+
+static char *emit_pushl_r(char *pc, int reg){
+    *(pc++) = 0x50 | (reg - 1);
+    return pc;
+}
+
+#define emitm_pushl_i(pc, imm) { \
+ *(pc++) = 0x68; *(long *)pc = (long)imm; (pc) += 4; }
+
+static char *emit_pushl_m(char *pc, int base, int i, int scale,
+                           long disp)
+{
+    *(pc++) = 0xff;
+    return emit_r_X(pc, emit_reg(emit_b110), base, i, scale, disp);
+}
+
+/* POPs */
+
+static char *emit_popl_r(char *pc, int reg){
+    *(pc++) = 0x8f;
+    *(pc++) = emit_alu_X_r(emit_b000, reg);
+    return pc;
+}
+
+static char *emit_popl_m(char *pc, int base, int i, int scale,
+                           long disp)
+{
+    *(pc++) = 0x8f;
+    return emit_r_X(pc, emit_reg(emit_b000), base, i, scale, disp);
+}
+
+/* MOVes */
+
+static char *emit_movb_r_r(char *pc, int reg1, int reg2){
+    *(pc++) = 0x88;
+    *(pc++) = emit_alu_r_r(reg1, reg2);
+    return pc;
+}
+
+#define emitm_movl_r_r(pc, reg1, reg2) { \
+    *(pc++) = 0x89; \
+    *(pc++) = emit_alu_r_r(reg1, reg2); }
+
+static char *emit_movb_i_r(char *pc, char imm, int reg){
+    *(pc++) = 0xb0 | (reg - 1);
+    *(pc++) = imm;
+    return pc;
+}
+
+#define emitm_movl_i_r(pc, imm, reg) { \
+    *(pc++) = 0xb8 | (reg - 1); \
+    *(long *)pc = (long)imm; (pc) += 4; \
+}
+
+#define emitm_movX_Y_Z(op, pc, reg1, b, i, s, d) { \
+    *(pc++) = op; \
+    (pc) = emit_r_m(pc, reg1, b, i, s, (long)d); }
+
+#define emitm_movb_r_m(pc, reg1, b, i, s, d) emitm_movX_Y_Z(0x88, pc, reg1, b, i, s, 
+d)
+
+#define emitm_movl_r_m(pc, reg1, b, i, s, d) emitm_movX_Y_Z(0x89, pc, reg1, b, i, s, 
+d)
+
+#define emitm_movb_m_r(pc, reg1, b, i, s, d) emitm_movX_Y_Z(0x8a, pc, reg1, b, i, s, 
+d)
+
+#define emitm_movl_m_r(pc, reg1, b, i, s, d) emitm_movX_Y_Z(0x8b, pc, reg1, b, i, s, 
+d)
+
+static char *emit_movb_i_m(char *pc, char imm, int base, int i, int scale,
+                           long disp)
+{
+    *(pc++) = 0xc6;
+    pc = emit_r_X(pc, emit_reg(emit_b000), base, i, scale, disp);
+    *(pc++) = imm;
+    return pc;
+}
+
+#define emitm_movl_i_m(pc, imm, b, i, s, d) { \
+ *(pc++) = 0xc7; (pc) = emit_r_X(pc, emit_reg(emit_b000), b, i, s, (long)d); \
+ *(long *)(pc) = imm; (pc) += 4; }
+
+/* Various ALU formats */
+
+#define emitm_alul_r_r(pc, op, reg1, reg2) { *(pc++) = op; *(pc++) = 
+emit_alu_r_r(reg1, reg2); }
+
+#define emitm_alul_i_r(pc, op1, op2, imm, reg) { *(pc++) = op1; *(pc++) = 
+emit_alu_X_r(op2, reg); *(long *)((pc)) = (long)(imm); (pc) += 4; }
+
+#define emitm_alul_i_m(pc, op1, op2, imm, b, i, s, d) { \
+ *(pc++) = op1; \
+ (pc) = emit_r_X(pc, emit_reg(op2), b, i, s, d); \
+ *(long *)(pc) = imm; (pc) += 4; }
+
+#define emitm_alul_r_m(pc, op, reg, b, i, s, d) {\
+    *(pc++) = op; \
+    pc = emit_r_X(pc, emit_reg(reg-1), b, i, s, (long)d); }
+
+
+/* ADDs */
+
+#define emitm_addb_r_r(pc, reg1, reg2) emitm_alul_r_r(pc, 0x00, reg1, reg2)
+#define emitm_addl_r_r(pc, reg1, reg2) emitm_alul_r_r(pc, 0x01, reg1, reg2)
+#define emitm_addl_i_r(pc, imm, reg)   emitm_alul_i_r(pc, 0x81, emit_b000, imm, reg)
+#define emitm_addl_i_m(pc, imm, b, i, s, d) emitm_alul_i_m(pc, 0x81, emit_b000, imm, 
+b, i, s, d)
+
+/* SUBs */
+
+#define emitm_subl_r_r(pc, reg1, reg2) emitm_alul_r_r(pc, 0x29, reg1, reg2)
+#define emitm_subl_i_r(pc, imm, reg)   emitm_alul_i_r(pc, 0x81, emit_b101, imm, reg)
+#define emitm_subl_r_m(pc, reg, b, i, s, d) emitm_alul_r_m(pc, 0x29, reg, b, i, s, d)
+#define emitm_subl_m_r(pc, reg, b, i, s, d) emitm_alul_r_m(pc, 0x2b, reg, b, i, s, d)
+#define emitm_subl_i_m(pc, imm, b, i, s, d) emitm_alul_i_m(pc, 0x81, emit_b101, imm, 
+b, i, s, d)
+
+/* These are used by both signed and unsigned EDIV, but only unsigned MUL */
+#define emitm_alu_imp_r(pc, op, reg) { *((pc)++) = 0xf7; *((pc)++) = emit_alu_X_r(op, 
+reg); }
+
+#define emitm_alu_imp_m(pc, op, b, i, s, d) { *((pc)++) = 0xf7; (pc) = emit_r_X(pc, 
+emit_reg(op), b, i, s, d); }
+
+/* Unsigned MUL and EDIV */
+/* EAX implicit destination in multiply and divide */
+
+#define emitm_umull_r(pc, reg2) emitm_alu_imp_r((pc), emit_b100, (reg2))
+#define emitm_udivl_r(pc, reg2) emitm_alu_imp_r((pc), emit_b110, (reg2))
+
+#define emitm_umull_m(pc, b, i, s, d) emitm_alu_imp_m(pc, emit_b100, b, i, s, d)
+#define emitm_udivl_m(pc, b, i, s, d) emitm_alu_imp_m(pc, emit_b110, b, i, s, d)
+
+/* Signed MUL and EDIV */
+
+#define emitm_sdivl_r(pc, reg2) emitm_alu_imp_r((pc), emit_b111, (reg2))
+#define emitm_sdivl_m(pc, b, i, s, d) emitm_alu_imp_m((pc), emit_b111, b, i, s, d,)
+
+#define emitm_smull_op(pc) { *((pc)++) = 0x0f; *((pc)++) = 0xaf; }
+
+#define emitm_smull_r(pc, reg2) emitm_alu_imp_r((pc), emit_b101, (reg2))
+
+/* The arguments are swapped here so that the destination is put second */
+#define emitm_smull_r_r(pc, reg2, reg1) { emitm_smull_op(pc); *((pc)++) = 
+emit_alu_r_r(reg1, reg2); }
+
+#define emitm_smull_r_m(pc, reg1, b, i, s, d) { emitm_smull_op(pc); (pc) = 
+emit_r_X((pc), emit_reg(reg1-1), b, i, s, (long)d); }
+
+/* NEG */
+
+#define emitm_negl_r(pc, reg) emitm_alu_imp_r(pc, emit_b011, reg)
+#define emitm_negl_m(pc, b, i, s, d) emitm_alu_imp_m(pc, emit_b011, b, i, s, d)
+
+/* AND */
+
+#define emitm_andl_r_r(pc, reg1, reg2) emitm_alul_r_r(pc, 0x21, reg1, reg2)
+#define emitm_andl_i_r(pc, imm, reg) emitm_alul_i_r(pc, 0x81, emit_b100, imm, reg)
+#define emitm_andl_i_m(pc, imm, b, i, s, d) emitm_alul_i_m(pc, 0x81, emit_b100, imm, 
+b, i, s, d)
+
+/* OR */
+
+#define emitm_orl_r_r(pc, reg1, reg2) emitm_alul_r_r(pc, 0x9, reg1, reg2)
+#define emitm_orl_i_r(pc, imm, reg) emitm_alul_i_r(pc, 0x81, emit_b001, imm, reg)
+#define emitm_orl_i_m(pc, imm, b, i, s, d) emitm_alul_i_m(pc, 0x81, emit_b001, imm, 
+b, i, s, d)
+
+/* XOR */
+
+#define emitm_xorl_r_r(pc, reg1, reg2) emitm_alul_r_r(pc, 0x31, reg1, reg2)
+
+/* NOT */
+
+#define emitm_notl_r(pc, reg) emitm_alu_imp_r(pc, emit_b010, reg)
+#define emitm_notl_m(pc, b, i, s, d) emitm_alu_imp_m(pc, emit_b010, b, i, s, d)
+
+
+/* Floating point ops */
+
+#define emitm_floatop 0xd8  /* 11011000 */
+
+#define emitm_fl_2(pc, mf, opa, opb, b, i, s, d) { \
+    *((pc)++) = emitm_floatop | (mf << 1) | opa; \
+    (pc) = emit_r_X(pc, emit_reg(opb), b, i, s, (long)d); }
+
+#define emitm_fl_3(pc, d_p_opa, opb_r, sti) { \
+    *((pc)++) = emitm_floatop | d_p_opa; \
+    *((pc)++) = 0xc0 | (opb_r << 3) | sti; }
+
+#define emitm_fl_4(pc, op) { \
+ *((pc)++) = emitm_floatop | emit_b001; *((pc)++) = 0xe0 | op; }
+
+/* Integer loads and stores */
+#define emitm_fildl(pc, b, i, s, d) emitm_fl_2(pc, emit_b01, 1, emit_b000, b, i, s, d)
+#define emitm_fistpl(pc, b, i, s, d) emitm_fl_2(pc, emit_b01, 1, emit_b011, b, i, s, 
+d)
+#define emitm_fistl(pc, b, i, s, d) emitm_fl_2(pc, emit_b01, 1, emit_b010, b, i, s, d)
+
+/* Double loads and stores */
+#define emitm_fldl(pc, b, i, s, d) emitm_fl_2(pc, emit_b10, 1, emit_b000, b, i, s, d)
+#define emitm_fstpl(pc, b, i, s, d) emitm_fl_2(pc, emit_b10, 1, emit_b011, b, i, s, d)
+#define emitm_fstl(pc, b, i, s, d) emitm_fl_2(pc, emit_b10, 1, emit_b010, b, i, s, d)
+
+/* Add ST(1) = ST(0) + ST(i); POP ST(0) */
+#define emitm_faddp(pc, sti) emitm_fl_3(pc, emit_b110, emit_b000, sti)
+
+/* Add ST(1) = ST(0) - ST(i); POP ST(0) */
+#define emitm_fsubp(pc, sti) emitm_fl_3(pc, emit_b110, emit_b101, sti)
+
+/* Add ST(1) = ST(0) * ST(i); POP ST(0) */
+#define emitm_fmulp(pc, sti) emitm_fl_3(pc, emit_b110, emit_b001, sti)
+
+/* Add ST(1) = ST(0) / ST(i); POP ST(0) */
+#define emitm_fdivp(pc, sti) emitm_fl_3(pc, emit_b110, emit_b111, sti)
+
+/* Negate - called change sign */
+#define emitm_chs(pc) emitm_fl_4(pc, 0)
+
+/* Comparisions */
+
+#define emitm_fcom(pc, sti) emitm_fl_3(pc, emit_b000, emit_b010, sti)
+#define emitm_fcomp(pc, sti) emitm_fl_3(pc, emit_b000, emit_b011, sti)
+#define emitm_fcom_m(pc,b,i,s,d) emitm_fl_2(pc, emit_b10, 0, emit_b010, b, i, s, d)
+#define emitm_fcomp_m(pc,b,i,s,d) emitm_fl_2(pc, emit_b10, 0, emit_b011, b, i, s, d)
+
+/* Ops Needed to support loading EFLAGs for conditional branches */
+#define emitm_fstw(pc) emitm_fl_3(pc, emit_b111, emit_b100, emit_b000)
+#define emitm_sahf(pc) *((pc)++) = 0x9e
+
+/* Integer comparisions */
+#define emitm_cmpl_r_r(pc, reg1, reg2) emitm_alul_r_r(pc, 0x39, reg1, reg2)
+#define emitm_cmpl_r_m(pc, reg, b, i, s, d) emitm_alul_r_m(pc, 0x3b, reg1, reg2, b, 
+i, s, d)
+#define emitm_cmpl_m_r(pc, reg, b, i, s, d) emitm_alul_r_m(pc, 0x39, reg1, reg2, b, 
+i, s, d)
+
+#define emitm_cmpl_i_r(pc, imm, reg) emitm_alul_i_r(pc, 0x81, emit_b111, imm, reg)
+
+
+/* Unconditional Jump/Call */
+
+#define emitm_calll(pc, disp) { *((pc)++) = 0xe8; *(long *)(pc) = disp; (pc) +=4; }
+#define emitm_callr(pc, reg) { *((pc)++) = 0xff; *((pc)++) = 0xd0 | (reg-1); }
+#define emitm_callm(pc, b, i, s, d) { \
+ *((pc)++) = 0xff; (pc) = emit_r_X(pc, emit_reg(emit_b010), b, i, s, d); }
+
+#define emitm_jumps(pc, disp) { *((pc)++) = 0xeb; *((pc)++) = disp; }
+#define emitm_jumpl(pc, disp) { \
+ *((pc)++) = 0xe9; *(long *)(pc) = disp; (pc) +=4; }
+
+#define emitm_jumpr(pc, reg) { *((pc)++) = 0xff; *((pc)++) = 0xe0 | (reg-1); }
+#define emitm_jumpm(pc, b, i, s, d) { \
+ *((pc)++) = 0xff; (pc) = emit_r_X(pc, emit_reg(emit_b100), b, i, s, d); }
+
+/* Conditional jumps */
+
+/* Short jump - 8 bit disp */
+#define emitm_jxs(pc, code, disp) { *((pc)++) = 0x70 | code; *((pc)++) = (char)disp; }
+
+/* Long jump - 32 bit disp */
+#define emitm_jxl(pc, code, disp) { \
+ *((pc)++) = 0x0f; *((pc)++) = 0x80 | code;  *(long *)(pc) = disp; (pc) +=4; }
+
+#define emitm_jo   0
+#define emitm_jno  1
+#define emitm_jb   2
+#define emitm_jnb  3
+#define emitm_jz   4
+#define emitm_je emitm_jz
+#define emitm_jnz  5
+#define emitm_jne emitm_jnz
+#define emitm_jbe  6
+#define emitm_ja   7
+#define emitm_js   8
+#define emitm_jns  9
+#define emitm_jl  12
+#define emitm_jnl 13
+#define emitm_jle 14
+#define emitm_jg  15
+
+enum  {JIT_X86BRANCH, JIT_X86JUMP, JIT_X86CALL };
+
+static void emit_jcc(Parrot_jit_info *jit_info, int code, opcode_t disp){
+    long offset;
+    opcode_t opcode;
+
+    opcode = jit_info->op_i + disp;
+
+    if(opcode <= jit_info->op_i) {
+       offset = jit_info->op_map[opcode].offset -
+                                (jit_info->native_ptr - jit_info->arena_start);
+       if(emit_is8bit(offset)) {
+           emitm_jxs(jit_info->native_ptr, code, offset - 2);
+       }
+       else {
+           emitm_jxl(jit_info->native_ptr, code, offset - 6);
+       }
+       return;
+    }
+
+    Parrot_jit_newfixup(jit_info); 
+    jit_info->fixups->type = JIT_X86BRANCH;
+    jit_info->fixups->param.opcode = opcode;
+    emitm_jxl(jit_info->native_ptr, code, 0xc0def00d);
+}
+
+static void emit_jump(Parrot_jit_info *jit_info, opcode_t disp){
+    long offset;
+    opcode_t opcode;
+
+    opcode = jit_info->op_i + disp;
+
+    if(opcode <= jit_info->op_i) {
+       offset = jit_info->op_map[opcode].offset -
+                                (jit_info->native_ptr - jit_info->arena_start);
+       if(emit_is8bit(offset)) {
+           emitm_jumps(jit_info->native_ptr, offset - 2);
+       }
+       else {
+           emitm_jumpl(jit_info->native_ptr, offset - 5);
+       }
+       return;
+    }
+
+    Parrot_jit_newfixup(jit_info); 
+    jit_info->fixups->type = JIT_X86JUMP;
+    jit_info->fixups->param.opcode = opcode;
+    emitm_jumpl(jit_info->native_ptr, 0xc0def00d);
+}
+
+void Parrot_jit_dofixup(Parrot_jit_info *jit_info,
+                        struct Parrot_Interp * interpreter)
+{
+    Parrot_jit_fixup *fixup;
+    Parrot_jit_fixup *last_fixup;
+    char *fixup_ptr;
+
+    fixup = jit_info->fixups;
+
+    while(fixup){
+        switch(fixup->type){
+           /* This fixes-up a branch to a known opcode offset -
+               32-bit displacement only
+           */
+            case JIT_X86BRANCH:
+               fixup_ptr = Parrot_jit_fixup_target(jit_info, fixup) + 2;
+               *(long *)(fixup_ptr) =
+                   jit_info->op_map[fixup->param.opcode].offset
+                                - (fixup->native_offset + 6);
+                break;
+            case JIT_X86JUMP:
+               fixup_ptr = Parrot_jit_fixup_target(jit_info, fixup) + 1;
+               *(long *)(fixup_ptr) =
+                   jit_info->op_map[fixup->param.opcode].offset
+                                - (fixup->native_offset + 5);
+                break;
+           case JIT_X86CALL:
+               fixup_ptr = jit_info->arena_start + fixup->native_offset + 1;
+               *(long *)(fixup_ptr) = (long)fixup->param.fptr -
+                                                       (long)fixup_ptr - 4;
+               break;
+           default:
+               internal_exception(JIT_ERROR, "Unknown fixup type:%d\n",
+                                       fixup->type);
+               break;
+        }
+       fixup = fixup->next;
+    }
+}
+
+void Parrot_jit_begin(Parrot_jit_info *jit_info,
+                      struct Parrot_Interp * interpreter)
+{
+    jit_info->native_ptr = emit_pushl_r(jit_info->native_ptr, emit_ESI);
+    emitm_movl_i_r(jit_info->native_ptr, jit_info->op_map, emit_ESI);
+}
+
+void Parrot_jit_normal_op(Parrot_jit_info *jit_info,
+                          struct Parrot_Interp * interpreter)
+{
+    emitm_pushl_i(jit_info->native_ptr, interpreter);
+    emitm_pushl_i(jit_info->native_ptr, jit_info->cur_op);
+
+    Parrot_jit_newfixup(jit_info);
+    jit_info->fixups->type = JIT_X86CALL;
+    jit_info->fixups->param.fptr =
+        (void (*)(void))interpreter->op_func_table[*(jit_info->cur_op)];
+
+    emitm_calll(jit_info->native_ptr, 0xdeafc0de);
+    emitm_addl_i_r(jit_info->native_ptr, 8, emit_ESP);
+}
+
+void Parrot_jit_cpcf_op(Parrot_jit_info *jit_info,
+                        struct Parrot_Interp * interpreter)
+{
+    Parrot_jit_normal_op(jit_info, interpreter);
+
+    /* This calculates (INDEX into op_map * 4) */
+    emitm_subl_i_r(jit_info->native_ptr, interpreter->code->byte_code,
+                        emit_EAX);
+
+    /* This jumps to the address in op_map[ESI + sizeof(void *) * INDEX] */
+    emitm_jumpm(jit_info->native_ptr, emit_ESI, emit_EAX,
+                        sizeof(*jit_info->op_map) / 4, 0);
+}
+
+
+/*
+void main(){
+    char ar[1024];
+    char *ar2;
+
+    ar2 = &ar[0];
+    ar2 = emit_movl_r_r(ar2, emit_EAX, emit_ECX);
+    ar2 = emit_movb_r_r(ar2, emit_EAX, emit_ECX);
+    ar2 = emit_movl_r_m(ar2, emit_EBX, emit_None, emit_None, emit_None, 0x1234);
+    ar2 = emit_movl_r_m(ar2, emit_EBX, emit_EDX, emit_None, emit_None, 0x1234);
+    ar2 = emit_movl_m_r(ar2, emit_EBX, emit_EDX, emit_None, emit_None, 0x1234);
+    ar2 = emit_movl_r_m(ar2, emit_EBX, emit_ESP, emit_None, emit_None, 0x74);
+    ar2 = emit_movl_r_m(ar2, emit_EBX, emit_EBP, emit_None, emit_None, 0);
+    ar2 = emit_movl_r_m(ar2, emit_EBX, emit_ECX, emit_EDX, 2, 0x1234);
+    ar2 = emit_movl_i_m(ar2, 0x79, emit_ECX, emit_EDX, 2, 0x1234);
+    ar2 = emit_movb_i_m(ar2, 0x79, emit_ECX, emit_EDX, 2, 0x1234);
+    ar2 = emit_movb_i_r(ar2, 0x43, emit_EDX);
+    ar2 = emit_addl_r_r(ar2, emit_ECX, emit_EDX);
+    ar2 = emit_addl_i_r(ar2, 0x7946, emit_EDX);
+    ar2 = emit_addl_i_m(ar2, 0x3479, emit_EDX, emit_None, emit_None, 0x1234);
+    emitm_andl_r_r(ar2, emit_ECX, emit_EDX);
+    emitm_andl_i_r(ar2, 0x7946, emit_EDX);
+    emitm_andl_i_m(ar2, 0x3875, emit_EDX, emit_None, emit_None, 0x4120);
+    emitm_orl_r_r(ar2, emit_ECX, emit_EDX);
+    emitm_orl_i_r(ar2, 0x4567, emit_EDX);
+    emitm_orl_i_m(ar2, 0x1234, emit_EDX, emit_None, emit_None, 0x9876);
+    emitm_notl_r(ar2, emit_EDX);
+    emitm_notl_m(ar2, emit_EBP, emit_None, emit_None, 0x4434);
+    ar2 = emit_pushl_r(ar2, emit_ESP);
+    ar2 = emit_pushl_r(ar2, emit_ECX);
+    ar2 = emit_pushl_i(ar2, 0x12983476);
+    ar2 = emit_pushl_m(ar2, emit_ESP, emit_None, emit_None, 0x4434);
+    ar2 = emit_popl_r(ar2, emit_ECX);
+    ar2 = emit_popl_r(ar2, emit_ECX);
+    ar2 = emit_popl_m(ar2, emit_EBX, emit_None, emit_None, 0x4434);
+    emitm_jumps(ar2, -46);
+    emitm_jumpl(ar2, 0x90);
+    emitm_jumpr(ar2, emit_EBP);
+    emitm_jumpm(ar2, emit_EBP, emit_None, emit_None, -4);
+    emitm_calll(ar2, 0x90);
+    emitm_callr(ar2, emit_EBP);
+    emitm_callm(ar2, emit_EBP, emit_None, emit_None, -4);
+    emitm_jxs(ar2, emitm_jg, -4);
+    emitm_jxl(ar2, emitm_jb, -4);
+    ar2 += 4;
+}
+*/
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil 
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+*/
diff --exclude=CVS -urN parrot/jit/sun4/core.cjt parrot-jit/jit/sun4/core.cjt
--- parrot/jit/sun4/core.cjt    Wed Dec 31 19:00:00 1969
+++ parrot-jit/jit/sun4/core.cjt        Sat Mar 23 21:46:29 2002
@@ -0,0 +1,62 @@
+Parrot_end {
+    emitm_ret(NATIVECODE);
+    emitm_restore_i(NATIVECODE, emitm_g(0), emitm_g(0), emitm_g(0));
+}
+
+Parrot_noop {
+    emitm_nop(NATIVECODE);
+}
+
+Parrot_set_i_i {
+    Parrot_jit_int_load(jit_info, interpreter, 2, emitm_l(0));
+    Parrot_jit_int_store(jit_info, interpreter, 1, emitm_l(0));
+}
+
+Parrot_set_i_ic {
+    Parrot_jit_int_load(jit_info, interpreter, 2, emitm_l(0));
+    Parrot_jit_int_store(jit_info, interpreter, 1, emitm_l(0));
+}
+
+Parrot_set_n_nc {
+    Parrot_jit_int_load(jit_info, interpreter, 2, emitm_l(0));
+    Parrot_jit_int_store(jit_info, interpreter, 1, emitm_l(0));
+}
+
+Parrot_set_n_n {
+    Parrot_jit_int_load(jit_info, interpreter, 2, emitm_l(0));
+    Parrot_jit_int_store(jit_info, interpreter, 1, emitm_l(0));
+}
+
+Parrot_set_n_i {
+    Parrot_jit_float_load(jit_info, interpreter, 2, emitm_f(0));
+    emitm_fitod(NATIVECODE, emitm_f(0), emitm_f(2));
+    Parrot_jit_float_store(jit_info, interpreter, 1, emitm_f(2));
+}
+
+Parrot_set_i_n {
+    Parrot_jit_float_load(jit_info, interpreter, 2, emitm_f(0));
+    emitm_fdtoi(NATIVECODE, emitm_f(0), emitm_f(2));
+    Parrot_jit_float_store(jit_info, interpreter, 1, emitm_f(2));
+}
+
+Parrot_if_i_ic {
+    Parrot_jit_int_load(jit_info, interpreter, 1, emitm_l(0));
+    emitm_subcc_r(NATIVECODE, emitm_l(0), emitm_g(0), emitm_g(0));
+    Parrot_jit_bicc(jit_info, emitm_bne, 0, *INT_CONST[2]);
+    emitm_nop(NATIVECODE);
+}
+
+Parrot_branch_ic {
+    Parrot_jit_bicc(jit_info, emitm_ba, 0, *INT_CONST[1]);
+    emitm_nop(NATIVECODE);
+}
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil 
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+ */
diff --exclude=CVS -urN parrot/jit/sun4/jit_emit.h parrot-jit/jit/sun4/jit_emit.h
--- parrot/jit/sun4/jit_emit.h  Wed Dec 31 19:00:00 1969
+++ parrot-jit/jit/sun4/jit_emit.h      Sun Mar 17 19:58:26 2002
@@ -0,0 +1,546 @@
+/* Sparc register numbers */
+#define emitm_g(n) (n)
+#define emitm_o(n) ((n) + 8)
+#define emitm_l(n) ((n) + 16)
+#define emitm_i(n) ((n) + 24)
+#define emitm_f(n) (n)
+
+#define emitm_FP emitm_i(6)
+#define emitm_SP emitm_o(6)
+
+#define emitm_mask(n, val) ((unsigned)(val) & ((1U << n) - 1))
+
+#define emitm_hi30(val)   ((unsigned)(val) >> 2)
+#define emitm_hi22(val)   ((unsigned)(val) >> 10)
+#define emitm_lo10(val)   emitm_mask(10, val)
+#define emitm_simm13(val) emitm_mask(13, val)
+
+#define emitm_opval(val)  ((unsigned)(val) << 30)
+#define emitm_op2val(val) ((unsigned)(val) << 22)
+#define emitm_op3val(val) ((unsigned)(val) << 19)
+#define emitm_rd(val)     ((unsigned)(val) << 25)
+#define emitm_rs1(val)    ((unsigned)(val) << 14)
+
+#define emitm_simm13_max 4095
+#define emitm_simm13_min -4096
+
+#define emitm_branch_max 8388607
+#define emitm_branch_min -8388608
+
+/* format 1 - only instruction */
+#define emitm_call_30(pc, disp30) { \
+    *(unsigned *)(pc) = emitm_opval(1) | (disp30); \
+    pc += 4; }
+
+/* format 2a - sethi primarily */
+#define emitm_2a(pc, op, rd, op2, imm22) { \
+    *(unsigned *)(pc) = emitm_opval(op) | emitm_rd(rd) | emitm_op2val(op2) | \
+               (imm22); \
+    pc += 4; }
+
+/* format 2b - branches */
+#define emitm_2b(pc, a, cond, op2, disp22) { \
+    *(unsigned *)(pc) = emitm_opval(0) | ((unsigned)(a) << 29) | \
+                        ((unsigned)(cond) << 25) | emitm_op2val(op2) | \
+                        emitm_mask(22, disp22); \
+                        pc += 4; }
+
+/* Generic fields of format 3 */
+#define emitm_fmt3(pc, op, rd, op3, rs1, low14) { \
+    *(unsigned *)pc = emitm_opval(op) |emitm_rd(rd) | emitm_op3val(op3) | \
+        emitm_rs1(rs1) | (low14); \
+    pc +=4 ; }
+
+#define emitm_3a(pc, op, rd, op3, rs1, asi, rs2) \
+    emitm_fmt3(pc, op, rd, op3, rs1, ((asi) << 5) | (rs2))
+
+/* format 3b */
+#define emitm_3b(pc, op, rd, op3, rs1, simm13) \
+    emitm_fmt3(pc, op, rd, op3, rs1, (1L << 13) | emitm_mask(13, (simm13)))
+
+/* format 3c */
+#define emitm_3c(pc, op, rd, op3, rs1, opf, rs2) \
+    emitm_fmt3(pc, op, rd, op3, rs1, (opf << 5) | (rs2))
+
+/* Miscellaneous instructions */
+
+/* sethi imm22, r[rd] */
+#define emitm_sethi(pc, imm22, rd) emitm_2a(pc, 0, rd, 04, imm22)
+
+/* NOP */
+#define emitm_nop(pc) emitm_sethi(pc, 0, 0)
+
+/* SAVE */
+
+#define emitm_save_r(pc, rs1, rs2, rd) emitm_3a(pc, 2, rd, 074, rs1, 0, rs2)
+#define emitm_save_i(pc, rs1, i, rd)   emitm_3b(pc, 2, rd, 074, rs1, i)
+
+/* RESTORE */
+#define emitm_restore_r(pc, rs1, rs2, rd) emitm_3a(pc, 2, rd, 075, rs1, 0, rd)
+#define emitm_restore_i(pc, rs1, i, rd)   emitm_3b(pc, 2, rd, 075, rs1, i)
+
+/* MOV */
+#define emitm_mov(pc, rs, rd) emitm_or_r(pc, emitm_g(0), rs, rd)
+
+/* Integer Register Loads */
+
+/* ldX[rs1 + simm13], rd */
+#define emitm_ldsb_i(pc, rs1, i, rd) emitm_3b(pc, 3, rd, 011, rs1, i)
+#define emitm_ldub_i(pc, rs1, i, rd) emitm_3b(pc, 3, rd, 001, rs1, i)
+#define emitm_ldsh_i(pc, rs1, i, rd) emitm_3b(pc, 3, rd, 012, rs1, i)
+#define emitm_lduh_i(pc, rs1, i, rd) emitm_3b(pc, 3, rd, 002, rs1, i)
+#define emitm_ld_i(pc, rs1, i, rd)   emitm_3b(pc, 3, rd, 000, rs1, i)
+#define emitm_ldd_i(pc, rs1, i, rd)  emitm_3b(pc, 3, rd, 003, rs1, i)
+
+/* ldX[rs1 + rs2], rd */
+#define emitm_ldsb_r(pc, rs1, rs2, rd) emitm_3a(pc, 3, rd, 011, rs1, 0, rs2)
+#define emitm_ldub_r(pc, rs1, rs2, rd) emitm_3a(pc, 3, rd, 001, rs1, 0, rs2)
+#define emitm_ldsh_r(pc, rs1, rs2, rd) emitm_3a(pc, 3, rd, 012, rs1, 0, rs2)
+#define emitm_lduh_r(pc, rs1, rs2, rd) emitm_3a(pc, 3, rd, 002, rs1, 0, rs2)
+#define emitm_ld_r(pc, rs1, rs2, rd)   emitm_3a(pc, 3, rd, 000, rs1, 0, rs2)
+#define emitm_ldd_r(pc, rs1, rs2, rd)  emitm_3a(pc, 3, rd, 003, rs1, 0, rs2)
+
+/* Integer Register Stores */
+
+/* stX rd, [rs1 + simm13] */
+#define emitm_stb_i(pc, rd, rs1, i) emitm_3b(pc, 3, rd, 005, rs1, i)
+#define emitm_sth_i(pc, rd, rs1, i) emitm_3b(pc, 3, rd, 006, rs1, i)
+#define emitm_st_i(pc, rd, rs1, i)  emitm_3b(pc, 3, rd, 004, rs1, i)
+#define emitm_std_i(pc, rd, rs1, i) emitm_3b(pc, 3, rd, 007, rs1, i)
+
+/* stX rd, [rs1 + rs2] */
+#define emitm_stb_r(pc, rd, rs1, rs2) emitm_3a(pc, 3, rd, 005, rs1, 0, rs2)
+#define emitm_sth_r(pc, rd, rs1, rs2) emitm_3a(pc, 3, rd, 006, rs1, 0, rs2)
+#define emitm_st_r(pc, rd, rs1, rs2)  emitm_3a(pc, 3, rd, 004, rs1, 0, rs2)
+#define emitm_std_r(pc, rd, rs1, rs2) emitm_3a(pc, 3, rd, 007, rs1, 0, rs2)
+
+/* Floating Point Register Loads */
+
+/* ldX[rs1 + simm13], freg[rd] */
+#define emitm_ldf_i(pc, rs1, i, rd)   emitm_3b(pc, 3, rd, 040, rs1, i)
+#define emitm_lddf_i(pc, rs1, i, rd)  emitm_3b(pc, 3, rd, 043, rs1, i)
+
+#define emitm_ldfsr_i(pc, rs1, i, rd) emitm_3b(pc, 3, rd, 041, rs1, i)
+
+/* ldX[rs1 + rs2], freg[rd] */
+#define emitm_ldf_r(pc, rs1, rs2, rd)   emitm_3a(pc, 3, rd, 040, rs1, 0, rs2)
+#define emitm_lddf_r(pc, rs1, rs2, rd)  emitm_3a(pc, 3, rd, 043, rs1, 0, rs2)
+
+#define emitm_ldfsr_r(pc, rs1, rs2, rd) emitm_3a(pc, 3, rd, 041, rs1, 0, rs2)
+
+/* Floating Point Register Stores */
+
+/* stX freg[rd], [rs1 + simm13] */
+#define emitm_stf_i(pc, rd, rs1, i)   emitm_3b(pc, 3, rd, 044, rs1, i)
+#define emitm_stdf_i(pc, rd, rs1, i)  emitm_3b(pc, 3, rd, 047, rs1, i)
+
+#define emitm_stfsr_i(pc, rd, rs1, i) emitm_3b(pc, 3, rd, 045, rs1, i)
+
+/* stX freg[rd], [rs1 + rs2] */
+#define emitm_stf_r_r(pc, rd, rs1, rs2)   emitm_3a(pc, 3, rd, 044, rs1, 0, rs2)
+#define emitm_stdf_r_r(pc, rd, rs1, rs2)  emitm_3a(pc, 3, rd, 047, rs1, 0, rs2)
+#define emitm_stfsr_r_r(pc, rd, rs1, rs2) emitm_3a(pc, 3, rd, 045, rs1, 0, rs2)
+
+/* Logical instructions */
+
+/* op r[rs1], r[rs2], r[rd] */
+#define emitm_logic_r(pc, op3, rs1, rs2, rd) \
+       emitm_3a(pc, 2, rd, op3, rs1, 0, rs2)
+
+/* op r[rs1], simm13, r[rd] */
+#define emitm_logic_i(pc, op3, rs1, simm13, rd) \
+       emitm_3b(pc, 2, rd, op3, rs1, simm13)
+
+#define emitm_and_r(pc, rs1, rs2, rd)    emitm_logic_r(pc, 001, rs1, rs2, rd)
+#define emitm_andcc_r(pc, rs1, rs2, rd)  emitm_logic_r(pc, 021, rs1, rs2, rd)
+#define emitm_andn_r(pc, rs1, rs2, rd)   emitm_logic_r(pc, 005, rs1, rs2, rd)
+#define emitm_andncc_r(pc, rs1, rs2, rd) emitm_logic_r(pc, 025, rs1, rs2, rd)
+#define emitm_and_i(pc, rs1, i, rd)      emitm_logic_i(pc, 001, rs1, i, rd)
+#define emitm_andcc_i(pc, rs1, i, rd)    emitm_logic_i(pc, 021, rs1, i, rd)
+#define emitm_andn_i(pc, rs1, i, rd)     emitm_logic_i(pc, 005, rs1, i, rd)
+#define emitm_andncc_i(pc, rs1, i, rd)   emitm_logic_i(pc, 025, rs1, i, rd)
+#define emitm_or_r(pc, rs1, rs2, rd)     emitm_logic_r(pc, 002, rs1, rs2, rd)
+#define emitm_orcc_r(pc, rs1, rs2, rd)   emitm_logic_r(pc, 022, rs1, rs2, rd)
+#define emitm_orn_r(pc, rs1, rs2, rd)    emitm_logic_r(pc, 006, rs1, rs2, rd)
+#define emitm_orncc_r(pc, rs1, rs2, rd)  emitm_logic_r(pc, 026, rs1, rs2, rd)
+#define emitm_or_i(pc, rs1, i, rd)       emitm_logic_i(pc, 002, rs1, i, rd)
+#define emitm_orcc_i(pc, rs1, i, rd)     emitm_logic_i(pc, 022, rs1, i, rd)
+#define emitm_orn_i(pc, rs1, i, rd)      emitm_logic_i(pc, 006, rs1, i, rd)
+#define emitm_orncc_i(pc, rs1, i, rd)    emitm_logic_i(pc, 026, rs1, i, rd)
+#define emitm_xor_r(pc, rs1, rs2, rd)    emitm_logic_r(pc, 003, rs1, rs2, rd)
+#define emitm_xorcc_r(pc, rs1, rs2, rd)  emitm_logic_r(pc, 023, rs1, rs2, rd)
+#define emitm_xorn_r(pc, rs1, rs2, rd)   emitm_logic_r(pc, 007, rs1, rs2, rd)
+#define emitm_xorncc_r(pc, rs1, rs2, rd) emitm_logic_r(pc, 027, rs1, rs2, rd)
+#define emitm_xor_i(pc, rs1, i, rd)      emitm_logic_i(pc, 003, rs1, i, rd)
+#define emitm_xorcc_i(pc, rs1, i, rd)    emitm_logic_i(pc, 023, rs1, i, rd)
+#define emitm_xorn_i(pc, rs1, i, rd)     emitm_logic_i(pc, 007, rs1, i, rd)
+#define emitm_xorncc_i(pc, rs1, i, rd)   emitm_logic_i(pc, 027, rs1, i, rd)
+
+/* Shift Left Logical */
+#define emitm_sll_r(pc, rs1, rs2, rd) emitm_3a(pc, 2, rd, 045, rs1, 0, rs2)
+#define emitm_sll_i(pc, rs1, i, rd)   emitm_3b(pc, 2, rd, 045, rs1, i)
+
+/* Shift Right Logical */
+#define emitm_srl_r(pc, rs1, rs2, rd) emitm_3a(pc, 2, rd, 046, rs1, 0, rs2)
+#define emitm_srl_i(pc, rs1, i, rd)   emitm_3b(pc, 2, rd, 046, rs1, i)
+
+/* Shift Right Arithmetic */
+#define emitm_sra_r(pc, rs1, rs2, rd) emitm_3a(pc, 2, rd, 047, rs1, 0, rs2)
+#define emitm_sra_i(pc, rs1, i, rd)   emitm_3a(pc, 2, rd, 047, rs1, i)
+
+/* Arithmetic ops */
+#define emitm_add_r(pc, rs1, rs2, rd)    emitm_3a(pc, 2, rd, 0, rs1, 0, rs2)
+#define emitm_addcc_r(pc, rs1, rs2, rd)  emitm_3a(pc, 2, rd, 020, rs1, 0, rs2)
+#define emitm_addX_r(pc, rs1, rs2, rd)   emitm_3a(pc, 2, rd, 010, rs1, 0, rs2)
+#define emitm_addXcc_r(pc, rs1, rs2, rd) emitm_3a(pc, 2, rd, 030, rs1, 0, rs2)
+#define emitm_add_i(pc, rs1, i, rd)      emitm_3b(pc, 2, rd, 0, rs1, i)
+#define emitm_addcc_i(pc, rs1, i, rd)    emitm_3b(pc, 2, rd, 020, rs1, i)
+#define emitm_addX_i(pc, rs1, i, rd)     emitm_3b(pc, 2, rd, 010, rs1, i)
+#define emitm_addXcc_i(pc, rs1, i, rd)   emitm_3b(pc, 2, rd, 030, rs1, i)
+
+/* Arithmetic ops */
+#define emitm_sub_r(pc, rs1, rs2, rd)    emitm_3a(pc, 2, rd, 004, rs1, 0, rs2)
+#define emitm_subcc_r(pc, rs1, rs2, rd)  emitm_3a(pc, 2, rd, 024, rs1, 0, rs2)
+#define emitm_subX_r(pc, rs1, rs2, rd)   emitm_3a(pc, 2, rd, 014, rs1, 0, rs2)
+#define emitm_subXcc_r(pc, rs1, rs2, rd) emitm_3a(pc, 2, rd, 034, rs1, 0, rs2)
+#define emitm_sub_i(pc, rs1, i, rd)      emitm_3b(pc, 2, rd, 004, rs1, i)
+#define emitm_subcc_i(pc, rs1, i, rd)    emitm_3b(pc, 2, rd, 024, rs1, i)
+#define emitm_subX_i(pc, rs1, i, rd)     emitm_3b(pc, 2, rd, 014, rs1, i)
+#define emitm_subXcc_i(pc, rs1, i, rd)   emitm_3b(pc, 2, rd, 034, rs1, i)
+
+/* Floating point operations */
+
+#define emitm_fitod(pc, rs, rd) emitm_3c(pc, 2, rd, 064, 0, 0310, rs)
+#define emitm_fdtoi(pc, rs, rd) emitm_3c(pc, 2, rd, 064, 0, 0322, rs)
+
+/* Jump and Link */
+
+#define emitm_jumpl_r(pc, rs1, rs2, rd) emitm_3a(pc, 2, rd, 070, rs1, 0, rs2)
+#define emitm_jumpl_i(pc, rs1, i, rd)   emitm_3b(pc, 2, rd, 070, rs1, i)
+
+/* RET */
+#define emitm_ret(pc) emitm_jumpl_i(pc, emitm_i(7), 8, emitm_g(0))
+
+#define emitm_ba   010
+#define emitm_bn   000
+#define emitm_bne  011
+#define emitm_be   001
+#define emitm_bg   012
+#define emitm_ble  002
+#define emitm_bge  013
+#define emitm_bl   003
+#define emitm_bgu  014
+#define emitm_bleu 004
+#define emitm_bcc  015
+#define emitm_bcs  005
+#define emitm_bpos 016
+#define emitm_bneg 006
+#define emitm_bvc  017
+#define emitm_bvs  007
+
+/* Branch */
+#define emitm_bicc(pc, a, cond, disp22) emitm_2b(pc, a, cond, 02, disp22)
+
+/*
+void main(){
+    char ar[1024];
+    char *ar2;
+
+    ar2 = &ar[0];
+    emitm_ld_r(ar2, emitm_g(0), emitm_i(1), emitm_o(7));
+    emitm_ldub_r(ar2, emitm_g(0), emitm_i(1), emitm_o(7));
+    emitm_ldsh_r(ar2, emitm_g(0), emitm_i(1), emitm_o(7));
+}
+*/
+
+/* Fixup types */
+enum  {JIT_BRANCH, JIT_CALL30 };
+
+/* Shortcuts for registers */
+#define Parrot_jit_intrp emitm_i(0)
+#define Parrot_jit_regbase emitm_i(1)
+#define Parrot_jit_opmap emitm_i(3)
+#define Parrot_jit_tmp emitm_l(7)
+
+#define Parrot_jit_regbase_ptr(i) &((i)->int_reg.registers[0])
+#define Parrot_jit_regoff(a, i) (unsigned)(a) - (unsigned)(Parrot_jit_regbase_ptr(i))
+
+/* Generate conditional branch to offset from current parrot op */
+static void Parrot_jit_bicc(Parrot_jit_info *jit_info, int cond, int annul,
+                            opcode_t disp)
+{
+    int offset;
+    opcode_t opcode;
+
+    opcode = jit_info->op_i + disp;
+    if(opcode <= jit_info->op_i){
+        offset = jit_info->op_map[opcode].offset -
+                    (jit_info->native_ptr - jit_info->arena_start);
+
+        if((offset > emitm_branch_max) || (offset < emitm_branch_min))
+            internal_exception(JIT_ERROR,
+                           "Branches beyond 8 Megabytes not yet supported\n"); 
+        offset /= 4;
+        emitm_bicc(jit_info->native_ptr, annul, cond, offset);
+        return;
+    }
+
+    Parrot_jit_newfixup(jit_info);
+    jit_info->fixups->type = JIT_BRANCH;
+    jit_info->fixups->param.opcode = opcode;
+    emitm_bicc(jit_info->native_ptr, annul, cond, 0);
+}
+
+static void Parrot_jit_int_load(Parrot_jit_info *jit_info,
+                             struct Parrot_Interp *interpreter,
+                             int param,
+                             int hwreg)
+{
+    opcode_t op_type;
+    int val;
+
+    op_type = interpreter->op_info_table[*jit_info->cur_op].types[param];
+    val = jit_info->cur_op[param];
+
+    switch(op_type){
+        case PARROT_ARG_IC:
+            if((val < emitm_simm13_min) || (val > emitm_simm13_max)){
+                emitm_sethi(jit_info->native_ptr, emitm_hi22(val), hwreg);
+                emitm_or_i(jit_info->native_ptr, hwreg, emitm_lo10(val),
+                           hwreg);
+            }
+            else {
+                emitm_or_i(jit_info->native_ptr, emitm_g(0), val, hwreg);
+            }
+
+            break;
+        case PARROT_ARG_NC:
+            val = (int)&interpreter->code->const_table->
+                    constants[val]->number;
+
+            /* Load double into integer registers */
+            emitm_sethi(jit_info->native_ptr, emitm_hi22(val), Parrot_jit_tmp);
+            emitm_ldd_i(jit_info->native_ptr, Parrot_jit_tmp, emitm_lo10(val),
+                        hwreg);
+            break;
+
+        case PARROT_ARG_I:
+            val = (int)&interpreter->int_reg.registers[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->num_reg.registers[val];
+            emitm_ldd_i(jit_info->native_ptr, Parrot_jit_regbase,
+                       Parrot_jit_regoff(val, interpreter), hwreg);
+            break;
+
+        default:
+            internal_exception(JIT_ERROR,
+                               "Unsupported op parameter type %d\n",
+                               op_type);
+    }
+}
+
+static void Parrot_jit_int_store(Parrot_jit_info *jit_info,
+                             struct Parrot_Interp *interpreter,
+                             int param,
+                             int hwreg)
+{
+    opcode_t op_type;
+    int val;
+
+    op_type = interpreter->op_info_table[*jit_info->cur_op].types[param];
+    val = jit_info->cur_op[param];
+
+    switch(op_type){
+        case PARROT_ARG_I:
+            val = (int)&interpreter->int_reg.registers[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->num_reg.registers[val];
+            emitm_std_i(jit_info->native_ptr, hwreg, Parrot_jit_regbase,
+                       Parrot_jit_regoff(val, interpreter));
+            break;
+
+        default:
+            internal_exception(JIT_ERROR,
+                            "Unsupported op parameter type %d\n", op_type);
+    }
+}
+
+static void Parrot_jit_float_load(Parrot_jit_info *jit_info,
+                             struct Parrot_Interp *interpreter,
+                             int param,
+                             int hwreg)
+{
+    opcode_t op_type;
+    int val;
+
+    op_type = interpreter->op_info_table[*jit_info->cur_op].types[param];
+    val = jit_info->cur_op[param];
+
+    switch(op_type){
+        case PARROT_ARG_I:
+            val = (int)&interpreter->int_reg.registers[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->num_reg.registers[val];
+            emitm_lddf_i(jit_info->native_ptr, Parrot_jit_regbase,
+                         Parrot_jit_regoff(val, interpreter), hwreg);
+            break;
+
+        default:
+            internal_exception(JIT_ERROR,
+                            "Unsupported op parameter type %d\n", op_type);
+    }
+}
+
+static void Parrot_jit_float_store(Parrot_jit_info *jit_info,
+                             struct Parrot_Interp *interpreter,
+                             int param,
+                             int hwreg)
+{
+    opcode_t op_type;
+    int val;
+
+    op_type = interpreter->op_info_table[*jit_info->cur_op].types[param];
+    val = jit_info->cur_op[param];
+
+    switch(op_type){
+        case PARROT_ARG_I:
+            val = (int)&interpreter->int_reg.registers[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->num_reg.registers[val];
+            emitm_stdf_i(jit_info->native_ptr, hwreg, Parrot_jit_regbase,
+                       Parrot_jit_regoff(val, interpreter));
+            break;
+
+        default:
+            internal_exception(JIT_ERROR,
+                            "Unsupported op parameter type %d\n", op_type);
+    }
+}
+
+
+void Parrot_jit_dofixup(Parrot_jit_info *jit_info,
+                        struct Parrot_Interp * interpreter)
+{
+    Parrot_jit_fixup *fixup;
+    Parrot_jit_fixup *last_fixup;
+    char *fixup_ptr;
+    int fixup_val;
+
+    fixup = jit_info->fixups;
+
+    while(fixup){
+        switch(fixup->type){
+           /* This fixes-up a branch to a known opcode offset */
+            case JIT_BRANCH:
+               fixup_ptr = Parrot_jit_fixup_target(jit_info, fixup);
+                fixup_val = (jit_info->op_map[fixup->param.opcode].offset
+                                - fixup->native_offset) / 4;
+               *(int *)(fixup_ptr) |= emitm_mask(22, fixup_val);
+                break;
+
+           case JIT_CALL30:
+               fixup_ptr = jit_info->arena_start + fixup->native_offset;
+               fixup_val = (int)fixup->param.fptr - (int)fixup_ptr;
+               emitm_call_30(fixup_ptr, emitm_hi30(fixup_val));
+               break;
+
+           default:
+               internal_exception(JIT_ERROR, "Unknown fixup type:%d\n",
+                                       fixup->type);
+               break;
+        }
+       fixup = fixup->next;
+    }
+}
+
+void Parrot_jit_begin(Parrot_jit_info *jit_info,
+                      struct Parrot_Interp * interpreter)
+{
+    int ireg0_offset;
+
+    /* Standard Prolog */
+    emitm_save_i(jit_info->native_ptr, emitm_SP, -104, emitm_SP);
+
+    /* Calculate the offset of I0 in the interpreter struct */
+    ireg0_offset = (int)Parrot_jit_regbase_ptr(interpreter) -
+        (int)interpreter;
+
+    if(ireg0_offset > 4095){
+        internal_exception(JIT_ERROR,
+                           "Unable to support interpreter structure\n" );
+    }
+
+    /* Calculate the address of I0 */
+    /* All parrot registers will be addressed relative to I0 */
+    emitm_add_i(jit_info->native_ptr, Parrot_jit_intrp, ireg0_offset,
+                Parrot_jit_regbase);
+
+    /* Setup the pointer to the opcode map */
+    emitm_sethi(jit_info->native_ptr,
+               emitm_hi22(jit_info->op_map), Parrot_jit_opmap);
+    emitm_or_i(jit_info->native_ptr,
+               emitm_i(3), emitm_lo10(jit_info->op_map), Parrot_jit_opmap);
+}
+
+void Parrot_jit_normal_op(Parrot_jit_info *jit_info,
+                          struct Parrot_Interp * interpreter)
+{
+    emitm_sethi(jit_info->native_ptr, emitm_hi22(jit_info->cur_op), emitm_o(0));
+    emitm_or_i(jit_info->native_ptr,
+               emitm_o(0), emitm_lo10(jit_info->cur_op), emitm_o(0));
+
+    Parrot_jit_newfixup(jit_info);
+    jit_info->fixups->type = JIT_CALL30;
+    jit_info->fixups->param.fptr =
+        (void (*)(void))interpreter->op_func_table[*(jit_info->cur_op)];
+
+    emitm_call_30(jit_info->native_ptr, 0);
+    emitm_mov(jit_info->native_ptr, Parrot_jit_intrp, emitm_o(1));
+}
+
+void Parrot_jit_cpcf_op(Parrot_jit_info *jit_info,
+                        struct Parrot_Interp * interpreter)
+{
+    Parrot_jit_normal_op(jit_info, interpreter);
+
+    emitm_sethi(jit_info->native_ptr, emitm_hi22(interpreter->code->byte_code),
+               emitm_l(1));
+    emitm_or_i(jit_info->native_ptr, emitm_l(1),
+               emitm_lo10(interpreter->code->byte_code), emitm_l(1));
+
+    /* This calculates offset into op_map shadow array */
+    emitm_sub_r(jit_info->native_ptr, emitm_o(0), emitm_l(1), emitm_o(0));
+
+    /* Load the address of the native code from op_map */
+    emitm_ld_r(jit_info->native_ptr, emitm_i(3), emitm_o(0), emitm_o(0));
+
+    /* This jumps to the address from op_map */
+    emitm_jumpl_i(jit_info->native_ptr, emitm_o(0), 0, emitm_g(0));
+    emitm_nop(jit_info->native_ptr);
+}
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil 
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+ */
diff --exclude=CVS -urN parrot/jit.c parrot-jit/jit.c
--- parrot/jit.c        Thu Mar  7 23:14:42 2002
+++ parrot-jit/jit.c    Fri Mar 22 07:30:51 2002
@@ -1,12 +1,11 @@
 /*
- * jit.c
- *
- * $Id: jit.c,v 1.16 2002/03/08 04:14:42 josh Exp $
- */
+** jit.c
+**
+** $Id: jit.c,v 1.12 2002/01/29 14:05:31 grunblatt Exp $
+*/
 
 #include <parrot/parrot.h>
 #include "parrot/jit.h"
-#include "parrot/jit_struct.h"
 
 
 /* Don't ever count on any info here */
@@ -17,584 +16,120 @@
 
 /* Constants */
 
-INTVAL const_intval[3] = { (INTVAL)0, (INTVAL)0, (INTVAL)0 };
+INTVAL const_intval[3] = { (INTVAL)0,(INTVAL)0,(INTVAL)0 };
 FLOATVAL floatval_constants[1] = { 1000000.0 };
 char char_constants[] = "%f";
 
-INTVAL *op_real_address;
-
 /*
- * build_asm()
- */
+** build_asm()
+*/
 
 jit_f
-build_asm(struct Parrot_Interp *interpreter, opcode_t *pc,
-          opcode_t *code_start, opcode_t *code_end)
+build_asm(struct Parrot_Interp *interpreter,opcode_t *pc, opcode_t *code_start, 
+opcode_t *code_end)
 {
-    char *arena, *arena_start;
-    INTVAL *address, ivalue, size, i, k;
-    INTVAL *op_address, prev_address, bytecode_position;
-#ifdef ALPHA
-    char *interpreter_registers =
-        ((char *)&interpreter->int_reg.registers[0]) + 0x7fff;
-    INTVAL high, low;
-#endif
+    INTVAL *address,ivalue,i,k;
+    INTVAL bytecode_position;
+    char *new_arena;
+    void *prev_address;
+    Parrot_jit_info jit_info;
+    opcode_t cur_opcode_byte;
 
-
-    /* temporary variables */
-
-    substitution_t v;
-    string_substitution_t sv;
-    temp_int_substitution_t tiv;
     STRING *s;
 
-    /* how should I allocate memory? */
-    op_address =
-        (INTVAL *)malloc((code_end - code_start + START_SIZE + 3) *
-                         sizeof(INTVAL));
-
-    op_real_address =
-        (INTVAL *)malloc((code_end - code_start + START_SIZE + 3) *
-                         sizeof(INTVAL));
+    /* Byte code size in opcode_t's */
+    jit_info.map_size = (code_end - code_start);
+    jit_info.op_map = (Parrot_jit_opmap *)mem_sys_allocate(
+                            jit_info.map_size * sizeof(*(jit_info.op_map)) );
+    
+    /* This memory MUST be zeroed for conversion of offsets to pointers to 
+     * work later
+     */
+    memset(jit_info.op_map, 0, jit_info.map_size * sizeof(*(jit_info.op_map)));
+
+    jit_info.arena_size = 1024;
+    jit_info.native_ptr = jit_info.arena_start =
+        mem_sys_allocate(jit_info.arena_size);
+
+    jit_info.op_i = 0;
+    jit_info.cur_op = pc;
+    jit_info.fixups = NULL;
 
     /* intval constants */
     const_intval[0] = (INTVAL)stdout;
     const_intval[1] = (INTVAL)STACK_ENTRY_DESTINATION;
-    const_intval[2] = (INTVAL)op_real_address;
-
-    k = 0;
-
-    /* The size in bytes that the whole program will have */
-    size = START_SIZE;
-
-    /* 
-     * op_address holds the displacement from arena_start 
-     * and the start of each parrot op 
-     * at the same position in the parrot bytecode:
-     * 
-     * bytecode:       56  1   1   56  1   1
-     * op_address:     3   0   0   15  0   0
-     */
-
-    op_address[k] = START_SIZE;
-    prev_address = START_SIZE;
-    while (pc < code_end) {
-        k += op_assembly[*pc].nargop;
-        prev_address = op_address[k] = prev_address + op_assembly[*pc].size;
-        size += op_assembly[*pc].size;
-        pc += op_assembly[*pc].nargop;
-    }
-
-    bytecode_position = 0;
-    arena_start = arena = malloc((unsigned int)size);
-
-    pc = code_start;
-
-    /* Make the arena look like a subroutine */
-    memcpy(arena, &START, START_SIZE);
-    arena += START_SIZE;
 
     /* 
-     * Loop again over all the opcodes.
-     * Concatenate the position independent code 
-     * of each parrot opcode and place 
-     * the correct addresses in the correct place 
-     * this is done using the opcode_assembly_t structure
-     * where we have all the information we need 
-     * about how many register and of which type 
-     * the opcode requires.
+     *   op_map holds the offset from arena_start 
+     *   of the parrot op at the given opcode index
+     *
+     *  bytecode:       56  1   1   56  1   1
+     *  op_map:     3   0   0   15  0   0
      */
 
-    while (pc < code_end) {
-        memcpy(arena, op_assembly[*pc].assembly, op_assembly[*pc].size);
-        op_real_address[bytecode_position] =
-            (INTVAL)arena_start + op_address[bytecode_position];
-
-        /* Address of a INTVAL register */
-        v = op_assembly[*pc].intval_register_address;
-        for (i = 0; i < v.amount; i++) {
-            address = &interpreter->int_reg.registers[pc[v.info[i].number]];
-#ifdef SUN4
-            address =
-                (INTVAL *)(((char *)address) -
-                           (char *)&interpreter->int_reg.registers[0]);
-            write_lo_13(&arena[v.info[i].position], (ptrcast_t)address);
-#else
-#  ifdef ALPHA
-            address = (INTVAL *)(((char *)address) - interpreter_registers);
-#  endif
-            memcpy(&arena[v.info[i].position], &address, OP_ARGUMENT_SIZE);
-#endif
-        }
-        /* Address of a NUMVAL register */
-        v = op_assembly[*pc].floatval_register_address;
-        for (i = 0; i < v.amount; i++) {
-            address =
-                (INTVAL *)&interpreter->num_reg.
-                registers[pc[v.info[i].number]];
-#ifdef SUN4
-            address =
-                (INTVAL *)(((char *)address) -
-                           (char *)&interpreter->num_reg.registers[0]);
-            write_lo_13(&arena[v.info[i].position], (ptrcast_t)address);
-#else
-#  ifdef ALPHA
-            address = (INTVAL *)(((char *)address) - interpreter_registers);
-#  endif
-            memcpy(&arena[v.info[i].position], &address, OP_ARGUMENT_SIZE);
-#endif
-        }
-
-        /* the address where will be a STRING register */
-
-        v = op_assembly[*pc].string_register_address;
-        for (i = 0; i < v.amount; i++) {
-            address =
-                (INTVAL *)&interpreter->string_reg.
-                registers[pc[v.info[i].number]];
-#ifdef SUN4
-            address =
-                (INTVAL *)(((char *)address) -
-                           (char *)&interpreter->string_reg.registers[0]);
-            write_lo_13(&arena[v.info[i].position], (ptrcast_t)address);
-#else
-#  ifdef ALPHA
-            address = (INTVAL *)(((char *)address) - interpreter_registers);
-#  endif
-            memcpy(&arena[v.info[i].position], &address, OP_ARGUMENT_SIZE);
-#endif
-        }
-
-        v = op_assembly[*pc].intval_constant_value;
-        for (i = 0; i < v.amount; i++) {
-            ivalue = pc[v.info[i].number];
-            memcpy(&arena[v.info[i].position], &ivalue, sizeof(ivalue));
-        }
-        v = op_assembly[*pc].intval_constant_address;
-        for (i = 0; i < v.amount; i++) {
-            address = &pc[v.info[i].number];
-#ifdef SUN4
-            write_32(&arena[v.info[i].position], (ptrcast_t)address);
-#else
-#  ifdef ALPHA
-            calculate_displacement((INTVAL *)arena_start, address, &high,
-                                   (INTVAL *)&address);
-            memcpy(&arena[v.info[i].position - 4], &high, OP_ARGUMENT_SIZE);
-#  endif
-            memcpy(&arena[v.info[i].position], &address, OP_ARGUMENT_SIZE);
-#endif
-        }
-        v = op_assembly[*pc].floatval_constant_address;
-        for (i = 0; i < v.amount; i++) {
-            address =
-                (INTVAL *)&interpreter->code->const_table->
-                constants[pc[v.info[i].number]]->number;
-#ifdef SUN4
-            write_32(&arena[v.info[i].position], (ptrcast_t)address);
-#else
-#  ifdef ALPHA
-            calculate_displacement((INTVAL *)arena_start, address, &high,
-                                   (INTVAL *)&address);
-            memcpy(&arena[v.info[i].position - 4], &high, OP_ARGUMENT_SIZE);
-#  endif
-            memcpy(&arena[v.info[i].position], &address, OP_ARGUMENT_SIZE);
-#endif
-        }
-
-        /* Address of a STRING constant or one of it's elements */
-        /* &SC */
-        sv = op_assembly[*pc].string_constant_address;
-        for (i = 0; i < sv.amount; i++) {
-            s = interpreter->code->const_table->
-                constants[pc[sv.info[i].number]]->string;
-            switch (sv.info[i].flag) {
-            case 0:
-                address = (INTVAL *)s;
-                break;
-            case 1:
-                address = (INTVAL *)s->bufstart;
-                break;
-            case 2:
-                address = (INTVAL *)&s->buflen;
-                break;
-            case 3:
-                address = (INTVAL *)&s->flags;
-                break;
-            case 4:
-                address = (INTVAL *)&s->bufused;
-                break;
-            case 5:
-                address = (INTVAL *)&s->strlen;
-                break;
-            case 6:
-                address = (INTVAL *)&s->encoding;
-                break;
-            case 7:
-                address = (INTVAL *)&s->type;
-                break;
-            case 8:
-                address = &s->language;
-                break;
-            }
-
-#ifdef SUN4
-            write_32(&arena[sv.info[i].position], (ptrcast_t)address);
-#else
-#  ifdef ALPHA
-            calculate_displacement((INTVAL *)arena_start, address, &high,
-                                   (INTVAL *)&address);
-            memcpy(&arena[sv.info[i].position - 4], &high, OP_ARGUMENT_SIZE);
-#  endif
-            memcpy(&arena[sv.info[i].position], &address, OP_ARGUMENT_SIZE);
-#endif
-        }
-
-        /* value of string constant or one of the elements */
-        /* *SC */
-        sv = op_assembly[*pc].string_constant_value;
-        for (i = 0; i < sv.amount; i++) {
-            s = interpreter->code->const_table->
-                constants[pc[sv.info[i].number]]->string;
-            switch (sv.info[i].flag) {
-                /* case 1: 
-                 * ivalue = 
*interpreter->code->const_table->constants[pc[op_assembly[*pc].string_constant_value.variable[i].number]]->string->bufstart;
-                 * break;
-             */ case 2:
-                ivalue = s->buflen;
-                break;
-            case 3:
-                ivalue = s->flags;
-                break;
-            case 4:
-                ivalue = s->bufused;
-                break;
-            case 5:
-                ivalue = s->strlen;
-                break;
-                /*  case 6: 
-                 * ivalue = 
(INTVAL)interpreter->code->const_table->constants[pc[op_assembly[*pc].string_constant_value.variable[i].number]]->string->encoding;
-                 * break;
-                 * case 7: 
-                 * ivalue = 
(INTVAL)interpreter->code->const_table->constants[pc[op_assembly[*pc].string_constant_value.variable[i].number]]->string->type;
-                 * break; */
-            case 8:
-                ivalue = s->language;
-                break;
-            }
-
-            memcpy(&arena[sv.info[i].position], &ivalue, sizeof(ivalue));
-        }
-
-        tiv = op_assembly[*pc].temporary_intval_address;
-        for (i = 0; i < tiv.amount; i++) {
-            address = &temp_intval[tiv.info[i].number];
-#ifdef ALPHA
-            calculate_displacement((INTVAL *)arena_start, address, &high,
-                                   (INTVAL *)&address);
-            memcpy(&arena[tiv.info[i].position - 4], &high, OP_ARGUMENT_SIZE);
-#endif
-            memcpy(&arena[tiv.info[i].position], &address, OP_ARGUMENT_SIZE);
-        }
-        v = op_assembly[*pc].temporary_char_address;
-        /* temporary char address */
-        for (i = 0; i < v.amount; i++) {
-            address = (INTVAL *)&temp_char[v.info[i].number];
-#ifdef ALPHA
-            calculate_displacement((INTVAL *)arena_start, address, &high,
-                                   (INTVAL *)&address);
-            memcpy(&arena[v.info[i].position - 4], &high, OP_ARGUMENT_SIZE);
-#endif
-            memcpy(&arena[v.info[i].position], &address, OP_ARGUMENT_SIZE);
-        }
-
-        v = op_assembly[*pc].constant_intval_value;
-        /* constant_intval_value */
-        for (i = 0; i < v.amount; i++) {
-            ivalue = const_intval[v.info[i].number];
-            memcpy(&arena[v.info[i].position], &ivalue, sizeof(ivalue));
-        }
-
-        v = op_assembly[*pc].constant_intval_address;
-        /* constant_intval_address */
-        for (i = 0; i < v.amount; i++) {
-            address = &const_intval[v.info[i].number];
-#ifdef SUN4
-            write_32(&arena[v.info[i].position], (ptrcast_t)address);
-#else
-#  ifdef ALPHA
-            calculate_displacement((INTVAL *)arena_start, address, &high,
-                                   (INTVAL *)&address);
-            memcpy(&arena[v.info[i].position - 4], &high, OP_ARGUMENT_SIZE);
-#  endif
-            memcpy(&arena[v.info[i].position], &address, OP_ARGUMENT_SIZE);
-#endif
-        }
-
-
-        v = op_assembly[*pc].constant_floatval_address;
-        /* FLOATVAL CONSTANTS */
-        for (i = 0; i < v.amount; i++) {
-            address = (INTVAL *)&floatval_constants[v.info[i].number];
-#ifdef SUN4
-            write_32(&arena[v.info[i].position], (ptrcast_t)address);
-#else
-#  ifdef ALPHA
-            calculate_displacement((INTVAL *)arena_start, address, &high,
-                                   (INTVAL *)&address);
-            memcpy(&arena[v.info[i].position - 4], &high, OP_ARGUMENT_SIZE);
-#  endif
-            memcpy(&arena[v.info[i].position], &address, OP_ARGUMENT_SIZE);
-#endif
-        }
-        v = op_assembly[*pc].constant_char_address;
-        /* CHAR CONSTANTS */
-        for (i = 0; i < v.amount; i++) {
-            address = (INTVAL *)&char_constants[v.info[i].number];
-#ifdef ALPHA
-            calculate_displacement((INTVAL *)arena_start, address, &high,
-                                   (INTVAL *)&address);
-            memcpy(&arena[v.info[i].position - 4], &high, OP_ARGUMENT_SIZE);
-#endif
-            memcpy(&arena[v.info[i].position], &address, OP_ARGUMENT_SIZE);
-        }
-
-        /* BRANCHES */
-        v = op_assembly[*pc].jump_int_const;
-        for (i = 0; i < v.amount; i++) {
-            address = (INTVAL *)
-                (arena_start +
-                 op_address[bytecode_position + pc[v.info[i].number]
-                 ]
-                );
-
-#ifdef SUN4
-            address =
-                (INTVAL *)((char *)address - (arena + v.info[i].position - 3));
-            write_22(&arena[v.info[i].position], (ptrcast_t)address);
-#else
-            ivalue = (INTVAL)(arena + v.info[i].position) + 4;
-
-            if (address > (INTVAL *)ivalue) {
-                address = (INTVAL *)((char *)address - (char *)ivalue);
-            }
-            else if (address < (INTVAL *)ivalue) {
-                address = (INTVAL *)
-                    (-(arena - (char *)address + op_assembly[*pc].size));
-            }
-            else {
-                address = 0;
-            }
-#  ifdef ALPHA
-            address = (INTVAL *)((INTVAL)address / 4);
-            arena[v.info[i].position + 2] |=
-                (*(((char *)&address) + 2) & 0x1f);
-#  endif
-
-            memcpy(&arena[v.info[i].position], &address, OP_ARGUMENT_SIZE);
-#endif
-        }
-
-        /* XXX the idea is to write all this functions in asm */
-        v = op_assembly[*pc].libc_c;
-        for (i = 0; i < v.amount; i++) {
-            switch (v.info[i].number) {
-            case 0:
-                address = (INTVAL *)printf;
-                break;
-            case 1:
-                address = (INTVAL *)fflush;
-                break;
-            case 2:
-                address = (INTVAL *)string_copy;
-                break;
-            case 3:
-                address = (INTVAL *)string_compare;
-                break;
-            case 4:
-                address = (INTVAL *)stack_pop;
-                break;
-            case 5:
-                address = (INTVAL *)stack_push;
-                break;
-            case 6:
-                address = (INTVAL *)interpreter->op_func_table[*pc];
-                break;
-            }
-#ifdef SUN4
-            address =
-                (INTVAL *)((char *)address - (arena + v.info[i].position - 3));
-            write_30(&arena[v.info[i].position], (ptrcast_t)address);
-#else
-#  ifdef ALPHA
-            calculate_displacement((INTVAL *)arena_start, address, &high,
-                                   &low);
-            memcpy(&arena[v.info[i].position - 12], &high, OP_ARGUMENT_SIZE);
-            memcpy(&arena[v.info[i].position - 8], &low, OP_ARGUMENT_SIZE);
-#  endif
-
-            ivalue = (INTVAL)(arena + v.info[i].position) + 4;
-
-            if (address > (INTVAL *)arena) {
-                address = (INTVAL *)((char *)address - (char *)ivalue);
-            }
-            else {
-                address = (INTVAL *)
-                    (-(arena - (char *)address + v.info[i].position + 4));
-            }
-#  ifdef ALPHA
-            address = (INTVAL *)((INTVAL)address / 4);
-            arena[v.info[i].position + 2] |=
-                (*(((char *)&address) + 2) & 0x1f);
-#  endif
-
-            memcpy(&arena[v.info[i].position], &address, OP_ARGUMENT_SIZE);
-#endif
-        }
-
-        v = op_assembly[*pc].interpreter;
-        for (i = 0; i < v.amount; i++) {
-            switch (v.info[i].number) {
-            case 0:
-                address = (INTVAL *)interpreter;
-                break;
-            case 1:
-                address = (INTVAL *)interpreter->control_stack;
-                break;
-            }
-#ifdef SUN4
-            write_32(&arena[v.info[i].position], (ptrcast_t)address);
-#else
-#  ifdef ALPHA
-            calculate_displacement((INTVAL *)arena_start, address, &high,
-                                   (INTVAL *)&address);
-            memcpy(&arena[v.info[i].position - 4], &high, OP_ARGUMENT_SIZE);
-#  endif
-            memcpy(&arena[v.info[i].position], &address, OP_ARGUMENT_SIZE);
-#endif
-        }
+    Parrot_jit_begin(&jit_info, interpreter);
+    jit_info.op_map[jit_info.op_i].offset = 
+                                    jit_info.native_ptr - jit_info.arena_start;
+    while (jit_info.cur_op < code_end)
+    {
+        /* Grow the arena early */ 
+        if(jit_info.arena_size < (jit_info.op_map[jit_info.op_i].offset + 100)){
+            new_arena = mem_sys_realloc(jit_info.arena_start,
+                                        jit_info.arena_size * 2);
+            jit_info.arena_size *= 2;
+            jit_info.native_ptr = new_arena +
+                                (jit_info.native_ptr - jit_info.arena_start);
+            jit_info.arena_start = new_arena;
+        }
+
+        /* Generate native code for current op */
+        cur_opcode_byte = *jit_info.cur_op;
+        (op_jit[cur_opcode_byte].fn)(&jit_info, interpreter);
+
+        /* update op_i and cur_op accordingly */ 
+        jit_info.op_i += op_jit[cur_opcode_byte].nargop;
+        jit_info.cur_op += op_jit[cur_opcode_byte].nargop;
 
-        v = op_assembly[*pc].cur_opcode;;
-        /* cur_opcode */
-        for (i = 0; i < v.amount; i++) {
-            if (v.info[i].number) {
-                ivalue = (INTVAL)(pc - code_start) + v.info[i].number - 1;
-                memcpy(&arena[v.info[i].position], &ivalue, sizeof(ivalue));
-            }
-            else {
-                address = (INTVAL *)pc;
-#ifdef SUN4
-                write_32(&arena[v.info[i].position], (ptrcast_t)address);
-#else
-#  ifdef ALPHA
-                calculate_displacement((INTVAL *)arena_start, address, &high,
-                                       (INTVAL *)&address);
-                memcpy(&arena[v.info[i].position - 4], &high,
-                       OP_ARGUMENT_SIZE);
-#  endif
-                memcpy(&arena[v.info[i].position], &address, OP_ARGUMENT_SIZE);
-#endif
-            }
-        }
-
-        /* Keep it pointing to "where the code goes" */
-        arena += op_assembly[*pc].size;
-
-        ivalue = op_assembly[*pc].nargop;
-        /* Replace the op number in the bytecode with a pointer to
-         * the start of jitted code for that opcode */
-        *pc = op_real_address[bytecode_position];
-        bytecode_position += ivalue;
-        pc += ivalue;
+        jit_info.op_map[jit_info.op_i].offset =
+                                    jit_info.native_ptr - jit_info.arena_start;
     }
 
-    return (jit_f) arena_start;
-}
+    /* Do fixups before converting offsets */
+    Parrot_jit_dofixup(&jit_info, interpreter);
 
-#ifdef ALPHA
-/* calculates the proper values for the displacement 
-   from src_address to dest_address.
-   returned values should be interpreted as:
-   dest_address = src_address + *high * 65536 + *low  
-*/
-void
-calculate_displacement(INTVAL *src_address, INTVAL *dest_address, INTVAL *high,
-                       INTVAL *low)
-{
-    char *displacement = (char *)((char *)dest_address - (char *)src_address);
+    /* Convert offsets to pointers */
+    for(i = 0; i < jit_info.map_size; i++){
 
-    *high = (INTVAL)displacement / 65536;
-    *low = (INTVAL)displacement % 65536;
-    if (*low > 32767) {
-        *high += 1;
-        *low -= 65536;
-    }
-    else if (*low < -32767) {
-        *high -= 1;
-        *low += 65536;
+        /* Assuming native code chunks contain some initialization code, 
+         * the first op (and every other op) is at an offset > 0
+         */
+        if(jit_info.op_map[i].offset){
+            jit_info.op_map[i].ptr = (char *)jit_info.arena_start +
+                                                jit_info.op_map[i].offset; 
+        }
     }
-}
-#endif
 
-#ifdef SUN4
-
-/* Write 13 bit immediate value into an instruction */
-static void
-write_lo_13(char *instr_end, ptrcast_t value)
-{
-    value &= 0x1fff;
-    *instr_end = (char)(value & 0xff);
-    *(instr_end - 1) |= (char)(value >> 8);
+    return (jit_f)jit_info.arena_start;
 }
 
-/* Write 22 bit immediate value into sethi instructions */
-static void
-write_hi_22(char *instr_end, ptrcast_t value)
-{
-    value >>= 10;
-    *(instr_end - 4) = (char)(value & 0xff);
-    value >>= 8;
-    *(instr_end - 5) = (char)(value & 0xff);
-    value >>= 8;
-    *(instr_end - 6) |= (char)(value & 0x3f);   /* This is really just 6 bits */
-}
+/* Remember the current position in the native code for later update */
 
-/* Write 22 bit immediate value into PC relative branches */
-static void
-write_22(char *instr_end, ptrcast_t value)
-{
-    value /= 4;                 /* divide displacement by 4 */
-    *(instr_end--) = (char)(value & 0xff);
-    value >>= 8;
-    *(instr_end--) = (char)(value & 0xff);
-    value >>= 8;
-    *instr_end |= (char)(value & 0x3f); /* This is really just 6 bits */
-}
+void Parrot_jit_newfixup(Parrot_jit_info *jit_info){
+    Parrot_jit_fixup *fixup;
 
-/* Write 30 bit value into PC relative call instruction */
-static void
-write_30(char *instr_end, ptrcast_t value)
-{
-    value /= 4;
-    *(instr_end--) = (char)(value & 0xff);
-    value >>= 8;
-    *(instr_end--) = (char)(value & 0xff);
-    value >>= 8;
-    *(instr_end--) = (char)(value & 0xff);
-    value >>= 8;
-    *instr_end |= (char)(value & 0x3f);
-}
+    fixup = mem_sys_allocate(sizeof(*fixup));
+    if(fixup == NULL){
+        internal_exception(ALLOCATION_ERROR,
+                            "System memory allocation failed\n"); 
+    }
 
-/* Write a 32 bit value into a sethi instruction followed by an instruction 
- * with a 13 bit immediate */
-static void
-write_32(char *instr_end, ptrcast_t value)
-{
-    write_lo_13(instr_end, value & 0x3ff);
-    write_hi_22(instr_end, value);
+    /* Insert fixup at the head of the list */
+    fixup->next = jit_info->fixups;
+    jit_info->fixups = fixup;
+
+    /* Fill in the native code offset */
+    fixup->native_offset =
+            (ptrdiff_t)(jit_info->native_ptr - jit_info->arena_start);
 }
-
-#endif
-
 
 /*
  * Local variables:
diff --exclude=CVS -urN parrot/jit2h.pl parrot-jit/jit2h.pl
--- parrot/jit2h.pl     Fri Mar  8 21:05:54 2002
+++ parrot-jit/jit2h.pl Sun Mar 24 18:26:45 2002
@@ -2,48 +2,38 @@
 #
 # jit2h.pl
 #
-# $Id: jit2h.pl,v 1.18 2002/03/09 02:05:54 josh Exp $
+# $Id: jit2h.pl,v 1.16 2002/01/30 23:19:44 sfink Exp $
 #
 
 use strict;
 use lib 'lib';
-use Parrot::Jit;
 use Parrot::OpLib::core;
 use Parrot::Op;
+use Parrot::OpTrans::C;
+
+my %type_to_arg = (
+    INT_CONST => 'ic',
+    NUM_CONST => 'nc',
+    STRING_CONST => 'sc',
+    INT_REG => 'i',
+    NUM_REG => 'n',
+    PMC_REG => 'p',
+    STRING_REG => 's',
+);
 
 my $core_numops = scalar(@$Parrot::OpLib::core::ops);
 my @core_opfunc = map { $_->func_name } @$Parrot::OpLib::core::ops;
 
 my $cpuarch = shift @ARGV;
 
-#
-# XXX I did NOT had the time to read the PMC code so I don't know if this
-# structure will be enough, it will not.
-#
-
 my ($i,$j,$k,$n);
 
 my ($function, $body, $line);
 
-my ($position, $bytecode, $type, $number, $size, $char, $move, $strflag, $asm, 
$precompiled);
+my ($asm, $precompiled);
 
-my (%core_ops, %string, %lib, $arg, $tmp, $which, $argc, $argv, $syscall, 
$tmp_bytecode, $nargop);
+my (%core_ops, %string, %lib);
 
-my (@values);
-my (@value_p);
-my (@value_n);
-my (@value_f);
-
-# Don't know if this should be keep separate per plataform, but that's easy.
-my %Call = (
-    "printf"                => 0,
-    "fflush"                => 1,
-    "string_copy"           => 2,
-    "string_compare"        => 3,
-    "pop_generic_entry"     => 4,
-    "push_generic_entry"    => 5,
-    "Parrot_op"             => 6
-);
 
 sub readjit($) {
     my $file = shift;
@@ -59,413 +49,81 @@
             $asm = "";
             next;
         }
-        if ($line =~ m/}/) {
-            $ops{$function} = Parrot::Jit->Assemble($asm);
+        if ($line =~ m/^}/) {
+           $asm =~ s/([\&\*])([a-zA-Z_]+)\[(\d+)\]/make_subs($1,$2,$3)/ge;
+            $asm =~ s/NEW_FIXUP/Parrot_jit_newfixup(jit_info)/g;
+            $asm =~ s/CUR_FIXUP/jit_info->fixups/g;
+            $asm =~ s/NATIVECODE/jit_info->native_ptr/g;
+            $asm =~ s/CUR_OPCODE/jit_info->cur_op/g;
+            $asm =~ s/cur_opcode/jit_info->cur_op/g;
+            $ops{$function} = $asm;
             $function = undef;
-            $body = undef;
         }
         $asm .= $line;
     }
     return %ops;
 }
 
-%core_ops = readjit("jit/$cpuarch/core.jit");
-%string = readjit("jit/$cpuarch/string.jit");
-%lib = readjit("jit/$cpuarch/lib.jit");
+open JITCPU, ">$ARGV[0]" or die;
 
-my $start = Parrot::Jit->init();
-
-print <<END_C;
+print JITCPU<<END_C;
 /*
  * !!!!!!!   DO NOT EDIT THIS FILE   !!!!!!!
  *
- * This file is generated automatically from '*.jit in jit/$cpuarch'
+ * This file is generated automatically from 'jit/$cpuarch/*.jit'
  * by $0.
  *
  * Any changes made here will be lost!  
  *
  */
 
-END_C
+#include<parrot/parrot.h>
+#include"parrot/jit.h"
+#include"parrot/jit_emit.h"
 
+END_C
 
-print '#define START "' . $start . "\"\n"; 
-$start =~ s/[^x]//g;
-$start = length($start);
-print '#define START_SIZE ' . $start . "\n\n";
-print '#define OP_ARGUMENT_SIZE ' . $Parrot::Jit::OP_ARGUMENT_SIZE . "\n\n";
+%core_ops = readjit("jit/$cpuarch/core.cjt");
+#%string = readjit("jit/$cpuarch/string.cjt");
+#%lib = readjit("jit/$cpuarch/lib.cjt");
 
-print "opcode_assembly_t op_assembly[$core_numops]= {\n";
+my @jit_funcs;
+push @jit_funcs, "jit_fn_info_t op_jit[$core_numops]= {\n";
 
-my $cpcf_call = Parrot::Jit->call(2,"V*CUR_OPCODE[0]V&INTERPRETER[0]") . 
Parrot::Jit->Fix_cpcf_call();
-my $normal_call = Parrot::Jit->call(2,"V*CUR_OPCODE[0]V&INTERPRETER[0]") . 
Parrot::Jit->Fix_normal_call();
+my $jit_fn_retn = "void";
+my $jit_fn_params = "(Parrot_jit_info *jit_info, struct Parrot_Interp * interpreter)";
 
 for ($i = 0; $i < $core_numops; $i++) {
     $body = $core_ops{$core_opfunc[$i]};
 
+    my $jit_func;
     my $op = $Parrot::OpLib::core::ops->[$i];
 
     $precompiled = 0;
     if (!defined $body) {
         $precompiled = 1;
         if ($op->may_jump) {
-            $body = $cpcf_call;
+            $jit_func = "Parrot_jit_cpcf_op";
         } else {
-            $body = $normal_call;
-        }
-    }
-
-    $bytecode = "";
-    $move     = 0;
-    $position = 0;
-    @value_p  = ();
-    @value_n  = ();
-    @values   = ();
-
-    while($move != length($body)) {
-        $char = substr($body,$move,1);    
-        if ($char eq '\\') {
-            # Copy the byte
-            $bytecode .= substr($body,$move,4);
-            $move += 4;
-            $position += 1;
-        }
-        elsif ($char eq 'J') {
-            # JUMP
-            $tmp_bytecode = "";
-            $tmp = substr($body,index($body,'(',$move) + 1,index($body,')',$move) - 
index($body,'(',$move) - 1);
-    
-            $body =~ s/J[a-zA-Z_]*\([^\)]*\)//;
-            if ($tmp eq 'END') {
-                # Jump to the next op.
-                $bytecode .= 'END';
-                $position += 4;
-            } elsif ($tmp =~ m/INT_CONST/) {
-                $tmp =~ m/[\&\*]?[a-zA-Z_]+\[(\d+)\]/;
-                $n = 24;
-                $number = $1; 
-                $values[$n]++;
-                $bytecode .= '\\x00' x $Parrot::Jit::OP_ARGUMENT_SIZE;
-                $value_p[$n][$values[$n]] = $position;
-                $value_n[$n][$values[$n]] = $number;
-                $position += $Parrot::Jit::OP_ARGUMENT_SIZE;
-             } else {
-                die "Don't know how to jump to: $tmp\n";
-             }
-        }
-        elsif ($char eq 'C') {
-            # call a C function
-
-            $tmp_bytecode = "";
-            $tmp = substr($body,index($body,'(',$move),index($body,')',$move) + 1);
-            $tmp =~ m/(\w+),([^\)]*)\)/;
-            $function = $1;
-            $k = $argc = $argv = $2;
-
-            # Contorned atempt to get argc
-            $k =~ s/([VA][\*][a-zA-Z_]+\[\d+\])//g;
-            $argc =~ s/([VA][\&][a-zA-Z_]+\[\d+\])//g;
-            $k =~ s/[^\&]//g;
-            $k = length($k);
-            $argc =~ s/[^\*]//g;
-            $argc = length($argc) + $k;
-
-            if (defined($Call{$function})) {
-                $n = 27;
-                
-                $tmp_bytecode = Parrot::Jit->call($argc,$argv);
-
-                $j = $Parrot::Jit::Call_start + $Parrot::Jit::Call_move;
-
-                for($k = 0; $k < $argc; $k++) {
-                    $argv =~ s/([VA])([\&\*][a-zA-Z_]+\[\d+\])$//;
-                    if ($1 eq 'V') {
-                        $j += $Parrot::Jit::Call_inmediate_arg_size;
-                    } else {
-                        $j += $Parrot::Jit::Call_address_arg_size;
-                    }
-                }
-
-                $values[$n]++;
-                $value_p[$n][$values[$n]] = $position + $j;
-                $value_n[$n][$values[$n]] = $Call{$function};
-                $body =~ s/C[a-zA-Z_]*\([^\)]*\)/$tmp_bytecode/;
-            } else {
-                die "Unknown C function: " . $body . "\n";
-            }
-        }
-        elsif ($char eq 'F') {
-            # fuction
-            $tmp_bytecode = "";
-            $tmp = substr($body,index($body,'(',$move),index($body,')',$move) + 1);
-            $tmp =~ m/(\w+),([^\)]*)\)/;
-            $function = $1;
-            $k = $argc = $argv = $2;
-            if (defined($string{$function})) {
-                $tmp_bytecode = $string{$function};
-            } elsif (defined($lib{$function})) {
-                $tmp_bytecode = $lib{$function};
-            } else {
-                die "Unknown function: $function called from: $body\n";
-            }
-
-            # Contorned atempt to get argc
-            $k =~ s/([\*][a-zA-Z_]+\[\d+\])//g;
-            $argc =~ s/([\&][a-zA-Z_]+\[\d+\])//g;
-            $k =~ s/[^\&]//g;
-            $k = length($k);
-            $argc =~ s/[^\*]//g;
-            $argc = length($argc) + $k;
-
-            for($k = 0; $k < $argc; $k++) {
-                $argv =~ s/([\&\*][a-zA-Z_]+\[\d+\])//; 
-                $arg = $1;
-                $tmp_bytecode =~ s/[\&\*]ARG\[\d+\]/$arg/;
-            }
-            $body =~ s/F[a-zA-Z_]*\([^\)]*\)/$tmp_bytecode/;
-        }
-        elsif ($char eq 'S') {
-            # system call
-            $tmp = substr($body,index($body,'(',$move),index($body,')',$move) + 1);
-            $tmp =~ m/(\w+),(\d+),([^\)]*)\)/;
-            $syscall = $1;
-            $argc = $2;
-            $argv = $3;
-
-            $tmp_bytecode = Parrot::Jit->system_call($argc,$argv,$syscall);
-            
-            $body =~ s/S[a-zA-Z_]*\([^\)]*\)/$tmp_bytecode/;
-        }
-        elsif ($char =~ m/[\&\*]/) {
-            # Copy \x00 * sizeof(INTVAL) to the bytecode and add to the list
-            $tmp_bytecode = undef;
-
-            $tmp = substr($body,$move,length($body) - $move + 1);
-            $tmp =~ m/([\&\*][a-zA-Z_]+)\[(\d+)\]/;
-            $type = $1;
-            $number = $2;
-            $strflag = undef;
-            if ($type eq '&INT_REG') {
-                $n = 0;
-            }
-            elsif ($type eq '&NUM_REG') {
-                $n = 1;
-            }
-            elsif ($type eq '&STRING_REG') {
-                $n = 2;
-            }
-            elsif ($type eq '&PR') {
-                $n = 3;
-            }
-            elsif ($type eq '*INT_CONST') {
-                $n = 4;
-            }
-            elsif ($type eq '*NUM_CONST') {
-                $n = 5;
-            }
-            elsif ($type eq '*STRING_CONST') {
-                $n = 6;
-                $strflag = 0;
-            }
-            elsif ($type eq '*STRING_CONST_bufstart') {
-                $n = 6;
-                $strflag = 1;
-            }
-            elsif ($type eq '*STRING_CONST_buflen') {
-                $n = 6;
-                $strflag = 2;
-            }
-            elsif ($type eq '*STRING_CONST_flags') {
-                $n = 6;
-                $strflag = 3;
-            }
-            elsif ($type eq '*STRING_CONST_bufused') {
-                $n = 6;
-                $strflag = 4;
-            }
-            elsif ($type eq '*STRING_CONST_strlen') {
-                $n = 6;
-                $strflag = 5;
-            }
-            elsif ($type eq '*STRING_CONST_encoding') {
-                $n = 6;
-                $strflag = 6;
-            }
-            elsif ($type eq '*STRING_CONST_type') {
-                $n = 6;
-                $strflag = 7;
-            }
-            elsif ($type eq '*STRING_CONST_language') {
-                $n = 6;
-                $strflag = 8;
-            }
-            elsif ($type eq '*PC') {
-                $n = 7;
-            }
-            elsif ($type eq '&INT_CONST') {
-                $n = 8;
-            }
-            elsif ($type eq '&NUM_CONST') {
-                $n = 9;
-            }
-            elsif ($type eq '&STRING_CONST') {
-                $n = 10;
-                $strflag = 0;
-            }
-            elsif ($type eq '&STRING_CONST_bufstart') {
-                $n = 10;
-                $strflag = 1;
-            }
-            elsif ($type eq '&STRING_CONST_buflen') {
-                $n = 10;
-                $strflag = 2;
-            }
-            elsif ($type eq '&STRING_CONST_flags') {
-                $n = 10;
-                $strflag = 3;
-            }
-            elsif ($type eq '&STRING_CONST_bufused') {
-                $n = 10;
-                $strflag = 4;
-            }
-            elsif ($type eq '&STRING_CONST_strlen') {
-                $n = 10;
-                $strflag = 5;
-            }
-            elsif ($type eq '&STRING_CONST_encoding') {
-                $n = 10;
-                $strflag = 6;
-            }
-            elsif ($type eq '&STRING_CONST_type') {
-                $n = 10;
-                $strflag = 7;
-            }
-            elsif ($type eq '&STRING_CONST_language') {
-                $n = 10;
-                $strflag = 8;
-            }
-            elsif ($type eq '&PC') {
-                $n = 11;
-            }
-            elsif ($type eq '&TEMP_INT') {
-                $n = 12;
-            }
-            elsif ($type eq '&TEMP_NUM') {
-                $n = 13;
-            }
-            elsif ($type eq '&TS') {
-                $n = 14;
-            }
-            elsif ($type eq '&TEMP_CHAR') {
-                $n = 15;
-            }
-            elsif ($type eq '*CONST_INTVAL') {
-                $n = 16;
-            }
-            elsif ($type eq '&CONST_INTVAL') {
-                $n = 20;
-            }
-            elsif ($type eq '&CONST_FLOAT') {
-                $n = 21;
-            }
-            elsif ($type eq '&CONST_CHAR') {
-                $n = 23;
-            }
-            elsif ($type eq '*JUMP_INT_CONST') {
-                $n = 24;
-            } 
-            elsif ($type eq '&INTERPRETER') {
-                $n = 28;
-            } 
-            elsif ($type eq '*CUR_OPCODE') {
-                $n = 29;
-            } 
-            else {
-                die "Unknown type: $type\n";
-            }
-
-            $values[$n]++;
-            $bytecode .= '\\x00' x $Parrot::Jit::OP_ARGUMENT_SIZE;
-            $value_p[$n][$values[$n]] = $position;
-            $value_n[$n][$values[$n]] = $number;
-            $value_f[$n][$values[$n]] = $strflag;
-            $move += length($type) + length($number) + 2;
-            $position += $Parrot::Jit::OP_ARGUMENT_SIZE;
-        }
-        else {
-            die "Syntax wrong: $body\nUnknown identifier: $char at $move\n";
+            $jit_func = "Parrot_jit_normal_op";
         }
     }
-    if ($precompiled) {
-        $values[27]++;
-        $value_p[27][$values[27]] = $Parrot::Jit::Precompiled_call_position; 
-        $value_n[27][$values[27]] = $Call{"Parrot_op"};
+    else
+    {
+       $jit_func = "$core_opfunc[$i]_jit";
     }
-    $tmp_bytecode = "";
-    while ($bytecode =~ m/END/) {
-        $tmp_bytecode="";
-        $tmp = substr($bytecode,index($bytecode,'E'),length($bytecode) - 
index($bytecode,'N'));
-        $tmp    =~ s/[^x]//g;
-        $tmp   =  length($tmp);
-        $tmp = sprintf("%x",$tmp);
-        for ($k = 1; $k <= 4; $k++) {
-            if ($tmp) {
-                $tmp =~ s/(.?.)$//;
-                $j = $1;
-                $j = "0" . $j if length($j) == 1;
-             } else {
-                $j = "00";
-             }
-             $tmp_bytecode .= "\\x" . $j; 
-        }
-        $bytecode =~ s/END/$tmp_bytecode/;
-    }
-
-    $tmp    =  $bytecode;
-    $tmp    =~ s/[^x]//g;
-    $size   =  length($tmp);
-
-    $nargop =  $op->size;
-
-#    print STDERR "Shipping out code for " . $op->func_name . "...\n";
-
-    print <<END;
-{ /* op $i: $core_opfunc[$i] */
-  "$bytecode",
-  $size,
-  $nargop,
-END
-
-    for ($k = 0; $k <= 29; $k++) {
-        print "  {\n";
-
-        if (defined($values[$k])) {
-            print "    ", $values[$k], ",\n";
-            print "    {\n";
-
-            for($j = 1; $j <= $values[$k]; $j++) {
-                print("      {", $value_p[$k][$j], ", ", $value_n[$k][$j]);
-                print(", ", $value_f[$k][$j]) if (defined($value_f[$k][$j]));
-                print("},\n");
-            }
 
-            print "    }\n";
-        }
-        else {
-            print "    0,\n";
-            print "    {\n";
-            if ($k == 6 or $k == 10) {
-                # The two string_substitution_t values in the struct:
-                print "      {0, 0, 0},\n";
-            } else {
-                print "      {0, 0},\n";
-            }
-            print "    }\n";
-        }
-
-        print "  },\n";
+    unless($precompiled){
+       print JITCPU "\nstatic $jit_fn_retn " . $core_opfunc[$i] . "_jit" . 
+$jit_fn_params . "{\n$body}\n";
     }
+    my $op_args = $op->size;
+    push @jit_funcs, "/* op $i: $core_opfunc[$i] */\n";
+    push @jit_funcs, "{ $jit_func, $op_args }, \n";
+}
+
+print JITCPU @jit_funcs, "};\n";
 
-    print "},\n";
+sub make_subs {
+    my ($ptr, $type, $index) = @_; 
+    return(($ptr eq '&' ? '&' : '') . 
+sprintf($Parrot::OpTrans::C::arg_maps{$type_to_arg{$type}}, $index));
 }
-print "};\n";
diff --exclude=CVS -urN parrot/lib/Parrot/OpTrans/C.pm 
parrot-jit/lib/Parrot/OpTrans/C.pm
--- parrot/lib/Parrot/OpTrans/C.pm      Fri Feb 15 23:38:18 2002
+++ parrot-jit/lib/Parrot/OpTrans/C.pm  Thu Feb 21 10:53:07 2002
@@ -10,7 +10,7 @@
 package Parrot::OpTrans::C;
 
 use Parrot::OpTrans;
-use vars qw(@ISA);
+use vars qw(@ISA %arg_maps);
 @ISA = qw(Parrot::OpTrans);
 
 
@@ -50,7 +50,7 @@
 # access_arg()
 #
 
-my %arg_maps = (
+%arg_maps = (
   'op' => "cur_opcode[%ld]",
 
   'i'  => "interpreter->int_reg.registers[cur_opcode[%ld]]",

Reply via email to