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:
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Version="8,00"
|
||||
Name="sourcemod_mm"
|
||||
ProjectGUID="{E39527CD-7CAB-4420-97CC-DA1B93B260BC}"
|
||||
RootNamespace="sourcemod_mm"
|
||||
@@ -1154,6 +1154,46 @@
|
||||
<File
|
||||
RelativePath="..\vm\sp_vm_engine.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release - Episode 1|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug - Episode 1|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="CrazyDebug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""$(SOURCEMM16)\sourcehook""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug - Old Metamod|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""$(SOURCEMM16)\sourcehook""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release - Old Metamod|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""$(SOURCEMM16)\sourcehook""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\vm\sp_vm_function.cpp"
|
||||
|
||||
+13
-9
@@ -33,6 +33,7 @@
|
||||
#include "TimerSys.h"
|
||||
#include "PluginSys.h"
|
||||
#include "Logger.h"
|
||||
#include "DebugReporter.h"
|
||||
|
||||
#define TIMER_HNDL_CLOSE (1<<9)
|
||||
|
||||
@@ -150,19 +151,23 @@ void TimerNatives::OnTimerEnd(ITimer *pTimer, void *pData)
|
||||
{
|
||||
if ((herr=g_HandleSys.FreeHandle(usrhndl, &sec)) != HandleError_None)
|
||||
{
|
||||
g_Logger.LogError("Invalid data handle %x (error %d) passed during timer end on plugin %s",
|
||||
usrhndl,
|
||||
herr,
|
||||
g_PluginSys.FindPluginByContext(pInfo->pContext->GetContext())->GetFilename());
|
||||
g_DbgReporter.GenerateError(pInfo->pContext,
|
||||
pInfo->Hook->GetFunctionID(),
|
||||
SP_ERROR_NATIVE,
|
||||
"Invalid data handle %x (error %d) passed during timer end",
|
||||
usrhndl,
|
||||
herr);
|
||||
}
|
||||
}
|
||||
|
||||
if ((herr=g_HandleSys.FreeHandle(pInfo->TimerHandle, &sec)) != HandleError_None)
|
||||
{
|
||||
g_Logger.LogError("Invalid timer handle %x (error %d) on plugin %s during timer end",
|
||||
pInfo->TimerHandle,
|
||||
herr,
|
||||
g_PluginSys.FindPluginByContext(pInfo->pContext->GetContext())->GetFilename());
|
||||
g_DbgReporter.GenerateError(pInfo->pContext,
|
||||
pInfo->Hook->GetFunctionID(),
|
||||
SP_ERROR_NATIVE,
|
||||
"Invalid timer handle %x (error %d) during timer end, displayed function is timer callback, not the stack trace",
|
||||
pInfo->TimerHandle,
|
||||
herr);
|
||||
return;
|
||||
}
|
||||
DeleteTimerInfo(pInfo);
|
||||
@@ -332,4 +337,3 @@ REGISTER_NATIVES(timernatives)
|
||||
{"IsServerProcessing", smn_IsServerProcessing},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
||||
@@ -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