From c6b9320cf05fe8afeccdf2500c8f110f6ab8f21a Mon Sep 17 00:00:00 2001 From: Frode Solheim Date: Sun, 6 Sep 2015 23:45:12 +0200 Subject: [PATCH] JIT: can now successfully use USE_NEW_RTASM on x86 (32-bit) --- jit/codegen_x86.cpp | 11 ++++++----- jit/compemu_midfunc_x86.cpp | 4 ++++ jit/compemu_support.cpp | 20 ++++++++++++++++++-- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/jit/codegen_x86.cpp b/jit/codegen_x86.cpp index 04ef388d..6535488f 100644 --- a/jit/codegen_x86.cpp +++ b/jit/codegen_x86.cpp @@ -166,6 +166,8 @@ static const uae_u8 need_to_preserve[]={1,1,1,1,0,1,1,1}; #define CLOBBER_BT clobber_flags() #define CLOBBER_BSF clobber_flags() +/* The older code generator is now deprecated. */ +#define USE_NEW_RTASM 0 #if USE_NEW_RTASM @@ -192,9 +194,8 @@ static const uae_u8 need_to_preserve[]={1,1,1,1,0,1,1,1}; static void jit_fail(const char *msg, const char *file, int line, const char *function) { - panicbug("JIT failure in function %s from file %s at line %d: %s", + jit_abort("failure in function %s from file %s at line %d: %s", function, file, line, msg); - abort(); } LOWFUNC(NONE,WRITE,1,raw_push_l_r,(R4 r)) @@ -532,7 +533,7 @@ LOWFUNC(READ,NONE,3,raw_cmov_l_rr,(RW4 d, R4 s, IMM cc)) if (have_cmov) CMOVLrr(cc, s, d); else { /* replacement using branch and mov */ - int8 *target_p = (int8 *)x86_get_target() + 1; + uae_s8 *target_p = (uae_s8 *)x86_get_target() + 1; JCCSii(cc^1, 0); MOVLrr(s, d); *target_p = (uintptr)x86_get_target() - ((uintptr)target_p + 1); @@ -703,7 +704,7 @@ LOWFUNC(NONE,READ,5,raw_cmov_l_rm_indexed,(W4 d, IMM base, R4 index, IMM factor, if (have_cmov) ADDR32 CMOVLmr(cond, base, X86_NOREG, index, factor, d); else { /* replacement using branch and mov */ - int8 *target_p = (int8 *)x86_get_target() + 1; + uae_s8 *target_p = (uae_s8 *)x86_get_target() + 1; JCCSii(cond^1, 0); ADDR32 MOVLmr(base, X86_NOREG, index, factor, d); *target_p = (uintptr)x86_get_target() - ((uintptr)target_p + 1); @@ -716,7 +717,7 @@ LOWFUNC(NONE,READ,3,raw_cmov_l_rm,(W4 d, IMM mem, IMM cond)) if (have_cmov) CMOVLmr(cond, mem, X86_NOREG, X86_NOREG, 1, d); else { /* replacement using branch and mov */ - int8 *target_p = (int8 *)x86_get_target() + 1; + uae_s8 *target_p = (uae_s8 *)x86_get_target() + 1; JCCSii(cond^1, 0); MOVLmr(mem, X86_NOREG, X86_NOREG, 1, d); *target_p = (uintptr)x86_get_target() - ((uintptr)target_p + 1); diff --git a/jit/compemu_midfunc_x86.cpp b/jit/compemu_midfunc_x86.cpp index b36df907..347089f8 100644 --- a/jit/compemu_midfunc_x86.cpp +++ b/jit/compemu_midfunc_x86.cpp @@ -1292,7 +1292,11 @@ MIDFUNC(3,mov_l_rm_indexed,(W4 d, IMM base, RR4 index)) base+=get_offset(indexreg)*4; d=writereg(d,4); +#if USE_NEW_RTASM + raw_mov_l_rm_indexed(d,base,index,4); +#else raw_mov_l_rm_indexed(d,base,index); +#endif unlock2(index); unlock2(d); } diff --git a/jit/compemu_support.cpp b/jit/compemu_support.cpp index f2c19eb8..bd586a08 100644 --- a/jit/compemu_support.cpp +++ b/jit/compemu_support.cpp @@ -1518,7 +1518,7 @@ static int alloc_reg_hinted(int r, int size, int willclobber, int hint) raw_zero_extend_16_rr(rr,rr); raw_zero_extend_16_rr(bestreg,bestreg); raw_bswap_32(bestreg); - raw_lea_l_rr_indexed(rr,rr,bestreg); + raw_lea_l_brr_indexed(rr,rr,bestreg,1,0); live.state[r].validsize=4; live.nat[rr].touched=touchcnt++; return rr; @@ -3160,10 +3160,18 @@ void calc_disp_ea_020(int base, uae_u32 dp, int target, int tmp) else { /* 68000 version */ if ((dp & 0x800) == 0) { /* Sign extend */ sign_extend_16_rr(target,reg); +#if USE_NEW_RTASM + lea_l_brr_indexed(target,base,target,1<