mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-24 12:35:31 +00:00
Disabled static constructor calling in metal mode.
This commit is contained in:
parent
5441c24858
commit
97f8349dd7
10 changed files with 119 additions and 112 deletions
|
|
@ -12,7 +12,7 @@ namespace Indy.IL2CPU.IL.X86.Native {
|
||||||
public override void Enter(string aName) {
|
public override void Enter(string aName) {
|
||||||
base.Enter(aName);
|
base.Enter(aName);
|
||||||
Pushd("[ebp + 8]");
|
Pushd("[ebp + 8]");
|
||||||
Call(NativeOpCodeMap.Instance.GetGlueMethod(Cosmos.Kernel.Boot.Glue.GlueMethodTypeEnum.SaveBootInfoStruct));
|
//Call(NativeOpCodeMap.Instance.GetGlueMethod(Cosmos.Kernel.Boot.Glue.GlueMethodTypeEnum.SaveBootInfoStruct));
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Exit() {
|
public override void Exit() {
|
||||||
|
|
|
||||||
|
|
@ -387,94 +387,94 @@ namespace Indy.IL2CPU.IL.X86.Native {
|
||||||
|
|
||||||
public override void PostProcess(Indy.IL2CPU.Assembler.Assembler aAssembler) {
|
public override void PostProcess(Indy.IL2CPU.Assembler.Assembler aAssembler) {
|
||||||
base.PostProcess(aAssembler);
|
base.PostProcess(aAssembler);
|
||||||
TypeDefinition xRuntimeEngineTypeDef = Engine.GetTypeDefinition(typeof(RuntimeEngineImpl).Assembly.GetName().Name, typeof(RuntimeEngineImpl).FullName);
|
// TypeDefinition xRuntimeEngineTypeDef = Engine.GetTypeDefinition(typeof(RuntimeEngineImpl).Assembly.GetName().Name, typeof(RuntimeEngineImpl).FullName);
|
||||||
MethodDefinition xTheMethod = GetGlueMethod(GlueMethodTypeEnum.IDT_SetHandler);
|
// MethodDefinition xTheMethod = GetGlueMethod(GlueMethodTypeEnum.IDT_SetHandler);
|
||||||
Engine.QueueMethod(xTheMethod);
|
// Engine.QueueMethod(xTheMethod);
|
||||||
mIDTSetHandlerMethodName = Label.GenerateLabelName(xTheMethod);
|
// mIDTSetHandlerMethodName = Label.GenerateLabelName(xTheMethod);
|
||||||
Console.WriteLine("IDTEntry size = {0}", Engine.GetFieldStorageSize(Engine.GetTypeDefinition(typeof(Cosmos.Kernel.Boot.Glue.IDTEntryStruct).Assembly.GetName().Name, typeof(Cosmos.Kernel.Boot.Glue.IDTEntryStruct).FullName)));
|
// Console.WriteLine("IDTEntry size = {0}", Engine.GetFieldStorageSize(Engine.GetTypeDefinition(typeof(Cosmos.Kernel.Boot.Glue.IDTEntryStruct).Assembly.GetName().Name, typeof(Cosmos.Kernel.Boot.Glue.IDTEntryStruct).FullName)));
|
||||||
X86.X86MethodHeaderOp.AssembleHeader(aAssembler, "___________REGISTER___ISRS_____", new int[0], new MethodInformation.Argument[0]);
|
// X86.X86MethodHeaderOp.AssembleHeader(aAssembler, "___________REGISTER___ISRS_____", new int[0], new MethodInformation.Argument[0]);
|
||||||
string xInterruptHandlerLabel = Label.GenerateLabelName(GetGlueMethod(GlueMethodTypeEnum.IDT_InterruptHandler));
|
// string xInterruptHandlerLabel = Label.GenerateLabelName(GetGlueMethod(GlueMethodTypeEnum.IDT_InterruptHandler));
|
||||||
int[] xInterruptsWithParam = new int[] { 8, 10, 11, 12, 13, 14 };
|
// int[] xInterruptsWithParam = new int[] { 8, 10, 11, 12, 13, 14 };
|
||||||
for (int i = 0; i < 256; i++) {
|
// for (int i = 0; i < 256; i++) {
|
||||||
new CPU.Pushd("0x" + i.ToString("X"));
|
// new CPU.Pushd("0x" + i.ToString("X"));
|
||||||
new CPU.Pushd("____INTERRUPT_HANDLER___" + i);
|
// new CPU.Pushd("____INTERRUPT_HANDLER___" + i);
|
||||||
new CPU.Pushd("0x08");
|
// new CPU.Pushd("0x08");
|
||||||
new CPU.Pushd("0x8E");
|
// new CPU.Pushd("0x8E");
|
||||||
new CPU.Call(mIDTSetHandlerMethodName);
|
// new CPU.Call(mIDTSetHandlerMethodName);
|
||||||
}
|
// }
|
||||||
X86.X86MethodFooterOp.AssembleFooter(0, aAssembler, new MethodInformation.Variable[0], new MethodInformation.Argument[0], 0);
|
// X86.X86MethodFooterOp.AssembleFooter(0, aAssembler, new MethodInformation.Variable[0], new MethodInformation.Argument[0], 0);
|
||||||
for (int j = 0; j < 256; j++) {
|
// for (int j = 0; j < 256; j++) {
|
||||||
new Label("____INTERRUPT_HANDLER___" + j);
|
// new Label("____INTERRUPT_HANDLER___" + j);
|
||||||
new CPUNative.Cli();
|
// new CPUNative.Cli();
|
||||||
new CPUNative.Break();
|
// new CPUNative.Break();
|
||||||
new CPUNative.Pushad();
|
// new CPUNative.Pushad();
|
||||||
new CPU.Pushd(j.ToString());
|
// new CPU.Pushd(j.ToString());
|
||||||
if (!xInterruptsWithParam.Contains(j)/* && !(j >= 0x20 && j <= 0x2F)*/) {
|
// if (!xInterruptsWithParam.Contains(j)/* && !(j >= 0x20 && j <= 0x2F)*/) {
|
||||||
new CPU.Pushd("0");
|
// new CPU.Pushd("0");
|
||||||
}
|
// }
|
||||||
new CPU.Call(xInterruptHandlerLabel);
|
// new CPU.Call(xInterruptHandlerLabel);
|
||||||
new CPUNative.Popad();
|
// new CPUNative.Popad();
|
||||||
new CPUNative.Break();
|
// new CPUNative.Break();
|
||||||
new CPUNative.Sti();
|
// new CPUNative.Sti();
|
||||||
new CPUNative.IRet();
|
// new CPUNative.IRet();
|
||||||
}
|
// }
|
||||||
IEnumerable<AssemblyDefinition> xAssemblies = Engine.GetAllAssemblies();
|
// IEnumerable<AssemblyDefinition> xAssemblies = Engine.GetAllAssemblies();
|
||||||
SortedList<int, byte[]> xResources = new SortedList<int, byte[]>();
|
// SortedList<int, byte[]> xResources = new SortedList<int, byte[]>();
|
||||||
foreach (AssemblyDefinition xAssembly in xAssemblies) {
|
// foreach (AssemblyDefinition xAssembly in xAssemblies) {
|
||||||
foreach (CustomAttribute xAttrib in xAssembly.CustomAttributes) {
|
// foreach (CustomAttribute xAttrib in xAssembly.CustomAttributes) {
|
||||||
if (!xAttrib.Resolved) {
|
// if (!xAttrib.Resolved) {
|
||||||
xAttrib.Resolve();
|
// xAttrib.Resolve();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
IEnumerable<KeyValuePair<int, string>> xWantedResources = (from item in xAssembly.CustomAttributes.Cast<CustomAttribute>()
|
// IEnumerable<KeyValuePair<int, string>> xWantedResources = (from item in xAssembly.CustomAttributes.Cast<CustomAttribute>()
|
||||||
where item.Constructor.DeclaringType.FullName == typeof(KernelResourceAttribute).FullName
|
// where item.Constructor.DeclaringType.FullName == typeof(KernelResourceAttribute).FullName
|
||||||
select new KeyValuePair<int, string>((int)item.ConstructorParameters[1],
|
// select new KeyValuePair<int, string>((int)item.ConstructorParameters[1],
|
||||||
(string)item.ConstructorParameters[0]));
|
// (string)item.ConstructorParameters[0]));
|
||||||
foreach (KeyValuePair<int, string> xWantedResource in xWantedResources) {
|
// foreach (KeyValuePair<int, string> xWantedResource in xWantedResources) {
|
||||||
foreach (ModuleDefinition xModule in xAssembly.Modules) {
|
// foreach (ModuleDefinition xModule in xAssembly.Modules) {
|
||||||
foreach (Resource xResource in xModule.Resources) {
|
// foreach (Resource xResource in xModule.Resources) {
|
||||||
if (xResource.Name == xWantedResource.Value) {
|
// if (xResource.Name == xWantedResource.Value) {
|
||||||
EmbeddedResource xEmbedded = xResource as EmbeddedResource;
|
// EmbeddedResource xEmbedded = xResource as EmbeddedResource;
|
||||||
if (xEmbedded == null) {
|
// if (xEmbedded == null) {
|
||||||
throw new Exception("Resource found but was not an embedded resource (Resource Name = '" + xWantedResource.Value + "')");
|
// throw new Exception("Resource found but was not an embedded resource (Resource Name = '" + xWantedResource.Value + "')");
|
||||||
}
|
// }
|
||||||
xResources.Add(xWantedResource.Key, xEmbedded.Data);
|
// xResources.Add(xWantedResource.Key, xEmbedded.Data);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
StringBuilder xValue = new StringBuilder();
|
// StringBuilder xValue = new StringBuilder();
|
||||||
DataMember xDataMember;
|
// DataMember xDataMember;
|
||||||
for (int i = 0; i < xResources.Count; i++) {
|
// for (int i = 0; i < xResources.Count; i++) {
|
||||||
xValue.Remove(0, xValue.Length);
|
// xValue.Remove(0, xValue.Length);
|
||||||
xValue.Append("0,0,0,0,2,0,0,0,");
|
// xValue.Append("0,0,0,0,2,0,0,0,");
|
||||||
xValue.Append(BitConverter.GetBytes(xResources.Values[i].Length).Aggregate("", (r, v) => r + v + ","));
|
// xValue.Append(BitConverter.GetBytes(xResources.Values[i].Length).Aggregate("", (r, v) => r + v + ","));
|
||||||
xValue.Append(xResources.Values[i].Aggregate("", (r, v) => r + v + ","));
|
// xValue.Append(xResources.Values[i].Aggregate("", (r, v) => r + v + ","));
|
||||||
xDataMember = new DataMember("embedded_resource_" + xResources.Keys[i] + "_contents", "db", xValue.ToString().TrimEnd(','));
|
// xDataMember = new DataMember("embedded_resource_" + xResources.Keys[i] + "_contents", "db", xValue.ToString().TrimEnd(','));
|
||||||
aAssembler.DataMembers.Add(xDataMember);
|
// aAssembler.DataMembers.Add(xDataMember);
|
||||||
}
|
// }
|
||||||
MethodDefinition xGetResourceMethod = GetGluePlaceholderMethod(GluePlaceholderMethodTypeEnum.GetKernelResource);
|
// MethodDefinition xGetResourceMethod = GetGluePlaceholderMethod(GluePlaceholderMethodTypeEnum.GetKernelResource);
|
||||||
MethodInformation xGetResourceMethodInfo = Engine.GetMethodInfo(xGetResourceMethod, xGetResourceMethod, xGetResourceMethod.Name, null);
|
// MethodInformation xGetResourceMethodInfo = Engine.GetMethodInfo(xGetResourceMethod, xGetResourceMethod, xGetResourceMethod.Name, null);
|
||||||
string xGetResourceLabelName = Label.GenerateLabelName(xGetResourceMethod);
|
// string xGetResourceLabelName = Label.GenerateLabelName(xGetResourceMethod);
|
||||||
for (int i = 0; i < aAssembler.Instructions.Count; i++) {
|
// for (int i = 0; i < aAssembler.Instructions.Count; i++) {
|
||||||
if ((aAssembler.Instructions[i] is Label) && ((Label)aAssembler.Instructions[i]).Name == xGetResourceLabelName) {
|
// if ((aAssembler.Instructions[i] is Label) && ((Label)aAssembler.Instructions[i]).Name == xGetResourceLabelName) {
|
||||||
aAssembler.Instructions.RemoveRange(i, 10);
|
// aAssembler.Instructions.RemoveRange(i, 10);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
NativeMethodHeaderOp.AssembleHeader(aAssembler, xGetResourceLabelName, new int[0], new MethodInformation.Argument[0]);
|
// NativeMethodHeaderOp.AssembleHeader(aAssembler, xGetResourceLabelName, new int[0], new MethodInformation.Argument[0]);
|
||||||
Op.Ldarg(aAssembler, xGetResourceMethodInfo.Arguments[0]);
|
// Op.Ldarg(aAssembler, xGetResourceMethodInfo.Arguments[0]);
|
||||||
new CPU.Pop("eax");
|
// new CPU.Pop("eax");
|
||||||
foreach (int xId in xResources.Keys) {
|
// foreach (int xId in xResources.Keys) {
|
||||||
new CPU.Move("ecx", "0x" + xId.ToString("X"));
|
// new CPU.Move("ecx", "0x" + xId.ToString("X"));
|
||||||
new CPU.Compare("eax", "ecx");
|
// new CPU.Compare("eax", "ecx");
|
||||||
new CPU.JumpIfNotEquals(".__after__" + xId);
|
// new CPU.JumpIfNotEquals(".__after__" + xId);
|
||||||
new CPU.Push("embedded_resource_" + xId + "_contents");
|
// new CPU.Push("embedded_resource_" + xId + "_contents");
|
||||||
new CPU.JumpAlways(".END__OF__METHOD");
|
// new CPU.JumpAlways(".END__OF__METHOD");
|
||||||
new Label(".__after__" + xId);
|
// new Label(".__after__" + xId);
|
||||||
}
|
// }
|
||||||
NativeMethodFooterOp.AssembleFooter(4, aAssembler, new MethodInformation.Variable[0], new MethodInformation.Argument[0], 4);
|
// NativeMethodFooterOp.AssembleFooter(4, aAssembler, new MethodInformation.Variable[0], new MethodInformation.Argument[0], 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -6,7 +6,7 @@ using System.Text;
|
||||||
using Indy.IL2CPU.Plugs;
|
using Indy.IL2CPU.Plugs;
|
||||||
|
|
||||||
namespace Indy.IL2CPU.IL.X86.Win32.CustomImplementations.System {
|
namespace Indy.IL2CPU.IL.X86.Win32.CustomImplementations.System {
|
||||||
//[Plug(Target = typeof(Console))]
|
[Plug(Target = typeof(Console))]
|
||||||
public static class ConsoleImpl {
|
public static class ConsoleImpl {
|
||||||
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
|
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
|
||||||
static extern unsafe bool WriteConsole(IntPtr hConsoleOutput, uint lpBuffer,
|
static extern unsafe bool WriteConsole(IntPtr hConsoleOutput, uint lpBuffer,
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,10 @@ namespace Indy.IL2CPU.IL.X86.CustomImplementations.System {
|
||||||
aBytes += aIndex;
|
aBytes += aIndex;
|
||||||
return *aBytes;
|
return *aBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[PlugMethod(Signature = "System_Void___System_String__cctor____", Scope = PlugScopeEnum.NonMetalOnly)]
|
||||||
|
public static void CCtor() {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Plug(Target = typeof(Indy.IL2CPU.CustomImplementation.System.StringImpl))]
|
[Plug(Target = typeof(Indy.IL2CPU.CustomImplementation.System.StringImpl))]
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ namespace Indy.IL2CPU.IL.X86 {
|
||||||
new Push(CPUx86.Registers.EAX);
|
new Push(CPUx86.Registers.EAX);
|
||||||
}
|
}
|
||||||
aAssembler.StackSizes.Push(aArg.Size);
|
aAssembler.StackSizes.Push(aArg.Size);
|
||||||
if (aAddGCCode && aArg.IsReferenceType && aArg.ArgumentType.FullName != "System.String") {
|
if (aAddGCCode && aArg.IsReferenceType) {
|
||||||
new CPUx86.Push(CPUx86.Registers.EAX);
|
new CPUx86.Push(CPUx86.Registers.EAX);
|
||||||
Engine.QueueMethodRef(GCImplementationRefs.IncRefCountRef);
|
Engine.QueueMethodRef(GCImplementationRefs.IncRefCountRef);
|
||||||
new CPUx86.Call(Label.GenerateLabelName(GCImplementationRefs.IncRefCountRef));
|
new CPUx86.Call(Label.GenerateLabelName(GCImplementationRefs.IncRefCountRef));
|
||||||
|
|
@ -147,7 +147,7 @@ namespace Indy.IL2CPU.IL.X86 {
|
||||||
new CPUx86.Push("eax");
|
new CPUx86.Push("eax");
|
||||||
}
|
}
|
||||||
aAssembler.StackSizes.Push(aLocal.Size);
|
aAssembler.StackSizes.Push(aLocal.Size);
|
||||||
if (aAddGCCode && aLocal.IsReferenceType && aLocal.VariableType.FullName != "System.String") {
|
if (aAddGCCode && aLocal.IsReferenceType) {
|
||||||
new CPUx86.Push("eax");
|
new CPUx86.Push("eax");
|
||||||
Engine.QueueMethodRef(GCImplementationRefs.IncRefCountRef);
|
Engine.QueueMethodRef(GCImplementationRefs.IncRefCountRef);
|
||||||
new CPUx86.Call(Label.GenerateLabelName(GCImplementationRefs.IncRefCountRef));
|
new CPUx86.Call(Label.GenerateLabelName(GCImplementationRefs.IncRefCountRef));
|
||||||
|
|
|
||||||
|
|
@ -31,17 +31,17 @@ namespace Indy.IL2CPU.IL.X86 {
|
||||||
new Assembler.X86.Move(CPUx86.Registers.EAX, "0");
|
new Assembler.X86.Move(CPUx86.Registers.EAX, "0");
|
||||||
new Assembler.X86.Move(CPUx86.Registers.EDI, "[" + MethodInfo.Arguments[0].VirtualAddresses[0] + "]");
|
new Assembler.X86.Move(CPUx86.Registers.EDI, "[" + MethodInfo.Arguments[0].VirtualAddresses[0] + "]");
|
||||||
new Assembler.X86.Move(CPUx86.Registers.ESI, "[" + MethodInfo.Arguments[1].VirtualAddresses[0] + "]");
|
new Assembler.X86.Move(CPUx86.Registers.ESI, "[" + MethodInfo.Arguments[1].VirtualAddresses[0] + "]");
|
||||||
new Assembler.X86.Add(CPUx86.Registers.ESI, "8");
|
new Assembler.X86.Add(CPUx86.Registers.EDI, "8");
|
||||||
new Assembler.X86.Move(CPUx86.Registers.ECX, CPUx86.Registers.AtESI);
|
new Assembler.X86.Move(CPUx86.Registers.ECX, CPUx86.Registers.AtEDI);
|
||||||
new Assembler.X86.Add(CPUx86.Registers.ESI, "4");
|
new Assembler.X86.Add(CPUx86.Registers.EDI, "4");
|
||||||
new Assembler.X86.Add(CPUx86.Registers.EDI, "12");
|
new Assembler.X86.Add(CPUx86.Registers.ESI, "12");
|
||||||
|
|
||||||
new Assembler.Label(".StartLoop");
|
new Assembler.Label(".StartLoop");
|
||||||
new Assembler.X86.Move(CPUx86.Registers.EDX, CPUx86.Registers.AtESI);
|
new Assembler.X86.Move("byte", CPUx86.Registers.DL, CPUx86.Registers.AtESI);
|
||||||
new Assembler.X86.Move(CPUx86.Registers.AtEDI, CPUx86.Registers.EDX);
|
new Assembler.X86.Move("byte", CPUx86.Registers.AtEDI, CPUx86.Registers.DL);
|
||||||
new Assembler.X86.Add(CPUx86.Registers.EAX, "4");
|
new Assembler.X86.Add(CPUx86.Registers.EAX, "1");
|
||||||
new Assembler.X86.Add(CPUx86.Registers.ESI, "4");
|
new Assembler.X86.Add(CPUx86.Registers.ESI, "1");
|
||||||
new Assembler.X86.Add(CPUx86.Registers.EDI, "4");
|
new Assembler.X86.Add(CPUx86.Registers.EDI, "1");
|
||||||
new Assembler.X86.Compare(CPUx86.Registers.EAX, CPUx86.Registers.ECX);
|
new Assembler.X86.Compare(CPUx86.Registers.EAX, CPUx86.Registers.ECX);
|
||||||
new Assembler.X86.JumpIfEquals(".EndLoop");
|
new Assembler.X86.JumpIfEquals(".EndLoop");
|
||||||
new Assembler.X86.JumpAlways(".StartLoop");
|
new Assembler.X86.JumpAlways(".StartLoop");
|
||||||
|
|
|
||||||
|
|
@ -34,12 +34,12 @@ namespace Indy.IL2CPU.IL.X86 {
|
||||||
if (!aAssembler.InMetalMode) {
|
if (!aAssembler.InMetalMode) {
|
||||||
Engine.QueueMethodRef(GCImplementationRefs.DecRefCountRef);
|
Engine.QueueMethodRef(GCImplementationRefs.DecRefCountRef);
|
||||||
foreach (MethodInformation.Variable xLocal in aLocals) {
|
foreach (MethodInformation.Variable xLocal in aLocals) {
|
||||||
if (xLocal.IsReferenceType && xLocal.VariableType.FullName != "System.String") {
|
if (xLocal.IsReferenceType) {
|
||||||
// System.Diagnostics.Debugger.Break();
|
// System.Diagnostics.Debugger.Break();
|
||||||
TypeSpecification xTypeSpec = xLocal.VariableType as TypeSpecification;
|
TypeSpecification xTypeSpec = xLocal.VariableType as TypeSpecification;
|
||||||
if (xTypeSpec != null) {
|
if (xTypeSpec != null) {
|
||||||
TypeDefinition xElementDef = Engine.GetDefinitionFromTypeReference(xTypeSpec.ElementType);
|
TypeDefinition xElementDef = Engine.GetDefinitionFromTypeReference(xTypeSpec.ElementType);
|
||||||
if ((!xElementDef.IsValueType) && xElementDef.FullName != "System.String") {
|
if (!xElementDef.IsValueType) {
|
||||||
Op.Ldloc(aAssembler, xLocal, false);
|
Op.Ldloc(aAssembler, xLocal, false);
|
||||||
new CPUx86.Push("8");
|
new CPUx86.Push("8");
|
||||||
Op.Add(aAssembler);
|
Op.Add(aAssembler);
|
||||||
|
|
@ -74,7 +74,7 @@ namespace Indy.IL2CPU.IL.X86 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach (MethodInformation.Argument xArg in aArgs) {
|
foreach (MethodInformation.Argument xArg in aArgs) {
|
||||||
if (xArg.IsReferenceType && xArg.ArgumentType.FullName != "System.String") {
|
if (xArg.IsReferenceType) {
|
||||||
Op.Ldarg(aAssembler, xArg, false);
|
Op.Ldarg(aAssembler, xArg, false);
|
||||||
new CPUx86.Call(Label.GenerateLabelName(GCImplementationRefs.DecRefCountRef));
|
new CPUx86.Call(Label.GenerateLabelName(GCImplementationRefs.DecRefCountRef));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,6 @@ namespace Indy.IL2CPU.IL {
|
||||||
} else {
|
} else {
|
||||||
xNotWantedScope = PlugScopeEnum.MetalOnly;
|
xNotWantedScope = PlugScopeEnum.MetalOnly;
|
||||||
}
|
}
|
||||||
System.Diagnostics.Debugger.Break();
|
|
||||||
foreach (AssemblyDefinition xAssemblyDef in GetPlugAssemblies().Union(aPlugs)) {
|
foreach (AssemblyDefinition xAssemblyDef in GetPlugAssemblies().Union(aPlugs)) {
|
||||||
foreach (ModuleDefinition xModuleDef in xAssemblyDef.Modules) {
|
foreach (ModuleDefinition xModuleDef in xAssemblyDef.Modules) {
|
||||||
foreach (TypeDefinition xType in (from item in xModuleDef.Types.Cast<TypeDefinition>()
|
foreach (TypeDefinition xType in (from item in xModuleDef.Types.Cast<TypeDefinition>()
|
||||||
|
|
@ -120,8 +119,8 @@ namespace Indy.IL2CPU.IL {
|
||||||
}
|
}
|
||||||
TypeDefinition xReplaceTypeDef = aTypeResolver(xTypeRef);
|
TypeDefinition xReplaceTypeDef = aTypeResolver(xTypeRef);
|
||||||
foreach (MethodDefinition xMethod in (from item in xType.Methods.Cast<MethodDefinition>()
|
foreach (MethodDefinition xMethod in (from item in xType.Methods.Cast<MethodDefinition>()
|
||||||
where item.IsPublic
|
select item).Union((from item in xType.Constructors.Cast<MethodDefinition>()
|
||||||
select item)) {
|
select item))) {
|
||||||
CustomAttribute xPlugMethodAttrib = (from item in xMethod.CustomAttributes.Cast<CustomAttribute>()
|
CustomAttribute xPlugMethodAttrib = (from item in xMethod.CustomAttributes.Cast<CustomAttribute>()
|
||||||
where item.Constructor.DeclaringType.FullName == typeof(PlugMethodAttribute).FullName
|
where item.Constructor.DeclaringType.FullName == typeof(PlugMethodAttribute).FullName
|
||||||
select item).FirstOrDefault();
|
select item).FirstOrDefault();
|
||||||
|
|
|
||||||
|
|
@ -207,11 +207,12 @@ namespace Indy.IL2CPU {
|
||||||
xEntryPointOp.Call(RuntimeEngineRefs.InitializeApplicationRef);
|
xEntryPointOp.Call(RuntimeEngineRefs.InitializeApplicationRef);
|
||||||
if (!aInMetalMode) {
|
if (!aInMetalMode) {
|
||||||
xEntryPointOp.Call("____INIT__VMT____");
|
xEntryPointOp.Call("____INIT__VMT____");
|
||||||
}
|
|
||||||
foreach (TypeDefinition xType in mTypes) {
|
foreach (TypeDefinition xType in mTypes) {
|
||||||
foreach (MethodDefinition xMethod in xType.Constructors) {
|
foreach (MethodDefinition xMethod in xType.Constructors) {
|
||||||
if (xMethod.IsStatic) {
|
if (xMethod.IsStatic) {
|
||||||
xEntryPointOp.Call(xMethod);
|
xEntryPointOp.Call(xMethod);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,9 @@ namespace Indy.IL2CPU {
|
||||||
uint* xTheObject = (uint*)aObject;
|
uint* xTheObject = (uint*)aObject;
|
||||||
xTheObject -= 1;
|
xTheObject -= 1;
|
||||||
if ((*xTheObject & 0x80000000) != 0) {
|
if ((*xTheObject & 0x80000000) != 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ((*xTheObject & 0x88888888) != 0) {
|
||||||
Console.Write("StaleObject: ");
|
Console.Write("StaleObject: ");
|
||||||
WriteNumber(aObject, false);
|
WriteNumber(aObject, false);
|
||||||
Console.WriteLine();
|
Console.WriteLine();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue