1
0
Fork 0

recompiler speedups (M-HT)

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3478
This commit is contained in:
Sebastian Strohhäcker 2009-10-08 20:01:31 +00:00
parent b8138ed477
commit c11bc7e1ef
3 changed files with 113 additions and 52 deletions

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: decoder.h,v 1.57 2009-03-29 17:32:20 qbix79 Exp $ */
/* $Id: decoder.h,v 1.58 2009-10-08 20:01:31 c2woody Exp $ */
#define X86_DYNFPU_DH_ENABLED
#define X86_INLINED_MEMACCESS
@ -187,13 +187,19 @@ static INLINE void decode_increase_wmapmask(Bitu size) {
static bool decode_fetchb_imm(Bitu & val) {
if (decode.page.index<4096) {
HostPt tlb_addr=get_tlb_read(decode.code);
if (tlb_addr) {
val=(Bitu)(tlb_addr+decode.code);
decode_increase_wmapmask(1);
decode.code++;
decode.page.index++;
return true;
if (decode.page.invmap != NULL) {
if (decode.page.invmap[decode.page.index] == 0) {
val=(Bit32u)decode_fetchb();
return false;
}
HostPt tlb_addr=get_tlb_read(decode.code);
if (tlb_addr) {
val=(Bitu)(tlb_addr+decode.code);
decode_increase_wmapmask(1);
decode.code++;
decode.page.index++;
return true;
}
}
}
val=(Bit32u)decode_fetchb();
@ -201,13 +207,21 @@ static bool decode_fetchb_imm(Bitu & val) {
}
static bool decode_fetchw_imm(Bitu & val) {
if (decode.page.index<4095) {
HostPt tlb_addr=get_tlb_read(decode.code);
if (tlb_addr) {
val=(Bitu)(tlb_addr+decode.code);
decode_increase_wmapmask(2);
decode.code+=2;
decode.page.index+=2;
return true;
if (decode.page.invmap != NULL) {
if ((decode.page.invmap[decode.page.index] == 0) &&
(decode.page.invmap[decode.page.index + 1] == 0)
) {
val=decode_fetchw();
return false;
}
HostPt tlb_addr=get_tlb_read(decode.code);
if (tlb_addr) {
val=(Bitu)(tlb_addr+decode.code);
decode_increase_wmapmask(2);
decode.code+=2;
decode.page.index+=2;
return true;
}
}
}
val=decode_fetchw();
@ -215,13 +229,23 @@ static bool decode_fetchw_imm(Bitu & val) {
}
static bool decode_fetchd_imm(Bitu & val) {
if (decode.page.index<4093) {
HostPt tlb_addr=get_tlb_read(decode.code);
if (tlb_addr) {
val=(Bitu)(tlb_addr+decode.code);
decode_increase_wmapmask(4);
decode.code+=4;
decode.page.index+=4;
return true;
if (decode.page.invmap != NULL) {
if ((decode.page.invmap[decode.page.index] == 0) &&
(decode.page.invmap[decode.page.index + 1] == 0) &&
(decode.page.invmap[decode.page.index + 2] == 0) &&
(decode.page.invmap[decode.page.index + 3] == 0)
) {
val=decode_fetchd();
return false;
}
HostPt tlb_addr=get_tlb_read(decode.code);
if (tlb_addr) {
val=(Bitu)(tlb_addr+decode.code);
decode_increase_wmapmask(4);
decode.code+=4;
decode.page.index+=4;
return true;
}
}
}
val=decode_fetchd();
@ -2649,8 +2673,13 @@ restart_prefix:
goto illegalopcode;
}
}
/* Normal exit because of max opcodes reached */
// link to next block because the maximal number of opcodes has been reached
dyn_set_eip_end();
dyn_reduce_cycles();
dyn_save_critical_regs();
gen_jmp_ptr(&decode.block->link[0].to,offsetof(CacheBlock,cache.start));
dyn_closeblock();
goto finish_block;
core_close_block:
dyn_reduce_cycles();
dyn_save_critical_regs();

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: decoder.h,v 1.6 2009-05-27 09:15:41 qbix79 Exp $ */
/* $Id: decoder.h,v 1.7 2009-10-08 20:01:31 c2woody Exp $ */
#include "decoder_basic.h"
@ -574,8 +574,12 @@ restart_prefix:
goto illegalopcode;
}
}
// normal exit because the maximal number of opcodes has been reached
// link to next block because the maximal number of opcodes has been reached
dyn_set_eip_end();
dyn_reduce_cycles();
gen_jmp_ptr(&decode.block->link[0].to,offsetof(CacheBlockDynRec,cache.start));
dyn_closeblock();
goto finish_block;
core_close_block:
dyn_reduce_cycles();
dyn_return(BR_Normal);

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: decoder_basic.h,v 1.15 2009-05-27 09:15:41 qbix79 Exp $ */
/* $Id: decoder_basic.h,v 1.16 2009-10-08 20:01:31 c2woody Exp $ */
/*
@ -290,16 +290,24 @@ static bool decode_fetchb_imm(Bitu & val) {
if (GCC_UNLIKELY(decode.page.index>=4096)) {
decode_advancepage();
}
HostPt tlb_addr=get_tlb_read(decode.code);
// see if position is directly accessible
if (tlb_addr) {
val=(Bitu)(tlb_addr+decode.code);
decode_increase_wmapmask(1);
decode.code++;
decode.page.index++;
return true;
if (decode.page.invmap != NULL) {
if (decode.page.invmap[decode.page.index] == 0) {
// position not yet modified
val=(Bit32u)decode_fetchb();
return false;
}
HostPt tlb_addr=get_tlb_read(decode.code);
if (tlb_addr) {
val=(Bitu)(tlb_addr+decode.code);
decode_increase_wmapmask(1);
decode.code++;
decode.page.index++;
return true;
}
}
// not directly accessible, just fetch the value
// first time decoding or not directly accessible, just fetch the value
val=(Bit32u)decode_fetchb();
return false;
}
@ -308,17 +316,26 @@ static bool decode_fetchb_imm(Bitu & val) {
// otherwise val contains the current value read from the position
static bool decode_fetchw_imm(Bitu & val) {
if (decode.page.index<4095) {
HostPt tlb_addr=get_tlb_read(decode.code);
// see if position is directly accessible
if (tlb_addr) {
val=(Bitu)(tlb_addr+decode.code);
decode_increase_wmapmask(2);
decode.code+=2;
decode.page.index+=2;
return true;
if (decode.page.invmap != NULL) {
if ((decode.page.invmap[decode.page.index] == 0) &&
(decode.page.invmap[decode.page.index + 1] == 0)) {
// position not yet modified
val=decode_fetchw();
return false;
}
HostPt tlb_addr=get_tlb_read(decode.code);
// see if position is directly accessible
if (tlb_addr) {
val=(Bitu)(tlb_addr+decode.code);
decode_increase_wmapmask(2);
decode.code+=2;
decode.page.index+=2;
return true;
}
}
}
// not directly accessible, just fetch the value
// first time decoding or not directly accessible, just fetch the value
val=decode_fetchw();
return false;
}
@ -327,17 +344,28 @@ static bool decode_fetchw_imm(Bitu & val) {
// otherwise val contains the current value read from the position
static bool decode_fetchd_imm(Bitu & val) {
if (decode.page.index<4093) {
HostPt tlb_addr=get_tlb_read(decode.code);
// see if position is directly accessible
if (tlb_addr) {
val=(Bitu)(tlb_addr+decode.code);
decode_increase_wmapmask(4);
decode.code+=4;
decode.page.index+=4;
return true;
if (decode.page.invmap != NULL) {
if ((decode.page.invmap[decode.page.index] == 0) &&
(decode.page.invmap[decode.page.index + 1] == 0) &&
(decode.page.invmap[decode.page.index + 2] == 0) &&
(decode.page.invmap[decode.page.index + 3] == 0)) {
// position not yet modified
val=decode_fetchd();
return false;
}
HostPt tlb_addr=get_tlb_read(decode.code);
// see if position is directly accessible
if (tlb_addr) {
val=(Bitu)(tlb_addr+decode.code);
decode_increase_wmapmask(4);
decode.code+=4;
decode.page.index+=4;
return true;
}
}
}
// not directly accessible, just fetch the value
// first time decoding or not directly accessible, just fetch the value
val=decode_fetchd();
return false;
}