Ticket #352: tt352-jit-i386-ld.4.patch
File tt352-jit-i386-ld.4.patch, 8.8 KB (added by rurban, 13 years ago) |
---|
-
src/jit/i386/jit_defs.c
old new 1119 1119 emitm_fstpl(interp, jit_info->native_ptr, emit_ESP, emit_None, 1, 0); 1120 1120 /* additional stack adjustment */ 1121 1121 st += 4; 1122 #else 1122 #else /* NUMVAL_SIZE == 12 */ 1123 1123 emitm_addb_i_r(jit_info->native_ptr, -12, emit_ESP); 1124 emitm_fstpt( jit_info->native_ptr, emit_ESP, emit_None, 1, 0);1124 emitm_fstpt(interp, jit_info->native_ptr, emit_ESP, emit_None, 1, 0); 1125 1125 st += 8; 1126 1126 #endif 1127 1127 break; -
src/jit/i386/jit_emit.h
old new 1 1 /* 2 * Copyright (C) 2002-200 8, Parrot Foundation.2 * Copyright (C) 2002-2009, Parrot Foundation. 3 3 */ 4 4 5 5 /* … … 218 218 *(long *)(pc) = (long)(imm); \ 219 219 (pc) += 4; } 220 220 221 /* TODO: remove duplicate */ 221 222 #if EXEC_CAPABLE 222 223 # define emitm_pushl_m(pc, mem) { \ 223 224 *((pc)++) = (char) 0xff; \ … … 691 692 # define emitm_fstps(interp, pc, b, i, s, d) \ 692 693 emitm_fl_2((interp), (pc), emit_b00, 1, emit_b010, (b), (i), (s), (d)) 693 694 695 # define emitm_fstt(interp, pc, b, i, s, d) \ 696 emitm_fl_2((interp), (pc), emit_b10, 1, emit_b010, (b), (i), (s), (d)) 697 694 698 #if NUMVAL_SIZE == 8 695 699 696 700 # define jit_emit_fload_m_n(interp, pc, address) \ … … 708 712 # define jit_emit_fst_mb_n(interp, pc, base, offs) \ 709 713 emitm_fstl((interp), (pc), (base), emit_None, 1, (offs)) 710 714 711 #else /* NUMVAL_SIZE */715 #else /* NUMVAL_SIZE = 12 */ 712 716 713 717 # define jit_emit_fload_m_n(interp, pc, address) \ 714 emitm_fldt(( pc), emit_None, emit_None, emit_None, (address))718 emitm_fldt((interp), (pc), emit_None, emit_None, emit_None, (address)) 715 719 716 720 # define jit_emit_fload_mb_n(interp, pc, base, offs) \ 717 emitm_fldt(( pc), (base), emit_None, 1, (offs))721 emitm_fldt((interp), (pc), (base), emit_None, 1, (offs)) 718 722 719 # define jit_emit_fstore_m_n( pc, address) \720 emitm_fstpt(( pc), emit_None, emit_None, emit_None, (address))723 # define jit_emit_fstore_m_n(interp, pc, address) \ 724 emitm_fstpt((interp), (pc), emit_None, emit_None, emit_None, (address)) 721 725 722 726 # define jit_emit_fstore_mb_n(interp, pc, base, offs) \ 723 emitm_fstpt(( pc), (base), emit_None, 1, (offs))727 emitm_fstpt((interp), (pc), (base), emit_None, 1, (offs)) 724 728 725 729 # define jit_emit_fst_mb_n(interp, pc, base, offs) \ 726 emitm_fstt(( pc), (base), emit_None, 1, (offs))730 emitm_fstt((interp), (pc), (base), emit_None, 1, (offs)) 727 731 728 732 #endif /* NUMVAL_SIZE */ 729 733 … … 736 740 # define jit_emit_fstore_m_i(pc, m) \ 737 741 emitm_fistpl((pc), emit_None, emit_None, emit_None, (m)) 738 742 739 #else /* INTVAL_SIZE */743 #else /* INTVAL_SIZE = 8 */ 740 744 741 745 # define jit_emit_fload_m_i(interp, pc, address) \ 742 746 emitm_fildll((interp), (pc), emit_None, emit_None, emit_None, (address)) … … 937 941 emitm_fsubrp((pc), 1); \ 938 942 jit_emit_fstore_mb_n((interp), (pc), emit_EBX, (mem)); \ 939 943 } 940 #else 944 945 #else /* without NEG_MINUS_ZERO and NEG_ZERO_SUB */ 941 946 942 947 # define jit_emit_neg_r_n(pc, r) { \ 943 948 if (r) { \ … … 962 967 emitm_fchs(pc); \ 963 968 jit_emit_fstore_mb_n((interp), (pc), emit_EBX, (mem)); \ 964 969 } 965 #endif 970 #endif /* NEG_MINUS_ZERO, NEG_ZERO_SUB */ 966 971 967 972 # define jit_emit_sin_r_n(pc, r) \ 968 973 if (r) { \ … … 1011 1016 # define jit_emit_abs_m_n(interp, pc, mem) { \ 1012 1017 jit_emit_fload_m_n((interp), (pc), (mem)); \ 1013 1018 emitm_fabs(pc); \ 1014 jit_emit_fstore_m_n(( pc), (mem));\1019 jit_emit_fstore_m_n((interp), (pc), (mem)); \ 1015 1020 } 1016 1021 1017 1022 /* Integer comparisons */ … … 1040 1045 *((pc)++) = (char) 0xff; \ 1041 1046 *((pc)++) = (char) 0xd0 | ((reg) - 1); } 1042 1047 1048 /* TODO: remove duplicate */ 1043 1049 #if EXEC_CAPABLE 1044 1050 # define emitm_callm(pc, b, i, s, d) { \ 1045 1051 *((pc)++) = (char) 0xff; \ … … 1063 1069 *((pc)++) = (char) 0xff; \ 1064 1070 *((pc)++) = (char)(0xe0 | ((reg) - 1)); } 1065 1071 1072 /* TODO: remove duplicate */ 1066 1073 #if EXEC_CAPABLE 1067 1074 # define emitm_jumpm(pc, b, i, s, d) { \ 1068 1075 *((pc)++) = (char) 0xff; \ … … 1206 1213 } 1207 1214 1208 1215 /* INT_REG <= ST(i) */ 1216 /* TODO: unused. jit_emit_mov_MR_in is used instead. 1217 TODO: rounding => trunc */ 1209 1218 # define jit_emit_mov_mr_in(pc, mem, r) { \ 1210 1219 emitm_fld((pc), (r)); \ 1211 1220 jit_emit_fstore_m_i((pc), (mem)); \ 1212 1221 } 1213 1222 1223 /* TODO: rounding => trunc */ 1224 # define jit_emit_mov_MR_in(interp, pc, mem, r) { \ 1225 if (r) { \ 1226 emitm_fld((pc), (r)); \ 1227 jit_emit_fstore_m_i((pc), (mem)); \ 1228 } \ 1229 else { \ 1230 jit_emit_fst_m_i((interp), (pc), emit_EBX, (d)); \ 1231 } \ 1232 } 1233 1214 1234 /* numvar <- ST(i) */ 1215 # define jit_emit_mov_mr_n(pc, d, r) { \ 1235 /* TODO: unused. jit_emit_mov_MR_n is used instead */ 1236 # define jit_emit_mov_mr_n(interp, pc, d, r) { \ 1216 1237 emitm_fld((pc), (r)); \ 1217 jit_emit_fstore_m_n(( pc), (d)); \1238 jit_emit_fstore_m_n((interp), (pc), (d)); \ 1218 1239 } 1219 1240 1220 1241 # define jit_emit_mov_MR_n(interp, pc, d, r) { \ -
src/jit/i386/core.jit
old new 101 101 } 102 102 } 103 103 104 ; these are wrong: fist does rounding, but we should truncate 104 ; These are wrong: first does rounding, but we should truncate 105 ; TODO: [5487]: JIT/i386 set_i_n did round. Test t/op/jitn.t 105 106 ;Parrot_set_i_n { 106 107 ; if (MAP[2]) { 107 ; jit_emit_mov_MR_in( NATIVECODE, ROFFS_INT(1), MAP[2]);108 ; jit_emit_mov_MR_in(interp, NATIVECODE, ROFFS_INT(1), MAP[2]); 108 109 ; } 109 110 ; else { 110 ; jit_emit_mov_RM_n( NATIVECODE, FSR1, ROFFS_NUM(2));111 ; jit_emit_mov_MR_in( NATIVECODE, ROFFS_INT(1), FSR1);111 ; jit_emit_mov_RM_n(interp, NATIVECODE, FSR1, ROFFS_NUM(2)); 112 ; jit_emit_mov_MR_in(interp, NATIVECODE, ROFFS_INT(1), FSR1); 112 113 ; } 113 114 ; if (MAP[1]) { 114 115 ; jit_emit_mov_RM_i(interp, NATIVECODE, MAP[1], ROFFS_INT(1)); -
docs/jit.pod
old new 333 333 generate the actual function body. These substitutions are done before the 334 334 other substitutions. 335 335 336 s.F<jit/i386/core.jit> for more.336 See F<jit/i386/core.jit> for more. 337 337 338 338 =back 339 339 … … 354 354 =item I<<args>> 355 355 356 356 B<args> specify the arguments of the function in the PASM sequence B<dest>, 357 B<source> ... The B<args> consist of one letter per argument: 357 B<source> ... The B<args> consist of one letter per argument. 358 Lowercase letters indicate absolute addressing, 359 uppercase letters for R and M relative, offset-based addressing. 358 360 359 361 =over 4 360 362 … … 370 372 371 373 An immediate operand, i.e. an integer constant. 372 374 375 =item B<R> 376 377 A mapped processor register, addressed relatively via offset. 378 379 =item B<M> 380 381 A memory operand, the address of the parrot register, 382 addressed relatively via offset. 383 373 384 =back 374 385 375 386 =item I<<type>> … … 413 424 414 425 =head1 i386 Notes 415 426 416 Only 32 bit INTVALs are supported. Long double FLOATVALs are ok.427 Only 32 bit INTVALs are supported. Long double FLOATVALs are broken. 417 428 418 429 There are four mapped integer registers B<%edi>, B<%esi>, B<%ecx>, and B<%edx>. 419 430 The first 2 of these are callee saved, they preserve their value around extern … … 506 517 =head1 Debugging 507 518 508 519 Above listing was generated by F<gdb>, the GNU debugger, with a little help 509 from Parrot_jit_debug, which generates a symbol file in I<stabs> format, s.510 B<info stabs> for more (or less :-()520 from C<Parrot_jit_debug>, which generates a symbol file in I<stabs> format, 521 see B<info stabs> for more (or less :-() 511 522 512 The following script calls F<ddd> (the graphic debugger fronte d) and attaches523 The following script calls F<ddd> (the graphic debugger frontend) and attaches 513 524 the symbol file, after it got built in F<parrot_build_asm>. 514 525 515 526 # dddp … … 580 591 (gdb) p &I0 581 592 $4 = (INTVAL *) 0x8158098 582 593 583 XXX (p)rinting register contents like shown above is currently not supported. 594 B<p>rinting register contents like shown above is currently not supported. 595 You'd need special .gdbinit macro definitions, like IREG, NREG, SREG, PREG 596 and CONSTS, CONSTI, CONSTN and CONSTK from F<.gdbinit>. 584 597 585 598 =head1 SEE ALSO 586 599 587 F<docs/dev/jit_i386.pod>, F<jit/skeleton/jit_emit.h> 600 F<docs/dev/jit_i386.pod>, F<jit/skeleton/jit_emit.h>