test_generator: Allow rerunning jit

This commit is contained in:
Merry 2022-11-08 21:39:53 +00:00
parent d6f2a15834
commit 5f753e483f

View file

@ -261,7 +261,7 @@ Dynarmic::A32::UserConfig GetUserConfig(TestEnv& testenv) {
return user_config; return user_config;
} }
template<typename TestEnv> template<size_t num_jit_reruns = 1, typename TestEnv>
static void RunTestInstance(Dynarmic::A32::Jit& jit, static void RunTestInstance(Dynarmic::A32::Jit& jit,
TestEnv& jit_env, TestEnv& jit_env,
const std::array<u32, 16>& regs, const std::array<u32, 16>& regs,
@ -274,6 +274,9 @@ static void RunTestInstance(Dynarmic::A32::Jit& jit,
const u32 num_words = initial_pc / sizeof(typename TestEnv::InstructionType); const u32 num_words = initial_pc / sizeof(typename TestEnv::InstructionType);
const u32 code_mem_size = num_words + static_cast<u32>(instructions.size()); const u32 code_mem_size = num_words + static_cast<u32>(instructions.size());
jit.ClearCache();
for (size_t jit_rerun_count = 0; jit_rerun_count < num_jit_reruns; ++jit_rerun_count) {
jit_env.code_mem.resize(code_mem_size); jit_env.code_mem.resize(code_mem_size);
std::fill(jit_env.code_mem.begin(), jit_env.code_mem.end(), TestEnv::infinite_loop); std::fill(jit_env.code_mem.begin(), jit_env.code_mem.end(), TestEnv::infinite_loop);
@ -286,10 +289,10 @@ static void RunTestInstance(Dynarmic::A32::Jit& jit,
jit.ExtRegs() = vecs; jit.ExtRegs() = vecs;
jit.SetFpscr(fpscr); jit.SetFpscr(fpscr);
jit.SetCpsr(cpsr); jit.SetCpsr(cpsr);
jit.ClearCache();
jit_env.ticks_left = ticks_left; jit_env.ticks_left = ticks_left;
jit.Run(); jit.Run();
}
fmt::print("instructions: "); fmt::print("instructions: ");
for (auto instruction : instructions) { for (auto instruction : instructions) {