Works:
- abstract
- single interface implementation
Doesn't work:
- multiple interfaces (CMPCallChosenInterface2 fails)
Other junk:
- some new messages for engine exceptions where they were empty
PS. patch with tests has been submitted before
PPS. it might be buggy, I've checked it only on mono, interfaces will
need much more code - it's just a hack so far
Index: AOT/Core/X86/Assembly.cs
===================================================================
--- AOT/Core/X86/Assembly.cs (wersja 733)
+++ AOT/Core/X86/Assembly.cs (kopia robocza)
@@ -1125,6 +1125,9 @@
string typeInfoLabel = AddTypeInfoFields (_class);
+ if (_class.ClassDefinition.IsInterface)
+ continue;
+
AddVTableFields (_class, typeInfoLabel);
if (_class.ClassDefinition.IsValueType)
@@ -1208,8 +1211,14 @@
this.DATA ((uint) _class.Size);
// Virtual Methods
- foreach (Method method in _class.VirtualMethods)
- this.ADDRESSOF (method.AssemblyLabel);
+ foreach (Method method in _class.VirtualMethods) {
+ this.COMMENT ("Address of " + method.AssemblyLabel);
+ // Abstract methods don't have implementations
+ if (method.MethodDefinition.IsAbstract)
+ this.DATA((uint) 0);
+ else
+ this.ADDRESSOF (method.AssemblyLabel);
+ }
}
private string AddTypeInfoFields (Class _class)
@@ -1300,7 +1309,16 @@
this.engine.Dump.Section (DumpSection.MethodEncode);
foreach (Class _class in engine) {
+ // interfaces don't have method bodies
+ if (_class.ClassDefinition.IsInterface)
+ continue;
+
foreach (Method method in _class) {
+ // abstract methods don't have implementation
+ // vtable will point at 0x00
+ if (method.MethodDefinition.IsAbstract)
+ continue;
+
this.engine.Dump.MethodEncode (method);
engine.SetStatusInformation (_class.ClassDefinition.Module.Assembly,
Index: AOT/Core/X86/IR.cs
===================================================================
--- AOT/Core/X86/IR.cs (wersja 733)
+++ AOT/Core/X86/IR.cs (kopia robocza)
@@ -95,7 +95,7 @@
break;
default:
- throw new NotImplementedEngineException ();
+ throw new NotImplementedEngineException ("Call assignee handling.");
}
}
}
@@ -746,7 +746,7 @@
break;
default:
- throw new NotImplementedEngineException ();
+ throw new NotImplementedEngineException ("LDC of " + assignee.InternalType + " not supported yet");
}
}
@@ -2440,7 +2440,7 @@
if (value.IsRegisterSet)
this.assembly.MOV (R32.EAX, Assembly.GetRegister (value.Register));
else
- this.assembly.LEA (R32.EAX, new DWordMemory (this.GetAddress (value)));
+ this.assembly.MOV (R32.EAX, new DWordMemory (this.GetAddress (value)));
this.assembly.ADD (R32.EAX, (uint) this.assembly.Engine.GetObjectSize);
Index: AOT/Core/IR/Class.cs
===================================================================
--- AOT/Core/IR/Class.cs (wersja 733)
+++ AOT/Core/IR/Class.cs (kopia robocza)
@@ -54,7 +54,7 @@
foreach (FieldDefinition field in this.classDefinition.Fields)
fields [field.Name] = new Field (field);
- if (this.TypeFullName != Mono.Cecil.Constants.Object)
+ if (this.TypeFullName != Mono.Cecil.Constants.Object && !this.classDefinition.IsInterface)
this._base = this.engine.GetClass (this.classDefinition.BaseType);
this.AddVirtualMethods (this.virtualMethods);
@@ -340,7 +340,8 @@
}
} else if (this.classDefinition.IsValueType
- || this.classDefinition.IsClass) {
+ || this.classDefinition.IsClass
+ || this.classDefinition.IsInterface) {
result = this.BaseSize;
if ((this.classDefinition.Attributes & TypeAttributes.ExplicitLayout) != 0) {
@@ -364,7 +365,7 @@
}
} else
- throw new NotImplementedEngineException ();
+ throw new NotImplementedEngineException ("Getting size of " + this);
return result;
}
Index: AOT/Core/IR/Engine.cs
===================================================================
--- AOT/Core/IR/Engine.cs (wersja 733)
+++ AOT/Core/IR/Engine.cs (kopia robocza)
@@ -758,7 +758,7 @@
Class _class = new Class (this, type);
if (this.classes.ContainsKey (_class.TypeFullName))
- throw new NotImplementedEngineException ();
+ throw new NotImplementedEngineException ("Already contains " + _class.TypeFullName);
this.classes [_class.TypeFullName] = _class;
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
SharpOS-Developers mailing list
SharpOS-Developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sharpos-developers