private void GenerateConflictStub (Class _class, int key) { List<Method> entries = _class.GetInterfaceEntries (key); entries.Sort (delegate (Method a, Method b) { return Comparer<int>.Default.Compare (a.InterfaceMethodNumber, b.InterfaceMethodNumber); }); string fullname = GetITableStubLabel(_class, key); this.ALIGN (Assembly.ALIGNMENT); this.AddSymbol (new COFF.Function (fullname)); this.LABEL (fullname); GenerateConflictStubPart (_class, key, entries, 0, entries.Count-1); }
private void GenerateIMTHelpers(Class _class) { if (!_class.IsClass) return; if ((_class.ClassDefinition as TypeDefinition).Interfaces.Count > 0) { for (int i = 0; i < Method.IMTSize; ++i) { List<Method> entries = _class.GetInterfaceEntries (i); if (entries != null && entries.Count > 1) GenerateConflictStub (_class, i); } } }
private void AddITableFields (Class _class) { this.ALIGN (OBJECT_ALIGNMENT); // Writing the Runtime ITable instances string label = this.GetITableLabel (_class.TypeFullName); this.AddSymbol (new COFF.Label (label)); this.LABEL (label); // Type Info Object Header this.AddObjectFields (this.engine.ITableClass.TypeFullName); // count entries - don't write unused fields int lastEntry=0; for (int key = 0; key < Method.IMTSize; ++key) { if (_class.GetInterfaceEntries(key) != null) lastEntry = key; } for (int key = 0; key <= lastEntry; ++key) { List<Method> m = _class.GetInterfaceEntries(key); if (m == null) { this.DATA((uint) 0); } else if (m.Count == 1) { this.ADDRESSOF (m[0].AssemblyLabel); } else { this.ADDRESSOF (GetITableStubLabel(_class, key)); } } }