mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-19 04:18:43 +00:00
Compiler fixes. Updated project.json files. Removed *.lock.json files and updated gitignore to ignore them. Updated some Cosmos.Debug projects.
35 lines
1.2 KiB
C#
35 lines
1.2 KiB
C#
using System;
|
|
using System.Reflection;
|
|
|
|
using Cosmos.Core.Common;
|
|
|
|
namespace Cosmos.IL2CPU
|
|
{
|
|
public static class GCImplementationRefs
|
|
{
|
|
public static readonly MethodBase AllocNewObjectRef;
|
|
public static readonly MethodBase IncRefCountRef;
|
|
public static readonly MethodBase DecRefCountRef;
|
|
|
|
static GCImplementationRefs()
|
|
{
|
|
Type xType = typeof(GCImplementation);
|
|
if (xType == null)
|
|
{
|
|
throw new Exception("GCImplementation type not found!");
|
|
}
|
|
foreach (FieldInfo xField in typeof(GCImplementationRefs).GetTypeInfo().GetFields())
|
|
{
|
|
if (xField.Name.EndsWith("Ref"))
|
|
{
|
|
MethodBase xTempMethod = xType.GetTypeInfo().GetMethod(xField.Name.Substring(0, xField.Name.Length - "Ref".Length));
|
|
if (xTempMethod == null)
|
|
{
|
|
throw new Exception("Method '" + xField.Name.Substring(0, xField.Name.Length - "Ref".Length) + "' not found on RuntimeEngine!");
|
|
}
|
|
xField.SetValue(null, xTempMethod);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|