fixed a few really dumb crash bugs in refac-jit

--HG--
branch : refac-jit
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/refac-jit%402383
This commit is contained in:
David Anderson 2008-07-08 07:59:33 +00:00
parent af54ae6af7
commit aa096f2385
4 changed files with 40 additions and 26 deletions

View File

@ -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)
{

View File

@ -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;
}
}

View File

@ -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:

View File

@ -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;