summaryrefslogtreecommitdiff
path: root/src/vm/typeequivalencehash.hpp
diff options
context:
space:
mode:
authorAaron Robinson <arobins@microsoft.com>2018-11-29 12:44:04 -0800
committerGitHub <noreply@github.com>2018-11-29 12:44:04 -0800
commit11d1b645f0dede73ded0030b56d7c506150b0741 (patch)
tree279600e72cf717e3133210765f99541afd59341f /src/vm/typeequivalencehash.hpp
parent211d963a42c8988770afa4d2edcbe9be0ed0b8a8 (diff)
downloadcoreclr-11d1b645f0dede73ded0030b56d7c506150b0741.tar.gz
coreclr-11d1b645f0dede73ded0030b56d7c506150b0741.tar.bz2
coreclr-11d1b645f0dede73ded0030b56d7c506150b0741.zip
Enable type equivalence (#21265)
* Enable TypeEquivalence feature for Windows platform * Basic test - verified test exercises TypeEquivalence code paths
Diffstat (limited to 'src/vm/typeequivalencehash.hpp')
-rw-r--r--src/vm/typeequivalencehash.hpp41
1 files changed, 20 insertions, 21 deletions
diff --git a/src/vm/typeequivalencehash.hpp b/src/vm/typeequivalencehash.hpp
index 3ce5231ac9..d750ff0659 100644
--- a/src/vm/typeequivalencehash.hpp
+++ b/src/vm/typeequivalencehash.hpp
@@ -10,13 +10,13 @@
#ifndef __TYPEEQUIVALENCE_HASH_INCLUDED
#define __TYPEEQUIVALENCE_HASH_INCLUDED
-#include "ngenhash.h"
-
#ifdef FEATURE_TYPEEQUIVALENCE
+#include "ngenhash.h"
+
// The type of each entry in the hash.
typedef DPTR(struct TypeEquivalenceEntry) PTR_TypeEquivalenceEntry;
-typedef struct TypeEquivalenceEntry
+struct TypeEquivalenceEntry
{
static NgenHashValue HashTypeHandles(TypeHandle thA, TypeHandle thB)
{
@@ -33,8 +33,8 @@ typedef struct TypeEquivalenceEntry
{
LIMITED_METHOD_CONTRACT;
- return (((thA == m_thA) && (thB == m_thB)) ||
- ((thB == m_thA) && (thA == m_thB)));
+ return (((thA == m_thA) && (thB == m_thB))
+ || ((thB == m_thA) && (thA == m_thB)));
}
void SetData(TypeHandle thA, TypeHandle thB, bool fEquivalent)
@@ -53,11 +53,10 @@ typedef struct TypeEquivalenceEntry
}
private:
-
TypeHandle m_thA;
TypeHandle m_thB;
bool m_fEquivalent;
-} TypeEquivalenceEntry_t;
+};
// The hash type itself. All common logic is provided by the NgenHashTable templated base class. See
// NgenHash.h for details.
@@ -70,7 +69,7 @@ class TypeEquivalenceHashTable : public NgenHashTable<TypeEquivalenceHashTable,
#endif
public:
- typedef enum EquivalenceMatch
+ enum EquivalenceMatch
{
MatchUnknown,
Match,
@@ -88,29 +87,29 @@ public:
EquivalenceMatch CheckEquivalence(TypeHandle thA, TypeHandle thB);
#ifdef DACCESS_COMPILE
- void EnumMemoryRegionsForEntry(TypeEquivalenceEntry_t *pEntry, CLRDataEnumMemoryFlags flags) { return; }
+ void EnumMemoryRegionsForEntry(TypeEquivalenceEntry *pEntry, CLRDataEnumMemoryFlags flags) { return; }
#endif
#if defined(FEATURE_PREJIT) && !defined(DACCESS_COMPILE)
private:
-
- bool ShouldSave(DataImage *pImage, TypeEquivalenceEntry_t *pEntry) { return false; }
- bool IsHotEntry(TypeEquivalenceEntry_t *pEntry, CorProfileData *pProfileData) { return false; }
- bool SaveEntry(DataImage *pImage, CorProfileData *pProfileData, TypeEquivalenceEntry_t *pOldEntry, TypeEquivalenceEntry_t *pNewEntry, EntryMappingTable *pMap) { return true; }
- void FixupEntry(DataImage *pImage, TypeEquivalenceEntry_t *pEntry, void *pFixupBase, DWORD cbFixupOffset) { return; }
+ // Override operations from NgenHashTable - see ngenhash.h
+ bool ShouldSave(DataImage *pImage, TypeEquivalenceEntry *pEntry) { return false; }
+ bool IsHotEntry(TypeEquivalenceEntry *pEntry, CorProfileData *pProfileData) { return false; }
+ bool SaveEntry(DataImage *pImage, CorProfileData *pProfileData, TypeEquivalenceEntry *pOldEntry, TypeEquivalenceEntry *pNewEntry, EntryMappingTable *pMap) { return true; }
+ void FixupEntry(DataImage *pImage, TypeEquivalenceEntry *pEntry, void *pFixupBase, DWORD cbFixupOffset) { return; }
#endif // FEATURE_PREJIT && !DACCESS_COMPILE
private:
#ifndef DACCESS_COMPILE
- TypeEquivalenceHashTable(LoaderHeap *pHeap, DWORD cInitialBuckets, CrstExplicitInit *pCrst) :
- NgenHashTable<TypeEquivalenceHashTable, TypeEquivalenceEntry, 4>(NULL, pHeap, cInitialBuckets),
- m_pHashTableCrst(pCrst)
+ TypeEquivalenceHashTable(LoaderHeap *pHeap, DWORD cInitialBuckets, CrstExplicitInit *pCrst)
+ : NgenHashTable<TypeEquivalenceHashTable, TypeEquivalenceEntry, 4>(NULL, pHeap, cInitialBuckets)
+ , m_pHashTableCrst(pCrst)
{
}
-#endif
- CrstExplicitInit* m_pHashTableCrst;
+#endif // DACCESS_COMPILE
+
+ CrstExplicitInit* m_pHashTableCrst;
};
#endif // FEATURE_TYPEEQUIVALENCE
-
-#endif // !__CLASS_HASH_INCLUDED
+#endif // !__TYPEEQUIVALENCE_HASH_INCLUDED