Reset JIT before saving/loading state

This commit is contained in:
Henrik Rydgård 2012-12-29 00:09:17 +01:00
parent 90e3042b17
commit f9133c1a56
5 changed files with 15 additions and 8 deletions

View file

@ -94,8 +94,10 @@ public:
JitBlockCache *GetBlockCache() { return &blocks; }
AsmRoutineManager &Asm() { return asm_; }
private:
void ClearCache();
private:
void FlushAll();
void WriteExit(u32 destination, int exit_num);

View file

@ -93,8 +93,9 @@ public:
JitBlockCache *GetBlockCache() { return &blocks; }
AsmRoutineManager &Asm() { return asm_; }
private:
void ClearCache();
private:
void FlushAll();
void WriteExit(u32 destination, int exit_num);

View file

@ -104,7 +104,6 @@ JitBlockCache::~JitBlockCache()
Shutdown();
}
// This clears the JIT cache. It's called from JitCache.cpp when the JIT cache
// is full and when saving and loading states.
void JitBlockCache::Clear()

View file

@ -26,6 +26,7 @@
#include "HW/MemoryStick.h"
#include "MemMap.h"
#include "MIPS/MIPS.h"
#include "MIPS/JitCommon/JitCommon.h"
#include "System.h"
namespace SaveState
@ -95,12 +96,12 @@ namespace SaveState
CoreTiming::ScheduleEvent_Threadsafe(0, timer);
}
void Load(std::string &filename, Callback callback)
void Load(const std::string &filename, Callback callback)
{
Enqueue(Operation(SAVESTATE_LOAD, filename, callback));
}
void Save(std::string &filename, Callback callback)
void Save(const std::string &filename, Callback callback)
{
Enqueue(Operation(SAVESTATE_SAVE, filename, callback));
}
@ -132,11 +133,15 @@ namespace SaveState
switch (op.type)
{
case SAVESTATE_LOAD:
if (MIPSComp::jit)
MIPSComp::jit->ClearCache();
INFO_LOG(COMMON, "Loading state from %s", op.filename.c_str());
result = CChunkFileReader::Load(op.filename, REVISION, state);
break;
case SAVESTATE_SAVE:
if (MIPSComp::jit)
MIPSComp::jit->ClearCache();
INFO_LOG(COMMON, "Saving state to %s", op.filename.c_str());
result = CChunkFileReader::Save(op.filename, REVISION, state);
break;

View file

@ -29,11 +29,11 @@ namespace SaveState
// Load the specified file into the current state (async.)
// Warning: callback will be called on a different thread.
void Load(std::string &filename, Callback callback = NULL);
void Load(const std::string &filename, Callback callback = NULL);
// Save the current state to the specified file (async.)
// Warning: callback will be called on a different thread.
void Save(std::string &filename, Callback callback = NULL);
void Save(const std::string &filename, Callback callback = NULL);
// For testing / automated tests. Runs a save state verification pass (async.)
// Warning: callback will be called on a different thread.
void Verify(Callback callback = NULL);
};
};