1.1 --- a/sourcepawn/jit/BaseRuntime.cpp Tue Aug 07 18:04:10 2012 +0100
1.2 +++ b/sourcepawn/jit/BaseRuntime.cpp Thu Aug 09 01:54:43 2012 +0100
1.3 @@ -8,6 +8,8 @@
1.4 #include "sp_vm_basecontext.h"
1.5 #include "engine2.h"
1.6
1.7 +#include "md5/md5.h"
1.8 +
1.9 using namespace SourcePawn;
1.10
1.11 BaseRuntime::BaseRuntime() : m_Debug(&m_plugin), m_pPlugin(&m_plugin), m_pCtx(NULL),
1.12 @@ -18,6 +20,9 @@
1.13 m_FuncCache = NULL;
1.14 m_MaxFuncs = 0;
1.15 m_NumFuncs = 0;
1.16 +
1.17 + memset(m_CodeHash, 0, sizeof(m_CodeHash));
1.18 + memset(m_DataHash, 0, sizeof(m_DataHash));
1.19 }
1.20
1.21 BaseRuntime::~BaseRuntime()
1.22 @@ -227,6 +232,16 @@
1.23 memset(m_PubJitFuncs, 0, sizeof(JitFunction *) * m_pPlugin->num_publics);
1.24 }
1.25
1.26 + MD5 md5_pcode;
1.27 + md5_pcode.update(plugin->pcode, plugin->pcode_size);
1.28 + md5_pcode.finalize();
1.29 + md5_pcode.raw_digest(m_CodeHash);
1.30 +
1.31 + MD5 md5_data;
1.32 + md5_data.update(plugin->data, plugin->data_size);
1.33 + md5_data.finalize();
1.34 + md5_data.raw_digest(m_DataHash);
1.35 +
1.36 m_pPlugin->profiler = g_engine2.GetProfiler();
1.37 m_pCtx = new BaseContext(this);
1.38 m_pCo = g_Jit.StartCompilation(this);
1.39 @@ -483,6 +498,16 @@
1.40 return mem;
1.41 }
1.42
1.43 +unsigned char *BaseRuntime::GetCodeHash()
1.44 +{
1.45 + return m_CodeHash;
1.46 +}
1.47 +
1.48 +unsigned char *BaseRuntime::GetDataHash()
1.49 +{
1.50 + return m_DataHash;
1.51 +}
1.52 +
1.53 BaseContext *BaseRuntime::GetBaseContext()
1.54 {
1.55 return m_pCtx;