diff --git a/core/sourcemod.cpp b/core/sourcemod.cpp index 9c3dafc0..52e6f3aa 100644 --- a/core/sourcemod.cpp +++ b/core/sourcemod.cpp @@ -163,8 +163,8 @@ bool SourceModBase::InitializeSourceMod(char *error, size_t maxlength, bool late return false; } - GET_SP_V1 getv1 = (GET_SP_V1)g_pJIT->GetSymbolAddress("GetSourcePawn1"); - GET_SP_V2 getv2 = (GET_SP_V2)g_pJIT->GetSymbolAddress("GetSourcePawn2"); + GET_SP_V1 getv1 = (GET_SP_V1)g_pJIT->GetSymbolAddress("GetSourcePawnEngine1"); + GET_SP_V2 getv2 = (GET_SP_V2)g_pJIT->GetSymbolAddress("GetSourcePawnEngine2"); if (getv1 == NULL) { diff --git a/sourcepawn/jit/sp_vm_basecontext.cpp b/sourcepawn/jit/sp_vm_basecontext.cpp index eee58a7f..b2565da7 100644 --- a/sourcepawn/jit/sp_vm_basecontext.cpp +++ b/sourcepawn/jit/sp_vm_basecontext.cpp @@ -46,33 +46,13 @@ using namespace SourcePawn; BaseContext::BaseContext(BaseRuntime *pRuntime) { m_pRuntime = pRuntime; + m_pPlugin = m_pRuntime->m_pPlugin; m_InExec = false; m_CustomMsg = false; - /* Initialize the null references */ - uint32_t index; - if (FindPubvarByName("NULL_VECTOR", &index) == SP_ERROR_NONE) - { - sp_pubvar_t *pubvar; - GetPubvarByIndex(index, &pubvar); - m_pNullVec = pubvar->offs; - } - else - { - m_pNullVec = NULL; - } - - if (FindPubvarByName("NULL_STRING", &index) == SP_ERROR_NONE) - { - sp_pubvar_t *pubvar; - GetPubvarByIndex(index, &pubvar); - m_pNullString = pubvar->offs; - } - else - { - m_pNullString = NULL; - } + m_pNullVec = NULL; + m_pNullString = NULL; } BaseContext::~BaseContext() @@ -668,6 +648,8 @@ int BaseRuntime::ApplyCompilationOptions(ICompilation *co) RefreshFunctionCache(); + m_pCtx->Refresh(); + return SP_ERROR_NONE; } @@ -792,3 +774,30 @@ bool BaseContext::GetKey(int k, void **value) return true; } + +void BaseContext::Refresh() +{ + /* Initialize the null references */ + uint32_t index; + if (FindPubvarByName("NULL_VECTOR", &index) == SP_ERROR_NONE) + { + sp_pubvar_t *pubvar; + GetPubvarByIndex(index, &pubvar); + m_pNullVec = pubvar->offs; + } + else + { + m_pNullVec = NULL; + } + + if (FindPubvarByName("NULL_STRING", &index) == SP_ERROR_NONE) + { + sp_pubvar_t *pubvar; + GetPubvarByIndex(index, &pubvar); + m_pNullString = pubvar->offs; + } + else + { + m_pNullString = NULL; + } +} diff --git a/sourcepawn/jit/sp_vm_basecontext.h b/sourcepawn/jit/sp_vm_basecontext.h index d586e410..d883e31a 100644 --- a/sourcepawn/jit/sp_vm_basecontext.h +++ b/sourcepawn/jit/sp_vm_basecontext.h @@ -92,6 +92,7 @@ public: //IPluginContext cell_t *GetLocalParams(); void SetKey(int k, void *value); bool GetKey(int k, void **value); + void Refresh(); public: bool IsInExec(); private: diff --git a/sourcepawn/jit/x86/jit_x86.cpp b/sourcepawn/jit/x86/jit_x86.cpp index 9ac62866..fd3ed9db 100644 --- a/sourcepawn/jit/x86/jit_x86.cpp +++ b/sourcepawn/jit/x86/jit_x86.cpp @@ -2495,6 +2495,7 @@ bool JITX86::Compile(ICompilation *co, BaseRuntime *prt, int *err) } data->SetRuntime(prt); + plugin = data->plugin; } /* The first phase is to browse */ @@ -2914,10 +2915,13 @@ ICompilation *JITX86::StartCompilation() void CompData::SetRuntime(BaseRuntime *runtime) { + plugin = runtime->m_pPlugin; + uint32_t max_natives = plugin->info.natives_num; const char *strbase = plugin->info.stringbase; - plugin = runtime->m_pPlugin; + this->runtime = runtime; + inline_level = JIT_INLINE_ERRORCHECKS|JIT_INLINE_NATIVES; error_set = SP_ERROR_NONE;