tests/A32/testenv: Add type aliases for register arrays

Allows avoiding duplicating std::array instance sizes and types.
This commit is contained in:
Lioncash 2018-07-13 14:19:22 -04:00 committed by MerryMage
parent a25bacc436
commit 64d4e40081
3 changed files with 11 additions and 6 deletions

View file

@ -126,12 +126,13 @@ void FuzzJitArm(const size_t instruction_count, const size_t instructions_to_exe
u32 initial_cpsr = 0x000001D0;
std::array<u32, 16> initial_regs;
ArmTestEnv::RegisterArray initial_regs;
std::generate_n(initial_regs.begin(), 15, []{ return RandInt<u32>(0, 0xFFFFFFFF); });
initial_regs[15] = 0;
std::array<u32, 64> initial_extregs;
std::generate_n(initial_extregs.begin(), 64, []{ return RandInt<u32>(0, 0xFFFFFFFF); });
ArmTestEnv::ExtRegsArray initial_extregs;
std::generate(initial_extregs.begin(), initial_extregs.end(),
[]{ return RandInt<u32>(0, 0xFFFFFFFF); });
u32 initial_fpscr = 0x01000000 | (RandInt<u32>(0, 3) << 22);

View file

@ -86,7 +86,8 @@ static bool DoesBehaviorMatch(const ARMul_State& interp, const Dynarmic::A32::Ji
&& interp_write_records == jit_write_records;
}
static void RunInstance(size_t run_number, ThumbTestEnv& test_env, ARMul_State& interp, Dynarmic::A32::Jit& jit, const std::array<u32, 16>& initial_regs, size_t instruction_count, size_t instructions_to_execute_count) {
static void RunInstance(size_t run_number, ThumbTestEnv& test_env, ARMul_State& interp, Dynarmic::A32::Jit& jit, const ThumbTestEnv::RegisterArray& initial_regs,
size_t instruction_count, size_t instructions_to_execute_count) {
interp.instruction_cache.clear();
InterpreterClearCache();
jit.ClearCache();
@ -182,7 +183,7 @@ void FuzzJitThumb(const size_t instruction_count, const size_t instructions_to_e
Dynarmic::A32::Jit jit{GetUserConfig(&test_env)};
for (size_t run_number = 0; run_number < run_count; run_number++) {
std::array<u32, 16> initial_regs;
ThumbTestEnv::RegisterArray initial_regs;
std::generate_n(initial_regs.begin(), 15, []{ return RandInt<u32>(0, 0xFFFFFFFF); });
initial_regs[15] = 0;
@ -284,7 +285,7 @@ TEST_CASE("Verify fix for off by one error in MemoryRead32 worked", "[Thumb]") {
interp.user_callbacks = &test_env;
Dynarmic::A32::Jit jit{GetUserConfig(&test_env)};
std::array<u32, 16> initial_regs {
constexpr ThumbTestEnv::RegisterArray initial_regs {
0xe90ecd70,
0x3e3b73c3,
0x571616f9,

View file

@ -18,6 +18,9 @@
template <typename InstructionType, u32 infinite_loop>
class A32TestEnv final : public Dynarmic::A32::UserCallbacks {
public:
using RegisterArray = std::array<u32, 16>;
using ExtRegsArray = std::array<u32, 64>;
u64 ticks_left = 0;
bool code_mem_modified_by_guest = false;
std::array<InstructionType, 2048> code_mem{};