"fix" issues with ares recompiler not playing nice with states

these issues really come under fault of bad invalidation handling, for now just deal with the state size hit and dont invis these blocks of memory
This commit is contained in:
CasualPokePlayer 2023-03-30 19:44:09 -07:00
parent f7b83be5ab
commit 6ea7fd04d8
6 changed files with 9 additions and 6 deletions

Binary file not shown.

View File

@ -845,10 +845,13 @@ ECL_EXPORT void SetInputCallback(void (*callback)())
ECL_EXPORT void PostLoadState()
{
// fixme: make it so we can actually use this approach (there's various invalidation problems with the recompiler atm)
#if false
ares::Nintendo64::cpu.recompiler.allocator.release(bump_allocator::zero_fill);
ares::Nintendo64::cpu.recompiler.reset();
ares::Nintendo64::rsp.recompiler.allocator.release(bump_allocator::zero_fill);
ares::Nintendo64::rsp.recompiler.reset();
#endif
}
ECL_EXPORT void GetDisassembly(u32 address, u32 instruction, char* buf)

View File

@ -7,7 +7,7 @@ namespace ares::Memory {
FixedAllocator::FixedAllocator() {
}
#else
alignas(4096) u8 fixedBuffer[128_MiB] ECL_INVISIBLE;
alignas(4096) u8 fixedBuffer[8_MiB];
FixedAllocator::FixedAllocator() {
_allocator.resize(sizeof(fixedBuffer), 0, fixedBuffer);

View File

@ -155,8 +155,8 @@ auto CPU::power(bool reset) -> void {
context.setMode();
if constexpr(Accuracy::CPU::Recompiler) {
auto buffer = ares::Memory::FixedAllocator::get().tryAcquire(64_MiB);
recompiler.allocator.resize(64_MiB, bump_allocator::executable | bump_allocator::zero_fill, buffer);
auto buffer = ares::Memory::FixedAllocator::get().tryAcquire(4_MiB);
recompiler.allocator.resize(4_MiB, bump_allocator::executable | bump_allocator::zero_fill, buffer);
recompiler.reset();
}
}

View File

@ -872,7 +872,7 @@ struct CPU : Thread {
auto emitCOP2(u32 instruction) -> bool;
bump_allocator allocator;
Pool** pools = alloc_invisible<Pool*>(1 << 21); //2_MiB * sizeof(void*) == 16_MiB
Pool* pools[1 << 21]; //2_MiB * sizeof(void*) == 16_MiB
} recompiler{*this};
struct Disassembler {

View File

@ -115,8 +115,8 @@ auto RSP::power(bool reset) -> void {
}
if constexpr(Accuracy::RSP::Recompiler) {
auto buffer = ares::Memory::FixedAllocator::get().tryAcquire(64_MiB);
recompiler.allocator.resize(64_MiB, bump_allocator::executable | bump_allocator::zero_fill, buffer);
auto buffer = ares::Memory::FixedAllocator::get().tryAcquire(4_MiB);
recompiler.allocator.resize(4_MiB, bump_allocator::executable | bump_allocator::zero_fill, buffer);
recompiler.reset();
}