Cosmos/source2/IL2CPU/Cosmos.IL2CPU/GCImplementationRefs.cs
2010-09-04 19:07:11 +00:00

29 lines
No EOL
996 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
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).GetFields()) {
if (xField.Name.EndsWith("Ref")) {
MethodBase xTempMethod = xType.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);
}
}
}
}
}