[dynarmic] fix windows perf regression due to reordered CPR

Signed-off-by: lizzie <lizzie@eden-emu.dev>
This commit is contained in:
lizzie
2026-08-31 02:42:30 +00:00
parent b7f0f98519
commit 403cc0ab66
4 changed files with 12 additions and 11 deletions
@@ -39,9 +39,6 @@ struct A32JitState {
u32 cpsr_q = 0;
u32 cpsr_nzcv = 0;
u32 cpsr_jaifm = 0;
u32 fpsr_exc = 0;
u32 fpsr_qc = 0;
u32 fpsr_nzcv = 0;
alignas(16) std::array<u32, 64> ExtReg{}; // Extension registers.
@@ -56,6 +53,9 @@ struct A32JitState {
u32 rsb_ptr = 0;
std::array<u64, RSB_SIZE> rsb_location_descriptors;
std::array<u64, RSB_SIZE> rsb_codeptrs;
u32 fpsr_exc = 0;
u32 fpsr_qc = 0;
u32 fpsr_nzcv = 0;
u32 Cpsr() const;
void SetCpsr(u32 cpsr);
@@ -39,12 +39,7 @@ struct A64JitState {
u64 sp = 0;
u64 pc = 0;
u32 cpsr_nzcv = 0;
u32 fpsr_exc = 0;
u32 fpsr_qc = 0;
u32 fpcr = 0;
alignas(16) std::array<u64, 64> vec{}; // Extension registers.
// For internal use (See: BlockOfCode::RunCode)
u32 guest_MXCSR = 0x00001f80;
u32 asimd_MXCSR = 0x00009fc0;
@@ -55,6 +50,9 @@ struct A64JitState {
u32 rsb_ptr = 0;
std::array<u64, RSB_SIZE> rsb_location_descriptors;
std::array<u64, RSB_SIZE> rsb_codeptrs;
u32 fpsr_exc = 0;
u32 fpsr_qc = 0;
u32 fpcr = 0;
u32 GetPstate() const {
return NZCV::FromX64(cpsr_nzcv);
@@ -170,9 +170,9 @@ BlockOfCode::BlockOfCode(RunCodeCallbacks cb, JitStateInfo jsi, size_t total_cod
, nullptr //Allow RWE
#endif
, nullptr)
, constant_pool(*this, CONSTANT_POOL_SIZE)
, jsi(jsi)
, cb(std::move(cb))
, constant_pool(*this, CONSTANT_POOL_SIZE)
{
EnableWriting();
EnsureMemoryCommitted(PRELUDE_COMMIT_SIZE);
@@ -173,12 +173,15 @@ private:
static constexpr size_t MXCSR_ALREADY_EXITED = 1 << 0;
static constexpr size_t FORCE_RETURN = 1 << 1;
ConstantPool constant_pool;
// dont change the order of these
// Windows hates when jsi -> cb -> constant-pool are not in that
// specific order
JitStateInfo jsi;
RunCodeCallbacks cb;
ConstantPool constant_pool;
std::array<const void*, 4> return_from_run_code;
RunCodeFuncType run_code = nullptr;
RunCodeFuncType step_code = nullptr;
RunCodeCallbacks cb;
CodePtr code_begin = nullptr;
#ifdef _WIN32
size_t committed_size = 0;