summaryrefslogtreecommitdiff
path: root/src/vm/methodtablebuilder.cpp
diff options
context:
space:
mode:
authorDavid Wrighton <davidwr@microsoft.com>2019-05-20 15:15:52 -0700
committerGitHub <noreply@github.com>2019-05-20 15:15:52 -0700
commitadecd858f558489d8f52c9187fca395ec669a715 (patch)
treec2b597b90f4eeace4f5d898462b99f609531e1d7 /src/vm/methodtablebuilder.cpp
parentf4ae8f0312890a7bc14c28764adb609820d86662 (diff)
downloadcoreclr-adecd858f558489d8f52c9187fca395ec669a715.tar.gz
coreclr-adecd858f558489d8f52c9187fca395ec669a715.tar.bz2
coreclr-adecd858f558489d8f52c9187fca395ec669a715.zip
Cuckoo metadata (#24498)
* Basic infra for cuckoo filter of attributes - Implement cuckoo filter lookup logic - Implement new ready to run section - Add dumper to R2RDump - Parse section on load into data structure - Implement function to query filter - Add concept of enum of well known attributes - So that attribute name hashes themselves may be cached * Wrap all even vaguely perf critical uses of attribute by name parsing with use of R2R data * Update emmintrin.h in the PAL header to contain the needed SSE2 intrinsics for the feature - Disable the presence table for non Corelib cases. Current performance data does not warrant the size increase in other generated binaries
Diffstat (limited to 'src/vm/methodtablebuilder.cpp')
-rw-r--r--src/vm/methodtablebuilder.cpp48
1 files changed, 23 insertions, 25 deletions
diff --git a/src/vm/methodtablebuilder.cpp b/src/vm/methodtablebuilder.cpp
index 91a888af1a..0bafe59f8a 100644
--- a/src/vm/methodtablebuilder.cpp
+++ b/src/vm/methodtablebuilder.cpp
@@ -1420,17 +1420,17 @@ MethodTableBuilder::BuildMethodTableThrowing(
{
bmtProp->fIsValueClass = true;
- HRESULT hr = GetMDImport()->GetCustomAttributeByName(bmtInternal->pType->GetTypeDefToken(),
- g_CompilerServicesUnsafeValueTypeAttribute,
- NULL, NULL);
+ HRESULT hr = GetCustomAttribute(bmtInternal->pType->GetTypeDefToken(),
+ WellKnownAttribute::UnsafeValueType,
+ NULL, NULL);
IfFailThrow(hr);
if (hr == S_OK)
{
SetUnsafeValueClass();
}
- hr = GetMDImport()->GetCustomAttributeByName(bmtInternal->pType->GetTypeDefToken(),
- g_CompilerServicesIsByRefLikeAttribute,
+ hr = GetCustomAttribute(bmtInternal->pType->GetTypeDefToken(),
+ WellKnownAttribute::IsByRefLike,
NULL, NULL);
IfFailThrow(hr);
if (hr == S_OK)
@@ -1486,8 +1486,8 @@ MethodTableBuilder::BuildMethodTableThrowing(
// We check this here fairly early to ensure other downstream checks on these types can be slightly more efficient.
if (GetModule()->IsSystem() || GetAssembly()->IsSIMDVectorAssembly())
{
- HRESULT hr = GetMDImport()->GetCustomAttributeByName(bmtInternal->pType->GetTypeDefToken(),
- g_CompilerServicesIntrinsicAttribute,
+ HRESULT hr = GetCustomAttribute(bmtInternal->pType->GetTypeDefToken(),
+ WellKnownAttribute::Intrinsic,
NULL,
NULL);
@@ -3389,9 +3389,9 @@ MethodTableBuilder::EnumerateClassFields()
// If this static field is thread static, then we need
// to increment bmtEnumFields->dwNumThreadStaticFields
- hr = pMDInternalImport->GetCustomAttributeByName(tok,
- g_ThreadStaticAttributeClassName,
- NULL, NULL);
+ hr = GetCustomAttribute(tok,
+ WellKnownAttribute::ThreadStatic,
+ NULL, NULL);
IfFailThrow(hr);
if (hr == S_OK)
{
@@ -3794,9 +3794,9 @@ VOID MethodTableBuilder::InitializeFieldDescs(FieldDesc *pFieldDescList,
HRESULT hr;
- hr = pInternalImport->GetCustomAttributeByName(bmtMetaData->pFields[i],
- g_ThreadStaticAttributeClassName,
- NULL, NULL);
+ hr = GetCustomAttribute(bmtMetaData->pFields[i],
+ WellKnownAttribute::ThreadStatic,
+ NULL, NULL);
IfFailThrow(hr);
if (hr == S_OK)
{
@@ -3806,9 +3806,9 @@ VOID MethodTableBuilder::InitializeFieldDescs(FieldDesc *pFieldDescList,
if (ElementType == ELEMENT_TYPE_VALUETYPE)
{
- hr = pInternalImport->GetCustomAttributeByName(bmtMetaData->pFields[i],
- g_CompilerServicesFixedAddressValueTypeAttribute,
- NULL, NULL);
+ hr = GetCustomAttribute(bmtMetaData->pFields[i],
+ WellKnownAttribute::FixedAddressValueType,
+ NULL, NULL);
IfFailThrow(hr);
if (hr == S_OK)
{
@@ -5124,12 +5124,10 @@ MethodTableBuilder::InitNewMethodDesc(
// Check for methods marked as [Intrinsic]
if (GetModule()->IsSystem() || GetAssembly()->IsSIMDVectorAssembly())
{
- HRESULT hr = GetMDImport()->GetCustomAttributeByName(pMethod->GetMethodSignature().GetToken(),
- g_CompilerServicesIntrinsicAttribute,
- NULL,
- NULL);
-
- if (hr == S_OK || bmtProp->fIsHardwareIntrinsic)
+ if (bmtProp->fIsHardwareIntrinsic || (S_OK == GetCustomAttribute(pMethod->GetMethodSignature().GetToken(),
+ WellKnownAttribute::Intrinsic,
+ NULL,
+ NULL)))
{
pNewMD->SetIsJitIntrinsic();
}
@@ -10358,7 +10356,7 @@ MethodTableBuilder::SetupMethodTable2(
{
const BYTE * pVal;
ULONG cbVal;
- HRESULT hr = GetMDImport()->GetCustomAttributeByName(GetCl(), g_WindowsFoundationMarshalingBehaviorAttributeClassName, (const void **) &pVal, &cbVal);
+ HRESULT hr = GetCustomAttribute(GetCl(), WellKnownAttribute::WinRTMarshalingBehaviorAttribute, (const void **) &pVal, &cbVal);
if (hr == S_OK)
{
CustomAttributeParser cap(pVal, cbVal);
@@ -11240,7 +11238,7 @@ VOID MethodTableBuilder::CheckForSpecialTypes()
// Check to see if the type is a COM event interface (classic COM interop only).
if (IsInterface() && !GetHalfBakedClass()->IsProjectedFromWinRT())
{
- HRESULT hr = pMDImport->GetCustomAttributeByName(GetCl(), INTEROP_COMEVENTINTERFACE_TYPE, NULL, NULL);
+ HRESULT hr = GetCustomAttribute(GetCl(), WellKnownAttribute::ComEventInterface, NULL, NULL);
if (hr == S_OK)
{
bmtProp->fComEventItfType = true;
@@ -11608,7 +11606,7 @@ void MethodTableBuilder::GetCoClassAttribInfo()
if (!GetHalfBakedClass()->IsProjectedFromWinRT()) // ignore classic COM interop CA on WinRT interfaces
{
// Retrieve the CoClassAttribute CA.
- HRESULT hr = GetMDImport()->GetCustomAttributeByName(GetCl(), INTEROP_COCLASS_TYPE, NULL, NULL);
+ HRESULT hr = GetCustomAttribute(GetCl(), WellKnownAttribute::CoClass, NULL, NULL);
if (hr == S_OK)
{
// COM class interfaces may lazily populate the m_pCoClassForIntf field of EEClass. This field is