Skip to content

Commit

Permalink
expose MemType enum and check function in the hx namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
Aidan63 committed Jan 3, 2024
1 parent 45ee673 commit dbeba7e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
4 changes: 4 additions & 0 deletions include/hx/GC.h
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,10 @@ void GCPrepareMultiThreaded();
namespace hx
{

enum MemType { memUnmanaged, memBlock, memLarge };

MemType GetMemType(void*);

#define HX_USE_INLINE_IMMIX_OPERATOR_NEW

//#define HX_STACK_CTX ::hx::ImmixAllocator *_hx_stack_ctx = hx::gMultiThreadMode ? hx::tlsImmixAllocator : hx::gMainThreadAlloc;
Expand Down
15 changes: 9 additions & 6 deletions src/hx/gc/Immix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2907,8 +2907,6 @@ typedef hx::QuickVec<BlockDataInfo *> BlockList;

typedef hx::QuickVec<unsigned int *> LargeList;

enum MemType { memUnmanaged, memBlock, memLarge };




Expand Down Expand Up @@ -5524,7 +5522,7 @@ class GlobalAllocator
return false;
}

MemType GetMemType(void *inPtr)
hx::MemType GetMemType(void *inPtr)
{
BlockData *block = (BlockData *)( ((size_t)inPtr) & IMMIX_BLOCK_BASE_MASK);

Expand All @@ -5542,16 +5540,16 @@ class GlobalAllocator
*/

if (isBlock)
return memBlock;
return hx::memBlock;

for(int i=0;i<mLargeList.size();i++)
{
unsigned int *blob = mLargeList[i] + 2;
if (blob==inPtr)
return memLarge;
return hx::memLarge;
}

return memUnmanaged;
return hx::memUnmanaged;
}


Expand Down Expand Up @@ -5744,6 +5742,11 @@ void MarkConservative(int *inBottom, int *inTop,hx::MarkContext *__inCtx)
#endif
}

MemType GetMemType(void* inPtr)
{
return sGlobalAlloc->GetMemType(inPtr);
}

} // namespace hx


Expand Down

0 comments on commit dbeba7e

Please sign in to comment.