GetContext() now returns 'this' as a hack (shouldn't+can't be accessed anyway)
--HG-- branch : refac-jit extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/refac-jit%402397
This commit is contained in:
parent
f9b294d89e
commit
79cf4e07eb
@ -494,7 +494,9 @@ namespace SourcePawn
|
|||||||
/**
|
/**
|
||||||
* @brief Deprecated, do not use.
|
* @brief Deprecated, do not use.
|
||||||
*
|
*
|
||||||
* @return Opaque pointer.
|
* Returns the pointer of this object, casted to an opaque structure.
|
||||||
|
*
|
||||||
|
* @return Returns this.
|
||||||
*/
|
*/
|
||||||
virtual sp_context_t *GetContext() =0;
|
virtual sp_context_t *GetContext() =0;
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ BaseRuntime::~BaseRuntime()
|
|||||||
|
|
||||||
void BaseRuntime::ClearCompile()
|
void BaseRuntime::ClearCompile()
|
||||||
{
|
{
|
||||||
g_Jit1.FreeContextVars(m_pCtx->GetContext());
|
g_Jit1.FreeContextVars(m_pCtx->GetCtx());
|
||||||
g_Jit1.FreePluginVars(m_pPlugin);
|
g_Jit1.FreePluginVars(m_pPlugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -349,3 +349,9 @@ size_t BaseRuntime::GetMemUsage()
|
|||||||
|
|
||||||
return mem;
|
return mem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BaseContext *BaseRuntime::GetBaseContext()
|
||||||
|
{
|
||||||
|
return m_pCtx;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -45,6 +45,8 @@ public:
|
|||||||
virtual void SetPauseState(bool paused);
|
virtual void SetPauseState(bool paused);
|
||||||
virtual bool IsPaused();
|
virtual bool IsPaused();
|
||||||
virtual size_t GetMemUsage();
|
virtual size_t GetMemUsage();
|
||||||
|
public:
|
||||||
|
BaseContext *GetBaseContext();
|
||||||
private:
|
private:
|
||||||
void ClearCompile();
|
void ClearCompile();
|
||||||
void RefreshFunctionCache();
|
void RefreshFunctionCache();
|
||||||
|
@ -65,6 +65,11 @@ IVirtualMachine *BaseContext::GetVirtualMachine()
|
|||||||
}
|
}
|
||||||
|
|
||||||
sp_context_t *BaseContext::GetContext()
|
sp_context_t *BaseContext::GetContext()
|
||||||
|
{
|
||||||
|
return reinterpret_cast<sp_context_t *>((IPluginContext * )this);
|
||||||
|
}
|
||||||
|
|
||||||
|
sp_context_t *BaseContext::GetCtx()
|
||||||
{
|
{
|
||||||
return &m_ctx;
|
return &m_ctx;
|
||||||
}
|
}
|
||||||
@ -481,12 +486,14 @@ int BaseContext::LocalToStringNULL(cell_t local_addr, char **addr)
|
|||||||
|
|
||||||
SourceMod::IdentityToken_t *BaseContext::GetIdentity()
|
SourceMod::IdentityToken_t *BaseContext::GetIdentity()
|
||||||
{
|
{
|
||||||
return m_pToken;
|
SourceMod::IdentityToken_t *tok;
|
||||||
}
|
|
||||||
|
|
||||||
void BaseContext::SetIdentity(SourceMod::IdentityToken_t *token)
|
if (GetKey(1, (void **)&tok))
|
||||||
{
|
{
|
||||||
m_pToken = token;
|
return tok;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
cell_t *BaseContext::GetNullRef(SP_NULL_TYPE type)
|
cell_t *BaseContext::GetNullRef(SP_NULL_TYPE type)
|
||||||
@ -536,7 +543,7 @@ int BaseContext::Execute(IPluginFunction *function, const cell_t *params, unsign
|
|||||||
return SP_ERROR_NOT_RUNNABLE;
|
return SP_ERROR_NOT_RUNNABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_ctx.hp + 16*sizeof(cell_t) > (cell_t)(m_ctx.sp - (sizeof(cell_t) * (num_params + 1))))
|
if ((cell_t)(m_ctx.hp + 16*sizeof(cell_t)) > (cell_t)(m_ctx.sp - (sizeof(cell_t) * (num_params + 1))))
|
||||||
{
|
{
|
||||||
return SP_ERROR_STACKLOW;
|
return SP_ERROR_STACKLOW;
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,7 @@ public:
|
|||||||
public: //IPluginContext
|
public: //IPluginContext
|
||||||
IVirtualMachine *GetVirtualMachine();
|
IVirtualMachine *GetVirtualMachine();
|
||||||
sp_context_t *GetContext();
|
sp_context_t *GetContext();
|
||||||
|
sp_context_t *GetCtx();
|
||||||
bool IsDebugging();
|
bool IsDebugging();
|
||||||
int SetDebugBreak(void *newpfn, void *oldpfn);
|
int SetDebugBreak(void *newpfn, void *oldpfn);
|
||||||
IPluginDebugInfo *GetDebugInfo();
|
IPluginDebugInfo *GetDebugInfo();
|
||||||
@ -82,7 +83,6 @@ public: //IPluginContext
|
|||||||
IPluginFunction *GetFunctionByName(const char *public_name);
|
IPluginFunction *GetFunctionByName(const char *public_name);
|
||||||
IPluginFunction *GetFunctionById(funcid_t func_id);
|
IPluginFunction *GetFunctionById(funcid_t func_id);
|
||||||
SourceMod::IdentityToken_t *GetIdentity();
|
SourceMod::IdentityToken_t *GetIdentity();
|
||||||
void SetIdentity(SourceMod::IdentityToken_t *token);
|
|
||||||
cell_t *GetNullRef(SP_NULL_TYPE type);
|
cell_t *GetNullRef(SP_NULL_TYPE type);
|
||||||
int LocalToStringNULL(cell_t local_addr, char **addr);
|
int LocalToStringNULL(cell_t local_addr, char **addr);
|
||||||
int BindNativeToIndex(uint32_t index, SPVM_NATIVE_FUNC native);
|
int BindNativeToIndex(uint32_t index, SPVM_NATIVE_FUNC native);
|
||||||
@ -100,7 +100,6 @@ private:
|
|||||||
void _SetErrorMessage(const char *msg, ...);
|
void _SetErrorMessage(const char *msg, ...);
|
||||||
private:
|
private:
|
||||||
sp_plugin_t *m_pPlugin;
|
sp_plugin_t *m_pPlugin;
|
||||||
SourceMod::IdentityToken_t *m_pToken;
|
|
||||||
cell_t *m_pNullVec;
|
cell_t *m_pNullVec;
|
||||||
cell_t *m_pNullString;
|
cell_t *m_pNullString;
|
||||||
char m_MsgCache[1024];
|
char m_MsgCache[1024];
|
||||||
|
@ -329,9 +329,9 @@ void SourcePawnEngine::PopTracer(int error, const char *msg)
|
|||||||
{
|
{
|
||||||
uint32_t native = INVALID_CIP;
|
uint32_t native = INVALID_CIP;
|
||||||
|
|
||||||
if (m_CallStack->ctx->GetContext()->n_err)
|
if (m_CallStack->ctx->GetCtx()->n_err)
|
||||||
{
|
{
|
||||||
native = m_CallStack->ctx->GetContext()->n_idx;
|
native = m_CallStack->ctx->GetCtx()->n_idx;
|
||||||
}
|
}
|
||||||
|
|
||||||
CContextTrace trace(m_CallStack, error, msg, native);
|
CContextTrace trace(m_CallStack, error, msg, native);
|
||||||
|
@ -38,6 +38,8 @@
|
|||||||
#include "../jit_version.h"
|
#include "../jit_version.h"
|
||||||
#include "../sp_vm_engine.h"
|
#include "../sp_vm_engine.h"
|
||||||
#include "../engine2.h"
|
#include "../engine2.h"
|
||||||
|
#include "BaseRuntime.h"
|
||||||
|
#include "../sp_vm_basecontext.h"
|
||||||
|
|
||||||
#if defined USE_UNGEN_OPCODES
|
#if defined USE_UNGEN_OPCODES
|
||||||
#include "ungen_opcodes.h"
|
#include "ungen_opcodes.h"
|
||||||
@ -2416,10 +2418,7 @@ cell_t NativeCallback_Debug_Profile(sp_context_t *ctx, ucell_t native_idx, cell_
|
|||||||
|
|
||||||
static cell_t InvalidNative(IPluginContext *pCtx, const cell_t *params)
|
static cell_t InvalidNative(IPluginContext *pCtx, const cell_t *params)
|
||||||
{
|
{
|
||||||
sp_context_t *ctx = pCtx->GetContext();
|
return pCtx->ThrowNativeErrorEx(SP_ERROR_INVALID_NATIVE, "Invalid native");
|
||||||
ctx->n_err = SP_ERROR_INVALID_NATIVE;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
jitoffs_t RelocLookup(JitWriter *jit, cell_t pcode_offs, bool relative)
|
jitoffs_t RelocLookup(JitWriter *jit, cell_t pcode_offs, bool relative)
|
||||||
@ -2664,7 +2663,7 @@ jit_rewind:
|
|||||||
*************/
|
*************/
|
||||||
|
|
||||||
/* setup basics */
|
/* setup basics */
|
||||||
sp_context_t *ctx = data->runtime->GetDefaultContext()->GetContext();
|
sp_context_t *ctx = data->runtime->GetBaseContext()->GetCtx();
|
||||||
|
|
||||||
/* Clear out any old cruft */
|
/* Clear out any old cruft */
|
||||||
if (plugin->codebase != NULL)
|
if (plugin->codebase != NULL)
|
||||||
|
Loading…
Reference in New Issue
Block a user