From fcec0ee7c72622abb02361963287869f09cfe14a Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 24 Feb 2015 23:50:23 -0800 Subject: [PATCH] Use AutoPtr in more places in the JIT. --- sourcepawn/jit/plugin-runtime.cpp | 10 ---------- sourcepawn/jit/plugin-runtime.h | 8 +++----- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/sourcepawn/jit/plugin-runtime.cpp b/sourcepawn/jit/plugin-runtime.cpp index 751b0f2b..6210ac9b 100644 --- a/sourcepawn/jit/plugin-runtime.cpp +++ b/sourcepawn/jit/plugin-runtime.cpp @@ -32,17 +32,11 @@ IsPointerCellAligned(void *p) PluginRuntime::PluginRuntime() : m_Debug(&m_plugin), - m_pCtx(NULL), m_PubFuncs(NULL), m_CompSerial(0) { memset(&m_plugin, 0, sizeof(m_plugin)); - m_MaxFuncs = 0; - m_NumFuncs = 0; - float_table_ = NULL; - alt_pcode_ = NULL; - memset(m_CodeHash, 0, sizeof(m_CodeHash)); memset(m_DataHash, 0, sizeof(m_DataHash)); @@ -63,14 +57,10 @@ PluginRuntime::~PluginRuntime() for (uint32_t i = 0; i < m_plugin.num_publics; i++) delete m_PubFuncs[i]; delete [] m_PubFuncs; - delete [] float_table_; - delete [] alt_pcode_; for (size_t i = 0; i < m_JitFunctions.length(); i++) delete m_JitFunctions[i]; - delete m_pCtx; - free(m_plugin.base); delete [] m_plugin.memory; delete [] m_plugin.publics; diff --git a/sourcepawn/jit/plugin-runtime.h b/sourcepawn/jit/plugin-runtime.h index a3e34690..5fbb925a 100644 --- a/sourcepawn/jit/plugin-runtime.h +++ b/sourcepawn/jit/plugin-runtime.h @@ -107,10 +107,8 @@ class PluginRuntime private: sp_plugin_t m_plugin; - uint8_t *alt_pcode_; - unsigned int m_NumFuncs; - unsigned int m_MaxFuncs; - floattbl_t *float_table_; + ke::AutoArray alt_pcode_; + ke::AutoArray float_table_; struct FunctionMapPolicy { static inline uint32_t hash(ucell_t value) { @@ -127,7 +125,7 @@ class PluginRuntime public: DebugInfo m_Debug; - PluginContext *m_pCtx; + ke::AutoPtr m_pCtx; ScriptedInvoker **m_PubFuncs; public: