# New Ticket Created by Jason Gloudon # Please include the string: [perl #15922] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=15922 >
More Revisions of jit.doc as well as some more overview comments on the SPARC jit approach. Also included is a change to the way interpreter functions are invoked on x86. This uses the fact that the interpreter argument remains unchanged on the stack to avoid pushing it every time. -- Jason -- attachment 1 ------------------------------------------------------ url: http://rt.perl.org/rt2/attach/32575/26872/3ac00b/jit.patch
Index: docs/jit.pod =================================================================== RCS file: /cvs/public/parrot/docs/jit.pod,v retrieving revision 1.4 diff -r1.4 jit.pod 76c76,78 < here. --- > here. To simplify the maintenance of these functions, they are specified in a > format that is pre-processed by B<jit2h.pl> to produce a valid C source file, > B<jit_cpu.c>. See L<Format of .jit Files> below. 119c121 < Reads the .jit files and prints the struct opcode_assembly_t. --- > Preprocesses the .jit files to produce and prints the struct opcode_assembly_t. 132,137c134,145 < Where I<op-name> is the name of the Parrot opcode, and I<body> consists < of a sequence of the following forms: < < =item Assembly instruction. < < Which may have one of this B<Identifiers> as an argument: --- > Where I<op-name> is the name of the Parrot opcode, and I<body> consists of C > syntax code which may contain any of the identifiers listed in the following > section. > > =item Identifiers > > In general, prefixing an identifier with I<&> yields the address of the > referenced Parrot register or constant. If an identifier is given without a > prefix, the value is returned by default. To emphasis the use of the value, > the I<*> prefix may be used. Since Parrot register values vary during code > execution, their values can not be obtained through identifier substitution > alone. 210,211d217 < < You must preside all the identifiers with I<&> requesting the address of that identifier, or I<*> requesting the value, I<*> can be used only with constants since the replacement is done before start running. Index: jit/i386/core.jit =================================================================== RCS file: /cvs/public/parrot/jit/i386/core.jit,v retrieving revision 1.20 diff -r1.20 core.jit 7a8 > emitm_addl_i_r(jit_info->native_ptr, 4, emit_ESP); 8a10 > NATIVECODE = emit_popl_r(NATIVECODE, emit_EBP); Index: jit/i386/jit_emit.h =================================================================== RCS file: /cvs/public/parrot/jit/i386/jit_emit.h,v retrieving revision 1.4 diff -r1.4 jit_emit.h 101c101 < break; --- > return; 111,112c111,112 < if((i && !scale) || (scale && !i)){ < internal_exception(JIT_ERROR, --- > if(i && !scale){ > internal_exception(JIT_ERROR, 343a344,345 > #define emitm_alub_i_r(pc, op1, op2, imm, reg) { *(pc++) = op1; *(pc++) = >emit_alu_X_r(op2, reg); *(pc++) = (char)(imm); } > 368a371,372 > #define emitm_addb_i_r(pc, imm, reg) emitm_alub_i_r(pc, 0x83, emit_b000, imm, reg) > 669a674,678 > /* Maintain the stack frame pointer for the sake of gdb */ > jit_info->native_ptr = emit_pushl_r(jit_info->native_ptr, emit_EBP); > emitm_movl_r_r(jit_info->native_ptr, emit_ESP, emit_EBP); > > /* Save ESI, as it's value is clobbered by jit_cpcf_op */ 670a680,686 > > /* Cheat on op function calls by writing the interpreter arg on the stack > * just once. If an op function ever modifies the interpreter argument on > * the stack this will stop working !!! */ > emitm_pushl_i(jit_info->native_ptr, interpreter); > > /* Point ESI to the opcode-native code map array */ 677d692 < emitm_pushl_i(jit_info->native_ptr, interpreter); 686c701 < emitm_addl_i_r(jit_info->native_ptr, 8, emit_ESP); --- > emitm_addb_i_r(jit_info->native_ptr, 4, emit_ESP); Index: jit/sun4/jit_emit.h =================================================================== RCS file: /cvs/public/parrot/jit/sun4/jit_emit.h,v retrieving revision 1.3 diff -r1.3 jit_emit.h 8a9,19 > /* > * SPARC JIT overview: > * > * The interpreter pointer is kept in i0. > * The address of register I0 is stored in i1, with all parrot register access > * performed relative to this register. > * The address of the opcode - native code mapping array is kept in i3. > * > * See IMPORTANT SHORTCUTS below. > * / > 267c278,284 < /* Shortcuts for registers */ --- > /* > * > * IMPORTANT SHORTCUTS > * > * */ > > /* The register holding the interpreter pointer */ 268a286,287 > > /* The register holding the address of I0 */ 269a289,290 > > /* The register containing the address of the opmap */ 270a292,293 > > /* The scratch register used for certain address calculations */ 273a297,298 > > /* The offset of a Parrot register from the base register */ 301a327 > /* This function loads a value */