Optimization: Tweak RSB

This commit is contained in:
MerryMage 2016-08-15 14:08:06 +01:00
parent 070298b948
commit 624e84fa09
2 changed files with 3 additions and 3 deletions

View file

@ -1732,7 +1732,7 @@ void EmitX64::EmitTerminalLinkBlockFast(IR::Term::LinkBlockFast terminal, Arm::L
void EmitX64::EmitTerminalPopRSBHint(IR::Term::PopRSBHint, Arm::LocationDescriptor initial_location) { void EmitX64::EmitTerminalPopRSBHint(IR::Term::PopRSBHint, Arm::LocationDescriptor initial_location) {
// This calculation has to match up with IREmitter::PushRSB // This calculation has to match up with IREmitter::PushRSB
code->MOV(32, R(RBX), MJitStateCpsr()); code->MOV(32, R(RBX), MJitStateCpsr());
code->MOV(32, R(RCX), MJitStateReg(Arm::Reg::PC)); code->MOVZX(64, 32, RCX, MJitStateReg(Arm::Reg::PC));
code->AND(32, R(RBX), Imm32((1 << 5) | (1 << 9))); code->AND(32, R(RBX), Imm32((1 << 5) | (1 << 9)));
code->SHR(32, R(RBX), Imm8(2)); code->SHR(32, R(RBX), Imm8(2));
code->OR(32, R(RBX), MDisp(R15, offsetof(JitState, guest_FPSCR_mode))); code->OR(32, R(RBX), MDisp(R15, offsetof(JitState, guest_FPSCR_mode)));
@ -1744,7 +1744,7 @@ void EmitX64::EmitTerminalPopRSBHint(IR::Term::PopRSBHint, Arm::LocationDescript
code->CMP(64, R(RBX), MDisp(R15, int(offsetof(JitState, rsb_location_descriptors) + i * sizeof(u64)))); code->CMP(64, R(RBX), MDisp(R15, int(offsetof(JitState, rsb_location_descriptors) + i * sizeof(u64))));
code->CMOVcc(64, RAX, MDisp(R15, int(offsetof(JitState, rsb_codeptrs) + i * sizeof(u64))), CC_E); code->CMOVcc(64, RAX, MDisp(R15, int(offsetof(JitState, rsb_codeptrs) + i * sizeof(u64))), CC_E);
} }
code->SUB(32, MDisp(R15, offsetof(JitState, rsb_ptr)), Imm32(1));
code->JMPptr(R(RAX)); code->JMPptr(R(RAX));
} }

View file

@ -38,7 +38,7 @@ struct JitState {
u32 exclusive_state = 0; u32 exclusive_state = 0;
u32 exclusive_address = 0; u32 exclusive_address = 0;
static constexpr size_t RSBSize = 4; // MUST be a power of 2. static constexpr size_t RSBSize = 8; // MUST be a power of 2.ss
u32 rsb_ptr = 0; u32 rsb_ptr = 0;
std::array<u64, RSBSize> rsb_location_descriptors; std::array<u64, RSBSize> rsb_location_descriptors;
std::array<u64, RSBSize> rsb_codeptrs; std::array<u64, RSBSize> rsb_codeptrs;