diff --git a/core/logic/PluginSys.cpp b/core/logic/PluginSys.cpp index 2a5e2597..db4611cf 100644 --- a/core/logic/PluginSys.cpp +++ b/core/logic/PluginSys.cpp @@ -931,20 +931,12 @@ LoadRes CPluginManager::_LoadPlugin(CPlugin **aResult, const char *path, bool de pPlugin->m_type = PluginType_MapUpdated; - ICompilation *co = NULL; - if (pPlugin->m_status == Plugin_Uncompiled) - { - co = g_pSourcePawn2->StartCompilation(); - } - - /* Do the actual compiling */ - if (co != NULL) { char fullpath[PLATFORM_MAX_PATH]; g_pSM->BuildPath(Path_SM, fullpath, sizeof(fullpath), "plugins/%s", pPlugin->m_filename); - pPlugin->m_pRuntime = g_pSourcePawn2->LoadPlugin(co, fullpath, &err); + pPlugin->m_pRuntime = g_pSourcePawn2->LoadPlugin(nullptr, fullpath, &err); if (pPlugin->m_pRuntime == NULL) { if (error) diff --git a/public/sourcepawn/sp_vm_api.h b/public/sourcepawn/sp_vm_api.h index 9c7f45b8..653b2c4f 100644 --- a/public/sourcepawn/sp_vm_api.h +++ b/public/sourcepawn/sp_vm_api.h @@ -274,26 +274,7 @@ namespace SourcePawn virtual int LookupLine(ucell_t addr, uint32_t *line) =0; }; - /** - * @brief Represents a JIT compilation or plugin loading options. - */ - class ICompilation - { - public: - /** - * @brief Sets a compilation option. - * - * @param key Option name. - * @param val Option value. - * @return True on success, false on failure. - */ - virtual bool SetOption(const char *key, const char *val) =0; - - /** - * @brief Aborts the compilation and destroys this object. - */ - virtual void Abort() =0; - }; + class ICompilation; /** * @brief Interface to managing a runtime plugin. @@ -425,11 +406,9 @@ namespace SourcePawn virtual bool IsDebugging() =0; /** - * @brief Applies new compilation/runtime settings to the runtime code. + * @brief If |co| is non-NULL, destroys |co|. No other action is taken. * - * The compilation object is destroyed once this function completes. - * - * @return Error code (SP_ERROR_NONE on success). + * @return Returns SP_ERROR_NONE. */ virtual int ApplyCompilationOptions(ICompilation *co) =0; @@ -1194,9 +1173,9 @@ namespace SourcePawn virtual const char *GetVersionString() =0; /** - * @brief Creates a new compilation options object. + * @brief Deprecated. Returns null. * - * @return Compilation options object. + * @return Null. */ virtual ICompilation *StartCompilation() =0; @@ -1206,10 +1185,10 @@ namespace SourcePawn * If a compilation object is supplied, it is destroyed upon * the function's return. * - * @param co Compilation options, or NULL for defaults. + * @param co Must be NULL. * @param file Path to the file to compile. * @param err Error code (filled on failure); required. - * @return New runtime pointer, or NULL on failure. + * @return New runtime pointer, or NULL on failure. */ virtual IPluginRuntime *LoadPlugin(ICompilation *co, const char *file, int *err) =0; diff --git a/sourcepawn/jit/api.cpp b/sourcepawn/jit/api.cpp index c205e241..4b577d4d 100644 --- a/sourcepawn/jit/api.cpp +++ b/sourcepawn/jit/api.cpp @@ -185,6 +185,12 @@ SourcePawnEngine2::LoadPlugin(ICompilation *co, const char *file, int *err) size_t ignore; PluginRuntime *pRuntime; + if (co) { + if (err) + *err = SP_ERROR_PARAM; + return nullptr; + } + FILE *fp = fopen(file, "rb"); if (!fp) { @@ -275,8 +281,6 @@ SourcePawnEngine2::LoadPlugin(ICompilation *co, const char *file, int *err) if (!pRuntime->plugin()->name) pRuntime->SetName(file); - pRuntime->ApplyCompilationOptions(co); - fclose(fp); return pRuntime; @@ -332,7 +336,7 @@ SourcePawnEngine2::GetAPIVersion() ICompilation * SourcePawnEngine2::StartCompilation() { - return g_Jit.StartCompilation(); + return nullptr; } const char * @@ -364,9 +368,6 @@ SourcePawnEngine2::CreateEmptyRuntime(const char *name, uint32_t memory) } rt->SetName(name != NULL ? name : ""); - - rt->ApplyCompilationOptions(NULL); - return rt; } diff --git a/sourcepawn/jit/plugin-runtime.cpp b/sourcepawn/jit/plugin-runtime.cpp index 7afe77b3..029d952a 100644 --- a/sourcepawn/jit/plugin-runtime.cpp +++ b/sourcepawn/jit/plugin-runtime.cpp @@ -35,7 +35,6 @@ PluginRuntime::PluginRuntime() m_pCtx(NULL), m_PubFuncs(NULL), m_PubJitFuncs(NULL), - co_(NULL), m_CompSerial(0) { memset(&m_plugin, 0, sizeof(m_plugin)); @@ -75,8 +74,6 @@ PluginRuntime::~PluginRuntime() delete m_JitFunctions[i]; delete m_pCtx; - if (co_) - co_->Abort(); free(m_plugin.base); delete [] m_plugin.memory; @@ -304,7 +301,6 @@ int PluginRuntime::CreateFromMemory(sp_file_hdr_t *hdr, uint8_t *base) md5_data.raw_digest(m_DataHash); m_pCtx = new BaseContext(this); - co_ = g_Jit.StartCompilation(this); SetupFloatNativeRemapping(); function_map_size_ = m_plugin.pcode_size / sizeof(cell_t) + 1; @@ -587,12 +583,6 @@ BaseContext *PluginRuntime::GetBaseContext() int PluginRuntime::ApplyCompilationOptions(ICompilation *co) { - if (co == NULL) - return SP_ERROR_NONE; - - co_ = g_Jit.ApplyOptions(co_, co); - m_plugin.prof_flags = ((CompData *)co_)->profile; - return SP_ERROR_NONE; } @@ -609,7 +599,6 @@ PluginRuntime::CreateBlank(uint32_t heastk) m_plugin.memory = new uint8_t[heastk]; m_pCtx = new BaseContext(this); - co_ = g_Jit.StartCompilation(this); return SP_ERROR_NONE; } diff --git a/sourcepawn/jit/plugin-runtime.h b/sourcepawn/jit/plugin-runtime.h index 01365d69..f08c5342 100644 --- a/sourcepawn/jit/plugin-runtime.h +++ b/sourcepawn/jit/plugin-runtime.h @@ -115,9 +115,6 @@ class PluginRuntime ScriptedInvoker **m_PubFuncs; CompiledFunction **m_PubJitFuncs; - private: - ICompilation *co_; - public: unsigned int m_CompSerial; diff --git a/sourcepawn/jit/x86/jit_x86.cpp b/sourcepawn/jit/x86/jit_x86.cpp index 0f0be507..36f51247 100644 --- a/sourcepawn/jit/x86/jit_x86.cpp +++ b/sourcepawn/jit/x86/jit_x86.cpp @@ -1876,21 +1876,6 @@ GenerateEntry(void **retp, void **timeoutp) return code; } -ICompilation *JITX86::ApplyOptions(ICompilation *_IN, ICompilation *_OUT) -{ - if (_IN == NULL) - return _OUT; - - CompData *_in = (CompData * )_IN; - CompData *_out = (CompData * )_OUT; - - _in->inline_level = _out->inline_level; - _in->profile = _out->profile; - - _out->Abort(); - return _in; -} - JITX86::JITX86() { m_pJitEntry = NULL; @@ -1967,42 +1952,6 @@ JITX86::DestroyFakeNative(SPVM_NATIVE_FUNC func) Environment::get()->FreeCode((void *)func); } -ICompilation * -JITX86::StartCompilation() -{ - return new CompData; -} - -ICompilation * -JITX86::StartCompilation(PluginRuntime *runtime) -{ - return new CompData; -} - -void -CompData::Abort() -{ - delete this; -} - -bool -CompData::SetOption(const char *key, const char *val) -{ - if (strcmp(key, SP_JITCONF_DEBUG) == 0) - return true; - if (strcmp(key, SP_JITCONF_PROFILE) == 0) { - profile = atoi(val); - - /** Callbacks must be profiled to profile functions! */ - if ((profile & SP_PROF_FUNCTIONS) == SP_PROF_FUNCTIONS) - profile |= SP_PROF_CALLBACKS; - - return true; - } - - return false; -} - int JITX86::InvokeFunction(PluginRuntime *runtime, CompiledFunction *fn, cell_t *result) { diff --git a/sourcepawn/jit/x86/jit_x86.h b/sourcepawn/jit/x86/jit_x86.h index 7bb5bb0e..cba9051e 100644 --- a/sourcepawn/jit/x86/jit_x86.h +++ b/sourcepawn/jit/x86/jit_x86.h @@ -61,25 +61,6 @@ struct CallThunk } }; -class CompData : public ICompilation -{ -public: - CompData() - : profile(0), - inline_level(0) - { - }; - bool SetOption(const char *key, const char *val); - void Abort(); -public: - cell_t cur_func; /* current func pcode offset */ - /* Options */ - int profile; /* profiling flags */ - int inline_level; /* inline optimization level */ - /* Per-compilation properties */ - unsigned int func_idx; /* current function index */ -}; - class Compiler { public: @@ -152,12 +133,9 @@ class JITX86 public: bool InitializeJIT(); void ShutdownJIT(); - ICompilation *StartCompilation(PluginRuntime *runtime); - ICompilation *StartCompilation(); SPVM_NATIVE_FUNC CreateFakeNative(SPVM_FAKENATIVE_FUNC callback, void *pData); void DestroyFakeNative(SPVM_NATIVE_FUNC func); CompiledFunction *CompileFunction(PluginRuntime *runtime, cell_t pcode_offs, int *err); - ICompilation *ApplyOptions(ICompilation *_IN, ICompilation *_OUT); int InvokeFunction(PluginRuntime *runtime, CompiledFunction *fn, cell_t *result); void *TimeoutStub() const {