mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-14 14:24:10 +02:00
DtorEntryEx
This commit is contained in:
parent
5b54eee56c
commit
65c0dc3cd8
1 changed files with 39 additions and 6 deletions
|
@ -10,6 +10,12 @@ namespace System
|
||||||
public uint16 mPoolOfs;
|
public uint16 mPoolOfs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct DtorEntryEx
|
||||||
|
{
|
||||||
|
public uint32 mPoolIdx;
|
||||||
|
public uint32 mPoolOfs;
|
||||||
|
}
|
||||||
|
|
||||||
public enum DestructorHandlingKind
|
public enum DestructorHandlingKind
|
||||||
{
|
{
|
||||||
Allow,
|
Allow,
|
||||||
|
@ -19,6 +25,7 @@ namespace System
|
||||||
|
|
||||||
List<Span<uint8>> mPools;
|
List<Span<uint8>> mPools;
|
||||||
List<DtorEntry> mDtorEntries;
|
List<DtorEntry> mDtorEntries;
|
||||||
|
List<DtorEntryEx> mDtorEntriesEx;
|
||||||
List<void*> mLargeRawAllocs;
|
List<void*> mLargeRawAllocs;
|
||||||
List<Object> mLargeDtorAllocs;
|
List<Object> mLargeDtorAllocs;
|
||||||
int mPoolsSize;
|
int mPoolsSize;
|
||||||
|
@ -59,6 +66,17 @@ namespace System
|
||||||
delete mDtorEntries;
|
delete mDtorEntries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mDtorEntriesEx != null)
|
||||||
|
{
|
||||||
|
for (var dtorEntry in ref mDtorEntriesEx)
|
||||||
|
{
|
||||||
|
uint8* ptr = mPools[dtorEntry.mPoolIdx].Ptr + dtorEntry.mPoolOfs;
|
||||||
|
Object obj = Internal.UnsafeCastToObject(ptr);
|
||||||
|
delete:null obj;
|
||||||
|
}
|
||||||
|
delete mDtorEntriesEx;
|
||||||
|
}
|
||||||
|
|
||||||
if (mPools != null)
|
if (mPools != null)
|
||||||
{
|
{
|
||||||
for (var span in mPools)
|
for (var span in mPools)
|
||||||
|
@ -161,12 +179,26 @@ namespace System
|
||||||
GrowPool();
|
GrowPool();
|
||||||
}
|
}
|
||||||
|
|
||||||
DtorEntry dtorEntry;
|
uint32 poolOfs = (.)(mCurPtr - mCurAlloc);
|
||||||
dtorEntry.mPoolIdx = (uint16)mPools.Count - 1;
|
|
||||||
dtorEntry.mPoolOfs = (uint16)(mCurPtr - mCurAlloc);
|
if (poolOfs <= 0xFFFF)
|
||||||
if (mDtorEntries == null)
|
{
|
||||||
mDtorEntries = new List<DtorEntry>();
|
DtorEntry dtorEntry;
|
||||||
mDtorEntries.Add(dtorEntry);
|
dtorEntry.mPoolIdx = (uint16)mPools.Count - 1;
|
||||||
|
dtorEntry.mPoolOfs = (uint16)(mCurPtr - mCurAlloc);
|
||||||
|
if (mDtorEntries == null)
|
||||||
|
mDtorEntries = new List<DtorEntry>();
|
||||||
|
mDtorEntries.Add(dtorEntry);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DtorEntryEx dtorEntry;
|
||||||
|
dtorEntry.mPoolIdx = (uint32)mPools.Count - 1;
|
||||||
|
dtorEntry.mPoolOfs = (uint32)(mCurPtr - mCurAlloc);
|
||||||
|
if (mDtorEntriesEx == null)
|
||||||
|
mDtorEntriesEx = new List<DtorEntryEx>();
|
||||||
|
mDtorEntriesEx.Add(dtorEntry);
|
||||||
|
}
|
||||||
|
|
||||||
uint8* ptr = mCurPtr;
|
uint8* ptr = mCurPtr;
|
||||||
mCurPtr += size;
|
mCurPtr += size;
|
||||||
|
@ -212,6 +244,7 @@ namespace System
|
||||||
GC.Mark(mLargeDtorAllocs);
|
GC.Mark(mLargeDtorAllocs);
|
||||||
GC.Mark(mPairedAllocator);
|
GC.Mark(mPairedAllocator);
|
||||||
GC.Mark(mDtorEntries);
|
GC.Mark(mDtorEntries);
|
||||||
|
GC.Mark(mDtorEntriesEx);
|
||||||
if ((mMarkData) && (mPools != null))
|
if ((mMarkData) && (mPools != null))
|
||||||
{
|
{
|
||||||
let arr = mPools.[Friend]mItems;
|
let arr = mPools.[Friend]mItems;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue