From 27727b63bc3da8a9e0affc33fe9d3e0ad1b1d42d Mon Sep 17 00:00:00 2001 From: notaz Date: Thu, 20 Oct 2011 02:17:22 +0300 Subject: [PATCH] drc: avoid invcode checks on close addesses yes this makes it possible to miss something, but I hope it's not going to happen and will deal with it if it does. --- libpcsxcore/new_dynarec/assem_arm.c | 1 - libpcsxcore/new_dynarec/new_dynarec.c | 20 ++++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/libpcsxcore/new_dynarec/assem_arm.c b/libpcsxcore/new_dynarec/assem_arm.c index ddbfafaa..5373e704 100644 --- a/libpcsxcore/new_dynarec/assem_arm.c +++ b/libpcsxcore/new_dynarec/assem_arm.c @@ -3209,7 +3209,6 @@ do_writestub(int n) set_jump_target(restore_jump,(int)out); restore_regs(reglist); ra=stubs[n][2]; - if(!restore_jump) ra+=4*3; // skip invcode check emit_jmp(ra); #else // if !PCSX if(addr<0) addr=get_reg(i_regmap,-1); diff --git a/libpcsxcore/new_dynarec/new_dynarec.c b/libpcsxcore/new_dynarec/new_dynarec.c index e2c63edd..e6036b2a 100644 --- a/libpcsxcore/new_dynarec/new_dynarec.c +++ b/libpcsxcore/new_dynarec/new_dynarec.c @@ -59,6 +59,7 @@ struct regstat uint64_t uu; u_int wasconst; u_int isconst; + u_int waswritten; // regs that were used as store base before uint64_t constmap[HOST_REGS]; }; @@ -3298,7 +3299,7 @@ void store_assemble(int i,struct regstat *i_regs) jaddr=0; } #endif - if(!using_tlb) { + if(!using_tlb&&!(i_regs->waswritten&(1<waswritten&(1<regmap,ROREG); if(map<0) map=HOST_TEMPREG; @@ -3750,7 +3751,7 @@ void c1ls_assemble(int i,struct regstat *i_regs) emit_writedword_indexed_tlb(th,tl,0,offset||c||s<0?temp:s,map,temp); type=STORED_STUB; } - if(!using_tlb) { + if(!using_tlb&&!(i_regs->waswritten&(1<waswritten&(1<regmap,INVCP); assert(ir>=0); @@ -8787,6 +8788,7 @@ int new_recompile_block(int addr) dirty_reg(¤t,CCREG); current.isconst=0; current.wasconst=0; + current.waswritten=0; int ds=0; int cc=0; int hr=-1; @@ -8815,6 +8817,7 @@ int new_recompile_block(int addr) if(current.regmap[hr]==0) current.regmap[hr]=-1; } current.isconst=0; + current.waswritten=0; } if(i>1) { @@ -9441,6 +9444,14 @@ int new_recompile_block(int addr) } memcpy(regs[i].regmap,current.regmap,sizeof(current.regmap)); } + + if(i>0&&(itype[i-1]==STORE||itype[i-1]==STORELR||(itype[i-1]==C2LS&&opcode[i-1]==0x3a))&&(u_int)imm[i-1]<0x800) + current.waswritten|=1<=0x800) + current.waswritten&=~(1<0) { @@ -9770,6 +9781,7 @@ int new_recompile_block(int addr) } } if(current.regmap[HOST_BTREG]==BTREG) current.regmap[HOST_BTREG]=-1; + regs[i].waswritten=current.waswritten; } /* Pass 4 - Cull unused host registers */ -- 2.39.2