Reduce codeblock_hash table to uint16_t.

This commit is contained in:
SarahW 2018-11-30 13:18:56 +00:00
commit 43b5b83644
4 changed files with 10 additions and 8 deletions

View file

@ -602,7 +602,7 @@ void exec386_dynarec(int cycs)
{
uint32_t phys_addr = get_phys(cs+cpu_state.pc);
int hash = HASH(phys_addr);
codeblock_t *block = codeblock_hash[hash];
codeblock_t *block = &codeblock[codeblock_hash[hash]];
int valid_block = 0;
trap = 0;
@ -630,7 +630,10 @@ void exec386_dynarec(int cycs)
(new_block->phys == phys_addr) && !((new_block->status ^ cpu_cur_status) & CPU_STATUS_FLAGS) &&
((new_block->status & cpu_cur_status & CPU_STATUS_MASK) == (cpu_cur_status & CPU_STATUS_MASK));
if (valid_block)
{
block = new_block;
codeblock_hash[hash] = get_block_nr(block);
}
}
}
}
@ -675,7 +678,6 @@ void exec386_dynarec(int cycs)
{
void (*code)() = (void *)&block->data[BLOCK_START];
codeblock_hash[hash] = block;
// if (output) pclog("Run block at %04x:%04x %04x %04x %04x %04x %04x %04x ESP=%08x %04x %08x %08x %016llx %08x\n", CS, pc, AX, BX, CX, DX, SI, DI, ESP, BP, get_phys(cs+pc), block->phys, block->page_mask, block->endpc);
inrecomp=1;

View file

@ -14,7 +14,7 @@
int has_ea;
codeblock_t *codeblock;
codeblock_t **codeblock_hash;
uint16_t *codeblock_hash;
void (*codegen_timing_start)();
void (*codegen_timing_prefix)(uint8_t prefix, uint32_t fetchdat);

View file

@ -65,7 +65,7 @@ uint8_t *codeblock_data;
extern codeblock_t *codeblock;
extern codeblock_t **codeblock_hash;
extern uint16_t *codeblock_hash;
/*Code block uses FPU*/
#define CODEBLOCK_HAS_FPU 1

View file

@ -92,7 +92,7 @@ void codegen_reset()
int c;
memset(codeblock, 0, BLOCK_SIZE * sizeof(codeblock_t));
memset(codeblock_hash, 0, HASH_SIZE * sizeof(codeblock_t *));
memset(codeblock_hash, 0, HASH_SIZE * sizeof(uint16_t));
mem_reset_page_blocks();
for (c = 0; c < BLOCK_SIZE; c++)
@ -211,8 +211,8 @@ static void delete_block(codeblock_t *block)
{
uint32_t old_pc = block->pc;
if (block == codeblock_hash[HASH(block->phys)])
codeblock_hash[HASH(block->phys)] = NULL;
if (block == &codeblock[codeblock_hash[HASH(block->phys)]])
codeblock_hash[HASH(block->phys)] = BLOCK_INVALID;
if (block->pc == BLOCK_PC_INVALID)
fatal("Deleting deleted block\n");
@ -279,7 +279,7 @@ void codegen_block_init(uint32_t phys_addr)
cpu_recomp_reuse++;
}
block_num = HASH(phys_addr);
codeblock_hash[block_num] = &codeblock[block_current];
codeblock_hash[block_num] = block_current;
block->ins = 0;
block->pc = cs + cpu_state.pc;