Index: parrot-svn/src/jit/i386/jit_defs.c =================================================================== --- parrot-svn.orig/src/jit/i386/jit_defs.c 2009-02-19 17:10:05.000000000 +0000 +++ parrot-svn/src/jit/i386/jit_defs.c 2009-02-19 17:18:06.515875000 +0000 @@ -1119,9 +1119,9 @@ emitm_fstpl(interp, jit_info->native_ptr, emit_ESP, emit_None, 1, 0); /* additional stack adjustment */ st += 4; -#else +#else /* NUMVAL_SIZE == 12 */ emitm_addb_i_r(jit_info->native_ptr, -12, emit_ESP); - emitm_fstpt(jit_info->native_ptr, emit_ESP, emit_None, 1, 0); + emitm_fstpt(interp, jit_info->native_ptr, emit_ESP, emit_None, 1, 0); st += 8; #endif break; Index: parrot-svn/src/jit/i386/jit_emit.h =================================================================== --- parrot-svn.orig/src/jit/i386/jit_emit.h 2009-02-19 17:14:13.000000000 +0000 +++ parrot-svn/src/jit/i386/jit_emit.h 2009-02-19 17:18:21.703375000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2008, Parrot Foundation. + * Copyright (C) 2002-2009, Parrot Foundation. */ /* @@ -218,6 +218,7 @@ *(long *)(pc) = (long)(imm); \ (pc) += 4; } +/* TODO: remove duplicate */ #if EXEC_CAPABLE # define emitm_pushl_m(pc, mem) { \ *((pc)++) = (char) 0xff; \ @@ -691,6 +692,9 @@ # define emitm_fstps(interp, pc, b, i, s, d) \ emitm_fl_2((interp), (pc), emit_b00, 1, emit_b010, (b), (i), (s), (d)) +# define emitm_fstt(interp, pc, b, i, s, d) \ + emitm_fl_2((interp), (pc), emit_b10, 1, emit_b010, (b), (i), (s), (d)) + #if NUMVAL_SIZE == 8 # define jit_emit_fload_m_n(interp, pc, address) \ @@ -708,22 +712,22 @@ # define jit_emit_fst_mb_n(interp, pc, base, offs) \ emitm_fstl((interp), (pc), (base), emit_None, 1, (offs)) -#else /* NUMVAL_SIZE */ +#else /* NUMVAL_SIZE = 12 */ # define jit_emit_fload_m_n(interp, pc, address) \ - emitm_fldt((pc), emit_None, emit_None, emit_None, (address)) + emitm_fldt((interp), (pc), emit_None, emit_None, emit_None, (address)) # define jit_emit_fload_mb_n(interp, pc, base, offs) \ - emitm_fldt((pc), (base), emit_None, 1, (offs)) + emitm_fldt((interp), (pc), (base), emit_None, 1, (offs)) -# define jit_emit_fstore_m_n(pc, address) \ - emitm_fstpt((pc), emit_None, emit_None, emit_None, (address)) +# define jit_emit_fstore_m_n(interp, pc, address) \ + emitm_fstpt((interp), (pc), emit_None, emit_None, emit_None, (address)) # define jit_emit_fstore_mb_n(interp, pc, base, offs) \ - emitm_fstpt((pc), (base), emit_None, 1, (offs)) + emitm_fstpt((interp), (pc), (base), emit_None, 1, (offs)) # define jit_emit_fst_mb_n(interp, pc, base, offs) \ - emitm_fstt((pc), (base), emit_None, 1, (offs)) + emitm_fstt((interp), (pc), (base), emit_None, 1, (offs)) #endif /* NUMVAL_SIZE */ @@ -736,7 +740,7 @@ # define jit_emit_fstore_m_i(pc, m) \ emitm_fistpl((pc), emit_None, emit_None, emit_None, (m)) -#else /* INTVAL_SIZE */ +#else /* INTVAL_SIZE = 8 */ # define jit_emit_fload_m_i(interp, pc, address) \ emitm_fildll((interp), (pc), emit_None, emit_None, emit_None, (address)) @@ -937,7 +941,8 @@ emitm_fsubrp((pc), 1); \ jit_emit_fstore_mb_n((interp), (pc), emit_EBX, (mem)); \ } -#else + +#else /* without NEG_MINUS_ZERO and NEG_ZERO_SUB */ # define jit_emit_neg_r_n(pc, r) { \ if (r) { \ @@ -962,7 +967,7 @@ emitm_fchs(pc); \ jit_emit_fstore_mb_n((interp), (pc), emit_EBX, (mem)); \ } -#endif +#endif /* NEG_MINUS_ZERO, NEG_ZERO_SUB */ # define jit_emit_sin_r_n(pc, r) \ if (r) { \ @@ -1011,7 +1016,7 @@ # define jit_emit_abs_m_n(interp, pc, mem) { \ jit_emit_fload_m_n((interp), (pc), (mem)); \ emitm_fabs(pc); \ - jit_emit_fstore_m_n((pc), (mem)); \ + jit_emit_fstore_m_n((interp), (pc), (mem)); \ } /* Integer comparisons */ @@ -1040,6 +1045,7 @@ *((pc)++) = (char) 0xff; \ *((pc)++) = (char) 0xd0 | ((reg) - 1); } +/* TODO: remove duplicate */ #if EXEC_CAPABLE # define emitm_callm(pc, b, i, s, d) { \ *((pc)++) = (char) 0xff; \ @@ -1063,6 +1069,7 @@ *((pc)++) = (char) 0xff; \ *((pc)++) = (char)(0xe0 | ((reg) - 1)); } +/* TODO: remove duplicate */ #if EXEC_CAPABLE # define emitm_jumpm(pc, b, i, s, d) { \ *((pc)++) = (char) 0xff; \ @@ -1206,15 +1213,29 @@ } /* INT_REG <= ST(i) */ +/* TODO: unused. jit_emit_mov_MR_in is used instead. + TODO: rounding => trunc */ # define jit_emit_mov_mr_in(pc, mem, r) { \ emitm_fld((pc), (r)); \ jit_emit_fstore_m_i((pc), (mem)); \ } +/* TODO: rounding => trunc */ +# define jit_emit_mov_MR_in(interp, pc, mem, r) { \ + if (r) { \ + emitm_fld((pc), (r)); \ + jit_emit_fstore_m_i((pc), (mem)); \ + } \ + else { \ + jit_emit_fst_m_i((interp), (pc), emit_EBX, (d)); \ + } \ +} + /* numvar <- ST(i) */ -# define jit_emit_mov_mr_n(pc, d, r) { \ +/* TODO: unused. jit_emit_mov_MR_n is used instead */ +# define jit_emit_mov_mr_n(interp, pc, d, r) { \ emitm_fld((pc), (r)); \ - jit_emit_fstore_m_n((pc), (d)); \ + jit_emit_fstore_m_n((interp), (pc), (d)); \ } # define jit_emit_mov_MR_n(interp, pc, d, r) { \ Index: parrot-svn/src/jit/i386/core.jit =================================================================== --- parrot-svn.orig/src/jit/i386/core.jit 2009-02-19 17:10:05.000000000 +0000 +++ parrot-svn/src/jit/i386/core.jit 2009-02-19 17:18:06.515875000 +0000 @@ -101,14 +101,15 @@ } } -; these are wrong: fist does rounding, but we should truncate +; These are wrong: first does rounding, but we should truncate +; TODO: [5487]: JIT/i386 set_i_n did round. Test t/op/jitn.t ;Parrot_set_i_n { ; if (MAP[2]) { -; jit_emit_mov_MR_in(NATIVECODE, ROFFS_INT(1), MAP[2]); +; jit_emit_mov_MR_in(interp, NATIVECODE, ROFFS_INT(1), MAP[2]); ; } ; else { -; jit_emit_mov_RM_n(NATIVECODE, FSR1, ROFFS_NUM(2)); -; jit_emit_mov_MR_in(NATIVECODE, ROFFS_INT(1), FSR1); +; jit_emit_mov_RM_n(interp, NATIVECODE, FSR1, ROFFS_NUM(2)); +; jit_emit_mov_MR_in(interp, NATIVECODE, ROFFS_INT(1), FSR1); ; } ; if (MAP[1]) { ; jit_emit_mov_RM_i(interp, NATIVECODE, MAP[1], ROFFS_INT(1)); Index: parrot-svn/docs/jit.pod =================================================================== --- parrot-svn.orig/docs/jit.pod +++ parrot-svn/docs/jit.pod @@ -333,7 +333,7 @@ B, the I are su generate the actual function body. These substitutions are done before the other substitutions. -s. F for more. +See F for more. =back @@ -354,7 +354,9 @@ the PASM name of the op. =item I<> B specify the arguments of the function in the PASM sequence B, -B ... The B consist of one letter per argument: +B ... The B consist of one letter per argument. +Lowercase letters indicate absolute addressing, +uppercase letters for R and M relative, offset-based addressing. =over 4 @@ -370,6 +372,15 @@ A memory operand, the address of the par An immediate operand, i.e. an integer constant. +=item B + +A mapped processor register, addressed relatively via offset. + +=item B + +A memory operand, the address of the parrot register, +addressed relatively via offset. + =back =item I<> @@ -413,7 +424,7 @@ so you must preside the instruction with =head1 i386 Notes -Only 32 bit INTVALs are supported. Long double FLOATVALs are ok. +Only 32 bit INTVALs are supported. Long double FLOATVALs are broken. There are four mapped integer registers B<%edi>, B<%esi>, B<%ecx>, and B<%edx>. The first 2 of these are callee saved, they preserve their value around extern @@ -506,10 +517,10 @@ I. =head1 Debugging Above listing was generated by F, the GNU debugger, with a little help -from Parrot_jit_debug, which generates a symbol file in I format, s. -B for more (or less :-() +from C, which generates a symbol file in I format, +see B for more (or less :-() -The following script calls F (the graphic debugger fronted) and attaches +The following script calls F (the graphic debugger frontend) and attaches the symbol file, after it got built in F. # dddp @@ -580,8 +591,10 @@ these tests. (gdb) p &I0 $4 = (INTVAL *) 0x8158098 -XXX (p)rinting register contents like shown above is currently not supported. +B

rinting register contents like shown above is currently not supported. +You'd need special .gdbinit macro definitions, like IREG, NREG, SREG, PREG +and CONSTS, CONSTI, CONSTN and CONSTK from F<.gdbinit>. =head1 SEE ALSO -F, F +F, F