Exemplo n.º 1
0
 public static void RemoveOverrides(List<CppVtableSlot> visible, CppVtableSlot slot)
 {
     List<int> removeIndexes = FindOverrideIndexes(visible, slot.Name, slot.Signature);
     for (int i = 0; i < removeIndexes.Count; i++)
         visible.RemoveAt(removeIndexes[removeIndexes.Count - 1 - i]);
 }
Exemplo n.º 2
0
 public CppVtableSlotOverrideImpl(CppVtableSlot declSlot, CppVtableSlot bodySlot)
 {
     m_declSlot = declSlot;
     m_bodySlot = bodySlot;
 }
Exemplo n.º 3
0
 public BoundInterfaceMethodImpl(CLRTypeSpec definedInType, CppVtableSlot interfaceSlot, CppVtableSlot classSlot)
     : this()
 {
     DefinedInType = definedInType;
     InterfaceSlot = interfaceSlot;
     ClassSlot = classSlot;
 }
Exemplo n.º 4
0
        private void WriteVtableThunk(Clarity.Rpa.HighFileBuilder fileBuilder, BinaryWriter writer, CppClass cls, CppMethod method, CppVtableSlot slot)
        {
            CLRMethodSignatureInstance slotSig = slot.Signature;

            writer.Write(fileBuilder.IndexMethodDeclTag(slot.VtableSlotTag));
            writer.Write(fileBuilder.IndexMethodSignatureTag(RpaTagFactory.CreateMethodSignature(slot.Signature)));

            if (cls.TypeDef.Semantics != CLRTypeDefRow.TypeSemantics.Interface)
            {
                writer.Write(method.Abstract);

                if (!method.Abstract)
                {
                    if (method.NumGenericParameters == 0)
                        writer.Write(method.Final);

                    if (method.Static)
                        throw new Exception("VTable slot implemented by static method");

                    writer.Write(fileBuilder.IndexMethodDeclTag(method.VtableSlotTag));
                }
            }
        }
Exemplo n.º 5
0
        private bool WriteSignatureMatchedBinding(HighFileBuilder fileBuilder, BinaryWriter writer, CppClass cls, CppVtableSlot ifcSlot, CLRTypeSpec ifcTypeSpec)
        {
            bool haveMatch = false;
            foreach (CppVtableSlot vtSlot in cls.NewImplementationVisibleVtableSlots)
            {
                if (ifcSlot.Name == vtSlot.Name && ifcSlot.Signature.Equals(vtSlot.Signature))
                {
                    if (haveMatch)
                    {
                        Console.WriteLine("WARNING: Class " + cls.FullName + " has multiple matches for the same interface implementation");
                        break;
                    }
                    haveMatch = true;

                    writer.Write(true);    // HACK - FIXME
                    WriteInterfaceBinding(fileBuilder, writer, ifcSlot, vtSlot);
                }
            }

            if (haveMatch == true)
                return true;

            CLRTypeSpec parentSpec = cls.ParentTypeSpec;
            if (parentSpec == null)
                return false;

            CppClass parentClass = GetCachedClass(parentSpec);

            // Look for prior implementations of this interface, if any are found, STOP and return no-match.
            // See TestInheritedImplementationDeprioritization.  Matches are only recorded if they're new.
            foreach (CLRTypeSpec ifc in parentClass.NewlyImplementedInterfaces)
                if (ifc.Equals(ifcTypeSpec))
                    return false;
            foreach (CLRTypeSpec ifc in parentClass.ReimplementedInterfaces)
                if (ifc.Equals(ifcTypeSpec))
                    return false;
            return WriteSignatureMatchedBinding(fileBuilder, writer, parentClass, ifcSlot, ifcTypeSpec);
        }
Exemplo n.º 6
0
 private void WriteInterfaceBinding(Clarity.Rpa.HighFileBuilder fileBuilder, BinaryWriter writer, CppVtableSlot decl, CppVtableSlot body)
 {
     writer.Write(fileBuilder.IndexMethodDeclTag(decl.VtableSlotTag));
     writer.Write(fileBuilder.IndexMethodDeclTag(body.VtableSlotTag));
 }