1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-14 14:24:10 +02:00

Fixed static init ordering issue with DbgRawAllocData.Unmarked<T>

This commit is contained in:
Brian Fiete 2022-06-04 13:16:20 -07:00
parent e0ae4be43f
commit f8083037f9

View file

@ -11,12 +11,19 @@ namespace System
public struct Unmarked<T> public struct Unmarked<T>
{ {
public static DbgRawAllocData sRawAllocData; static DbgRawAllocData sRawAllocData;
public static this() public static DbgRawAllocData* Data
{ {
sRawAllocData.mMarkFunc = null; get
sRawAllocData.mMaxStackTrace = 1; {
sRawAllocData.mType = typeof(T); if (sRawAllocData.mMaxStackTrace == 0)
{
sRawAllocData.mMarkFunc = null;
sRawAllocData.mMaxStackTrace = 1;
sRawAllocData.mType = typeof(T);
}
return &sRawAllocData;
}
} }
} }
} }
@ -188,7 +195,7 @@ namespace System
return new T[size]*(?); return new T[size]*(?);
// We don't want to use the default mark function because the GC will mark the entire array, // We don't want to use the default mark function because the GC will mark the entire array,
// whereas we have a custom marking routine because we only want to mark up to mSize // whereas we have a custom marking routine because we only want to mark up to mSize
return (T*)Internal.Dbg_RawAlloc(size * strideof(T), &DbgRawAllocData.Unmarked<T>.sRawAllocData); return (T*)Internal.Dbg_RawAlloc(size * strideof(T), DbgRawAllocData.Unmarked<T>.Data);
#else #else
return new T[size]*(?); return new T[size]*(?);
#endif #endif