#endif // !defined(_WIN64) && (DATA_ALIGNMENT > 4)
pMT->SetBaseSize(baseSize);
// Because of array method table persisting, we need to copy the map
- memcpy(pMTHead + imapOffset, pParentClass->GetInterfaceMap(),
- pParentClass->GetNumInterfaces() * sizeof(InterfaceInfo_t));
+ for (unsigned index = 0; index < pParentClass->GetNumInterfaces(); ++index)
+ {
+ InterfaceInfo_t *pIntInfo = (InterfaceInfo_t *) (pMTHead + imapOffset + index * sizeof(InterfaceInfo_t));
+ pIntInfo->SetMethodTable((pParentClass->GetInterfaceMap() + index)->GetMethodTable());
+ }
pMT->SetInterfaceMap(pParentClass->GetNumInterfaces(), (InterfaceInfo_t *)(pMTHead + imapOffset));
// Copy down flags for these interfaces as well. This is simplified a bit since we know that System.Array
if (TotalNumInterfaces > 0) {
InterfaceInfo_t *pInterfaceMap = GetInterfaceMap();
PREFIX_ASSUME(pInterfaceMap != NULL);
- memcpy(pNewItfMap, pInterfaceMap, TotalNumInterfaces * sizeof(InterfaceInfo_t));
+
+ for (unsigned index = 0; index < TotalNumInterfaces; ++index)
+ {
+ InterfaceInfo_t *pIntInfo = (InterfaceInfo_t *) (pNewItfMap + index);
+ pIntInfo->SetMethodTable((pInterfaceMap + index)->GetMethodTable());
+ }
}
// Add the new interface at the end of the map.
// Dynamic interface maps have an additional DWORD_PTR preceding the InterfaceInfo_t array
if (HasDynamicInterfaceMap())
{
- ZapStoredStructure * pInterfaceMapNode = image->StoreInternedStructure(((DWORD_PTR *)GetInterfaceMap()) - 1,
- GetInterfaceMapSize(),
- DataImage::ITEM_INTERFACE_MAP);
-
+ ZapStoredStructure * pInterfaceMapNode;
+ if (decltype(InterfaceInfo_t::m_pMethodTable)::isRelative)
+ {
+ pInterfaceMapNode = image->StoreStructure(((DWORD_PTR *)GetInterfaceMap()) - 1,
+ GetInterfaceMapSize(),
+ DataImage::ITEM_INTERFACE_MAP);
+ }
+ else
+ {
+ pInterfaceMapNode = image->StoreInternedStructure(((DWORD_PTR *)GetInterfaceMap()) - 1,
+ GetInterfaceMapSize(),
+ DataImage::ITEM_INTERFACE_MAP);
+ }
image->BindPointer(GetInterfaceMap(), pInterfaceMapNode, sizeof(DWORD_PTR));
}
else
#endif // FEATURE_COMINTEROP
{
- image->StoreInternedStructure(GetInterfaceMap(), GetInterfaceMapSize(), DataImage::ITEM_INTERFACE_MAP);
+ if (decltype(InterfaceInfo_t::m_pMethodTable)::isRelative)
+ {
+ image->StoreStructure(GetInterfaceMap(), GetInterfaceMapSize(), DataImage::ITEM_INTERFACE_MAP);
+ }
+ else
+ {
+ image->StoreInternedStructure(GetInterfaceMap(), GetInterfaceMapSize(), DataImage::ITEM_INTERFACE_MAP);
+ }
}
SaveExtraInterfaceInfo(image);
friend class NativeImageDumper;
#endif
- FixupPointer<PTR_MethodTable> m_pMethodTable; // Method table of the interface
+ // Method table of the interface
+#if defined(PLATFORM_UNIX) && defined(_TARGET_ARM_)
+ RelativeFixupPointer<PTR_MethodTable> m_pMethodTable;
+#else
+ FixupPointer<PTR_MethodTable> m_pMethodTable;
+#endif
public:
FORCEINLINE PTR_MethodTable GetMethodTable()
{
LIMITED_METHOD_CONTRACT;
- return m_pMethodTable.GetValue();
+ return ReadPointerMaybeNull(this, &InterfaceInfo_t::m_pMethodTable);
}
#ifndef DACCESS_COMPILE
void SetMethodTable(MethodTable * pMT)
{
LIMITED_METHOD_CONTRACT;
- m_pMethodTable.SetValue(pMT);
+ m_pMethodTable.SetValueMaybeNull(pMT);
}
// Get approximate method table. This is used by the type loader before the type is fully loaded.
PTR_MethodTable GetApproxMethodTable(Module * pContainingModule);
-#endif
+#endif // !DACCESS_COMPILE
+
+#ifndef DACCESS_COMPILE
+ InterfaceInfo_t(InterfaceInfo_t &right)
+ {
+ m_pMethodTable.SetValueMaybeNull(right.m_pMethodTable.GetValueMaybeNull());
+ }
+#else // !DACCESS_COMPILE
+private:
+ InterfaceInfo_t(InterfaceInfo_t &right);
+#endif // !DACCESS_COMPILE
}; // struct InterfaceInfo_t
typedef DPTR(InterfaceInfo_t) PTR_InterfaceInfo;