aboutsummaryrefslogtreecommitdiff
path: root/ARMeilleure/Translation/PTC/Ptc.cs
diff options
context:
space:
mode:
Diffstat (limited to 'ARMeilleure/Translation/PTC/Ptc.cs')
-rw-r--r--ARMeilleure/Translation/PTC/Ptc.cs16
1 files changed, 11 insertions, 5 deletions
diff --git a/ARMeilleure/Translation/PTC/Ptc.cs b/ARMeilleure/Translation/PTC/Ptc.cs
index f382cc63..8f250a55 100644
--- a/ARMeilleure/Translation/PTC/Ptc.cs
+++ b/ARMeilleure/Translation/PTC/Ptc.cs
@@ -98,7 +98,6 @@ namespace ARMeilleure.Translation.PTC
ClearMemoryStreams();
PtcJumpTable.Clear();
- PtcProfiler.Stop();
PtcProfiler.Wait();
PtcProfiler.ClearEntries();
@@ -345,6 +344,8 @@ namespace ARMeilleure.Translation.PTC
private static void Save(string fileName)
{
+ int translatedFuncsCount;
+
using (MemoryStream stream = new MemoryStream())
using (MD5 md5 = MD5.Create())
{
@@ -361,6 +362,11 @@ namespace ARMeilleure.Translation.PTC
PtcJumpTable.Serialize(stream, PtcJumpTable);
+ translatedFuncsCount = GetInfosEntriesCount();
+
+ ClearMemoryStreams();
+ PtcJumpTable.Clear();
+
stream.Seek((long)hashSize, SeekOrigin.Begin);
byte[] hash = md5.ComputeHash(stream);
@@ -388,7 +394,7 @@ namespace ARMeilleure.Translation.PTC
long fileSize = new FileInfo(fileName).Length;
- Logger.Info?.Print(LogClass.Ptc, $"Saved Translation Cache (size: {fileSize} bytes, translated functions: {GetInfosEntriesCount()}).");
+ Logger.Info?.Print(LogClass.Ptc, $"Saved Translation Cache (size: {fileSize} bytes, translated functions: {translatedFuncsCount}).");
}
private static void WriteHeader(MemoryStream stream)
@@ -709,10 +715,10 @@ namespace ARMeilleure.Translation.PTC
threads.Clear();
- _loggerEvent.Set();
-
Translator.ResetPools();
+ _loggerEvent.Set();
+
PtcJumpTable.Initialize(jumpTable);
PtcJumpTable.ReadJumpTable(jumpTable);
@@ -736,7 +742,7 @@ namespace ARMeilleure.Translation.PTC
Logger.Info?.Print(LogClass.Ptc, $"{_translateCount} of {profiledFuncsToTranslateCount} functions translated");
}
- internal static void WriteInfoCodeReloc(ulong address, ulong guestSize, bool highCq, PtcInfo ptcInfo)
+ internal static void WriteInfoCodeRelocUnwindInfo(ulong address, ulong guestSize, bool highCq, PtcInfo ptcInfo)
{
lock (_lock)
{