Exemplo n.º 1
0
 private void CreateFreeType()
 {
     ulong free = m_runtime.GetFreeType();
     IMethodTableData mtData = m_runtime.GetMethodTableData(free);
     m_free = new RhType(this, m_types.Count, m_mrtModule, "Free", free, mtData);
     m_indices[free] = m_types.Count;
     m_types.Add(m_free);
 }
Exemplo n.º 2
0
        private void CreateFreeType()
        {
            ulong            free   = m_runtime.GetFreeType();
            IMethodTableData mtData = m_runtime.GetMethodTableData(free);

            m_free          = new RhType(this, m_types.Count, m_mrtModule, "Free", free, mtData);
            m_indices[free] = m_types.Count;
            m_types.Add(m_free);
        }
Exemplo n.º 3
0
        private ClrType ConstructObjectType(ulong eeType)
        {
            IMethodTableData mtData = m_runtime.GetMethodTableData(eeType);
            if (mtData == null)
                return null;

            ulong componentType = mtData.ElementTypeHandle;
            bool isArray = componentType != 0;

            // EEClass is the canonical method table.  I stuffed the pointer there instead of creating a new property.
            ulong canonType = isArray ? componentType : mtData.EEClass;
            if (!isArray && canonType != 0)
            {
                int index;
                if (!isArray && m_indices.TryGetValue(canonType, out index))
                {
                    m_indices[eeType] = index;  // Link the original eeType to its canonical GCHeapType.
                    return m_types[index];
                }

                ulong tmp = eeType;
                eeType = canonType;
                canonType = tmp;
            }

            string name = m_runtime.ResolveSymbol(eeType);
            if (string.IsNullOrEmpty(name))
            {
                name = m_runtime.ResolveSymbol(canonType);
                if (name == null)
                    name = string.Format("unknown type {0:x}", eeType);
            }


            int len = name.Length;
            if (name.EndsWith("::`vftable'"))
                len -= 11;

            int i = name.IndexOf('!') + 1;
            name = name.Substring(i, len - i);
            
            if (isArray)
                name += "[]";

            RhModule module = FindContainingModule(eeType);
            if (module == null && canonType != 0)
                module = FindContainingModule(canonType);

            if (module == null)
                module = m_mrtModule;

            RhType type = new RhType(this, m_types.Count, module, name, eeType, mtData);
            m_indices[eeType] = m_types.Count;
            if (!isArray)
                m_indices[canonType] = m_types.Count;
            m_types.Add(type);

            return type;
        }
Exemplo n.º 4
0
        private ClrType ConstructObjectType(ulong eeType)
        {
            IMethodTableData mtData = m_runtime.GetMethodTableData(eeType);

            if (mtData == null)
            {
                return(null);
            }

            ulong componentType = mtData.ElementTypeHandle;
            bool  isArray       = componentType != 0;

            // EEClass is the canonical method table.  I stuffed the pointer there instead of creating a new property.
            ulong canonType = isArray ? componentType : mtData.EEClass;

            if (!isArray && canonType != 0)
            {
                int index;
                if (!isArray && m_indices.TryGetValue(canonType, out index))
                {
                    m_indices[eeType] = index;  // Link the original eeType to its canonical GCHeapType.
                    return(m_types[index]);
                }

                ulong tmp = eeType;
                eeType    = canonType;
                canonType = tmp;
            }

            string name = m_runtime.ResolveSymbol(eeType);

            if (string.IsNullOrEmpty(name))
            {
                name = m_runtime.ResolveSymbol(canonType);
                if (name == null)
                {
                    name = string.Format("unknown type {0:x}", eeType);
                }
            }


            int len = name.Length;

            if (name.EndsWith("::`vftable'"))
            {
                len -= 11;
            }

            int i = name.IndexOf('!') + 1;

            name = name.Substring(i, len - i);

            if (isArray)
            {
                name += "[]";
            }

            RhModule module = FindContainingModule(eeType);

            if (module == null && canonType != 0)
            {
                module = FindContainingModule(canonType);
            }

            if (module == null)
            {
                module = m_mrtModule;
            }

            RhType type = new RhType(this, m_types.Count, module, name, eeType, mtData);

            m_indices[eeType] = m_types.Count;
            if (!isArray)
            {
                m_indices[canonType] = m_types.Count;
            }
            m_types.Add(type);

            return(type);
        }