mirror of
https://github.com/beefytech/Beef.git
synced 2025-07-15 12:43:52 +02:00
Merge pull request #1260 from disarray2077/allocstackcount
Expose `AllocStackCount` to corlib & Use it in Dbg_ObjectAlloc
This commit is contained in:
commit
22919dd629
6 changed files with 55 additions and 19 deletions
|
@ -18,6 +18,12 @@ namespace System
|
|||
}
|
||||
}
|
||||
|
||||
public static class Options
|
||||
{
|
||||
[LinkName("#AllocStackCount")]
|
||||
public static extern int32 AllocStackCount;
|
||||
}
|
||||
|
||||
[LinkName("#CallerLineNum")]
|
||||
public static extern int CallerLineNum;
|
||||
|
||||
|
|
|
@ -143,7 +143,10 @@ namespace System.Reflection
|
|||
let objType = typeof(Object) as TypeInstance;
|
||||
|
||||
#if BF_ENABLE_OBJECT_DEBUG_FLAGS
|
||||
obj = Internal.Dbg_ObjectAlloc(mTypeClassVData, mInstSize, mInstAlign, 1);
|
||||
int32 stackCount = Compiler.Options.AllocStackCount;
|
||||
if (mAllocStackCountOverride != 0)
|
||||
stackCount = mAllocStackCountOverride;
|
||||
obj = Internal.Dbg_ObjectAlloc(mTypeClassVData, mInstSize, mInstAlign, stackCount);
|
||||
#else
|
||||
void* mem = new [Align(16)] uint8[mInstSize]* (?);
|
||||
obj = Internal.UnsafeCastToObject(mem);
|
||||
|
|
|
@ -20,13 +20,14 @@ namespace System
|
|||
|
||||
protected const BindingFlags cDefaultLookup = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public;
|
||||
|
||||
protected int32 mSize;
|
||||
protected TypeId mTypeId;
|
||||
protected TypeId mBoxedType;
|
||||
protected TypeFlags mTypeFlags;
|
||||
protected int32 mMemberDataOffset;
|
||||
protected TypeCode mTypeCode;
|
||||
protected uint8 mAlign;
|
||||
protected int32 mSize;
|
||||
protected TypeId mTypeId;
|
||||
protected TypeId mBoxedType;
|
||||
protected TypeFlags mTypeFlags;
|
||||
protected int32 mMemberDataOffset;
|
||||
protected TypeCode mTypeCode;
|
||||
protected uint8 mAlign;
|
||||
protected uint8 mAllocStackCountOverride;
|
||||
|
||||
public static TypeId TypeIdEnd
|
||||
{
|
||||
|
@ -1187,7 +1188,10 @@ namespace System.Reflection
|
|||
let genericType = GetGenericArg(0);
|
||||
let arraySize = [Friend]mInstSize - genericType.Size + genericType.Stride * count;
|
||||
#if BF_ENABLE_OBJECT_DEBUG_FLAGS
|
||||
obj = Internal.Dbg_ObjectAlloc([Friend]mTypeClassVData, arraySize, [Friend]mInstAlign, 1);
|
||||
int32 stackCount = Compiler.Options.AllocStackCount;
|
||||
if (mAllocStackCountOverride != 0)
|
||||
stackCount = mAllocStackCountOverride;
|
||||
obj = Internal.Dbg_ObjectAlloc([Friend]mTypeClassVData, arraySize, [Friend]mInstAlign, stackCount);
|
||||
#else
|
||||
void* mem = new [Align(16)] uint8[arraySize]* (?);
|
||||
obj = Internal.UnsafeCastToObject(mem);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue