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

Made GC.Mark a mixin for less module rebuilding

This commit is contained in:
Brian Fiete 2020-08-04 10:31:13 -07:00
parent 92d3ab6ca9
commit 7724c6ae64
5 changed files with 18 additions and 34 deletions

View file

@ -319,7 +319,7 @@ namespace System
return;
for (int i = 0; i < mLength; i++)
{
GC.Mark((&mFirstElement)[i]);
GC.Mark!((&mFirstElement)[i]);
}
}
}
@ -430,7 +430,7 @@ namespace System
{
for (int i = 0; i < mLength; i++)
{
GC.Mark_Unbound((&mFirstElement)[i]);
GC.Mark!((&mFirstElement)[i]);
}
}
}
@ -546,7 +546,7 @@ namespace System
{
for (int i = 0; i < mLength; i++)
{
GC.Mark_Unbound((&mFirstElement)[i]);
GC.Mark!((&mFirstElement)[i]);
}
}
}
@ -667,7 +667,7 @@ namespace System
{
for (int i = 0; i < mLength; i++)
{
GC.Mark_Unbound((&mFirstElement)[i]);
GC.Mark!((&mFirstElement)[i]);
}
}
}

View file

@ -177,7 +177,7 @@ namespace System.Collections
return;
for (int i < mCount)
{
GC.Mark_Unbound(mEntries[i]);
mEntries[i].[Friend]GCMarkMembers();
}
}

View file

@ -721,7 +721,7 @@ namespace System.Collections
return;
for (int i < mSize)
{
GC.Mark_Unbound(mItems[i]);
GC.Mark!(mItems[i]);
}
}

View file

@ -334,7 +334,7 @@ namespace System.Collections
int allocSize = AllocSize;
for (int i < mSize)
{
GC.Mark_Unbound(mItems[(i + mHead) % allocSize]);
GC.Mark!(mItems[(i + mHead) % allocSize]);
}
}

View file

@ -150,27 +150,27 @@ namespace System
#endif
}
public static void Mark<T>(T val) where T : class
{
public static mixin Mark<T>(T val) where T : class
{
#if BF_ENABLE_REALTIME_LEAK_CHECK
Mark((Object)val);
Mark((Object)val);
#endif
}
public static void Mark<T>(T val) where T : struct
{
public static mixin Mark<T>(T val) where T : struct
{
#if BF_ENABLE_REALTIME_LEAK_CHECK
val.[Friend]GCMarkMembers();
val.[Friend]GCMarkMembers();
#endif
}
public static void Mark<T>(T val) where T : struct*
{
// Memory pointed to by struct*'s will already-scanned stack memory,
// or the memory would already be registered with the GC
public static mixin Mark<T>(T val) where T : struct*
{
// Memory pointed to by struct*'s will already-scanned stack memory,
// or the memory would already be registered with the GC
}
public static void Mark<TSizedArray, T, Size>(TSizedArray val) where Size : const int where TSizedArray : SizedArray<T, Size>
public static mixin Mark<TSizedArray, T, Size>(TSizedArray val) where Size : const int where TSizedArray : SizedArray<T, Size>
{
#if BF_ENABLE_REALTIME_LEAK_CHECK
for (var element in val)
@ -180,22 +180,6 @@ namespace System
#endif
}
public static void Mark_Enumerate<T>(T val) where T : var
{
/*for (var element in val)
{
Mark(element);
}*/
}
public static void Mark_Unbound<T>(T val) where T : var
{
#if BF_ENABLE_REALTIME_LEAK_CHECK
Mark(val);
#endif
}
public static void ToLeakString(Object obj, String strBuffer)
{
obj.GetType().GetName(strBuffer);