Executable memory is now provided by MM:S's allocator, this should reduce virtual memory usage.
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401900
This commit is contained in:
@@ -90,7 +90,7 @@ const char *GetSourcePawnErrorMessage(int error)
|
||||
return g_ErrorMsgTable[error];
|
||||
}
|
||||
|
||||
SourcePawnEngine::SourcePawnEngine()
|
||||
SourcePawnEngine::SourcePawnEngine() : m_ExeMemory(16)
|
||||
{
|
||||
m_pDebugHook = NULL;
|
||||
m_CallStack = NULL;
|
||||
@@ -137,6 +137,26 @@ void *SourcePawnEngine::ExecAlloc(size_t size)
|
||||
#endif
|
||||
}
|
||||
|
||||
void *SourcePawnEngine::AllocatePageMemory(size_t size)
|
||||
{
|
||||
return m_ExeMemory.Alloc(size);
|
||||
}
|
||||
|
||||
void SourcePawnEngine::SetReadExecute(void *ptr)
|
||||
{
|
||||
m_ExeMemory.SetRE(ptr);
|
||||
}
|
||||
|
||||
void SourcePawnEngine::SetReadWrite(void *ptr)
|
||||
{
|
||||
m_ExeMemory.SetRW(ptr);
|
||||
}
|
||||
|
||||
void SourcePawnEngine::FreePageMemory(void *ptr)
|
||||
{
|
||||
m_ExeMemory.Free(ptr);
|
||||
}
|
||||
|
||||
void SourcePawnEngine::ExecFree(void *address)
|
||||
{
|
||||
#if defined WIN32
|
||||
|
||||
@@ -32,6 +32,15 @@
|
||||
#ifndef _INCLUDE_SOURCEPAWN_VM_ENGINE_H_
|
||||
#define _INCLUDE_SOURCEPAWN_VM_ENGINE_H_
|
||||
|
||||
#include <sh_memory.h>
|
||||
/* HACK to avoid including sourcehook.h for just the SH_ASSERT definition */
|
||||
#if !defined SH_ASSERT
|
||||
#define SH_ASSERT(x, info)
|
||||
#include <sh_pagealloc.h>
|
||||
#undef SH_ASSERT
|
||||
#else
|
||||
#include <sh_pagealloc.h>
|
||||
#endif
|
||||
#include "sp_vm_api.h"
|
||||
#include "sp_vm_function.h"
|
||||
|
||||
@@ -82,6 +91,10 @@ public: //ISourcePawnEngine
|
||||
IDebugListener *SetDebugListener(IDebugListener *pListener);
|
||||
unsigned int GetContextCallCount();
|
||||
unsigned int GetEngineAPIVersion();
|
||||
void *AllocatePageMemory(size_t size);
|
||||
void SetReadWrite(void *ptr);
|
||||
void SetReadExecute(void *ptr);
|
||||
void FreePageMemory(void *ptr);
|
||||
public: //Debugger Stuff
|
||||
/**
|
||||
* @brief Pushes a context onto the top of the call tracer.
|
||||
@@ -110,6 +123,7 @@ private:
|
||||
TracedCall *m_FreedCalls;
|
||||
TracedCall *m_CallStack;
|
||||
unsigned int m_CurChain;
|
||||
SourceHook::CPageAlloc m_ExeMemory;
|
||||
//CFunction *m_pFreeFuncs;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user