Skip to content

Commit 6a9c284

Browse files
committed
Added back memory callbacks
Updated DynamicHooks
1 parent 3ea0848 commit 6a9c284

6 files changed

Lines changed: 14 additions & 9 deletions

File tree

src/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,14 +260,14 @@ Set(SOURCEPYTHON_MEMORY_MODULE_HEADERS
260260
core/modules/memory/memory_tools.h
261261
core/modules/memory/memory_scanner.h
262262
core/modules/memory/memory_hooks.h
263-
#core/modules/memory/memory_callback.h
263+
core/modules/memory/memory_callback.h
264264
)
265265

266266
Set(SOURCEPYTHON_MEMORY_MODULE_SOURCES
267267
core/modules/memory/memory_scanner.cpp
268268
core/modules/memory/memory_tools.cpp
269269
core/modules/memory/memory_hooks.cpp
270-
#core/modules/memory/memory_callback.cpp
270+
core/modules/memory/memory_callback.cpp
271271
core/modules/memory/memory_wrap_python.cpp
272272
)
273273

src/core/modules/memory/memory_callback.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,10 @@ int CCallback::GetPopSize()
136136

137137
int size = 0;
138138
for(; i < len(m_Args); i++)
139-
size += GetTypeSize(extract<DataType_t>(m_Args[i]));
139+
{
140+
// TODO: Add alignment
141+
size += GetDataTypeSize(extract<DataType_t>(m_Args[i]));
142+
}
140143

141144
return size;
142145
#endif
@@ -151,7 +154,8 @@ int CCallback::GetArgumentOffset(int iIndex)
151154

152155
for(int i=0; i <= iIndex - 1; i++)
153156
{
154-
offset += GetTypeSize(extract<DataType_t>(m_Args[i]));
157+
// TODO: Add alignment
158+
offset += GetDataTypeSize(extract<DataType_t>(m_Args[i]));
155159
}
156160

157161
// Subtract the this pointer on Windows

src/core/modules/memory/memory_hooks.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
#include "boost/python.hpp"
1111
using namespace boost::python;
1212

13-
#include "memory_tools.h"
14-
1513
// DynamicHooks
1614
#include "hook.h"
1715

src/core/modules/memory/memory_wrap_python.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "memory_scanner.h"
3232
#include "memory_tools.h"
3333
#include "memory_hooks.h"
34+
#include "memory_callback.h"
3435

3536
#include "dyncall.h"
3637

@@ -432,14 +433,12 @@ void export_dynamichooks()
432433
//-----------------------------------------------------------------------------
433434
void export_callbacks()
434435
{
435-
/*
436436
class_< CCallback, bases< CFunction >, boost::noncopyable >("Callback", init< object, Convention_t, tuple, object, optional<bool> >())
437437
.def_readwrite("callback",
438438
&CCallback::m_oCallback,
439439
"The Python function that gets called by the C++ callback"
440440
)
441441
;
442-
*/
443442
}
444443

445444

src/thirdparty/DynamicHooks/include/hook.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,11 @@ typedef bool (*HookHandlerFn)(HookType_t, CHook*);
6868
// ============================================================================
6969
// >> CLASSES
7070
// ============================================================================
71-
class Assembler;
71+
namespace AsmJit {
72+
struct Assembler;
73+
}
74+
using namespace AsmJit;
75+
7276
class CHook
7377
{
7478
private:
-46 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)