Rewrote the recompiler interrupt checking in assembly (and removed it for the new dynamic compiler because the requires uops are not present), brings performance back up, and also did a number of CPU-related clean-ups (mostly removal of dead variables and associated code).

This commit is contained in:
OBattler
2020-07-13 19:46:19 +02:00
parent 0cd0d83cee
commit a862bda04c
32 changed files with 196 additions and 291 deletions

View File

@@ -49,11 +49,6 @@ int block_current = 0;
static int block_num;
int block_pos;
int cpu_recomp_flushes, cpu_recomp_flushes_latched;
int cpu_recomp_evicted, cpu_recomp_evicted_latched;
int cpu_recomp_reuse, cpu_recomp_reuse_latched;
int cpu_recomp_removed, cpu_recomp_removed_latched;
uint32_t codegen_endpc;
int codegen_block_cycles;
@@ -224,7 +219,6 @@ void codegen_check_flush(page_t *page, uint64_t mask, uint32_t phys_addr)
if (mask & block->page_mask)
{
delete_block(block);
cpu_recomp_evicted++;
}
if (block == block->next)
fatal("Broken 1\n");
@@ -238,7 +232,6 @@ void codegen_check_flush(page_t *page, uint64_t mask, uint32_t phys_addr)
if (mask & block->page_mask2)
{
delete_block(block);
cpu_recomp_evicted++;
}
if (block == block->next_2)
fatal("Broken 2\n");
@@ -260,7 +253,6 @@ void codegen_block_init(uint32_t phys_addr)
if (block->valid != 0)
{
delete_block(block);
cpu_recomp_reuse++;
}
block_num = HASH(phys_addr);
codeblock_hash[block_num] = &codeblock[block_current];
@@ -393,7 +385,6 @@ void codegen_block_remove()
codeblock_t *block = &codeblock[block_current];
delete_block(block);
cpu_recomp_removed++;
recomp_page = -1;
}
@@ -1049,7 +1040,6 @@ void codegen_generate_call(uint8_t opcode, OpFn op, uint32_t fetchdat, uint32_t
generate_call:
codegen_timing_opcode(opcode, fetchdat, op_32, op_pc);
codegen_accumulate(ACCREG_ins, 1);
codegen_accumulate(ACCREG_cycles, -codegen_block_cycles);
codegen_block_cycles = 0;
@@ -1096,10 +1086,11 @@ generate_call:
codegen_endpc = (cs + cpu_state.pc) + 8;
/* Check for interrupts. */
call(block, (uintptr_t)int_check);
addbyte(0x85); /*OR %eax, %eax*/
addbyte(0xc0);
addbyte(0xf6); /* test byte ptr[&pic_pending],1 */
addbyte(0x04);
addbyte(0x25);
addlong((uint32_t) (uintptr_t) &pic_pending);
addbyte(0x01);
addbyte(0x0F); addbyte(0x85); /*JNZ 0*/
addlong((uint32_t)(uintptr_t)&block->data[BLOCK_EXIT_OFFSET] - (uint32_t)(uintptr_t)(&block->data[block_pos + 4]));
@@ -1175,13 +1166,11 @@ generate_call:
block->ins++;
addbyte(0x85); /*OR %eax, %eax*/
addbyte(0xc0);
addbyte(0x0F); addbyte(0x85); /*JNZ 0*/
addlong((uint32_t)(uintptr_t)&block->data[BLOCK_EXIT_OFFSET] - (uint32_t)(uintptr_t)(&block->data[block_pos + 4]));
/* Check for interrupts. */
call(block, (uintptr_t)int_check);
addbyte(0x0a); /* or al,byte ptr[&pic_pending] */
addbyte(0x04);
addbyte(0x25);
addlong((uint32_t) (uintptr_t) &pic_pending);
addbyte(0x85); /*OR %eax, %eax*/
addbyte(0xc0);