summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Strehovský <MichalStrehovsky@users.noreply.github.com>2019-01-22 18:09:31 +0100
committerJan Kotas <jkotas@microsoft.com>2019-01-22 09:09:31 -0800
commitaa70c0a8b47957f0addad13f3f23c189e44e5878 (patch)
tree265da1a8472a105a0c582ab7559abee0cc3c1ea8
parent1923d37f7f1ebc3d701621fa8bfed5cbdf26fba8 (diff)
downloadcoreclr-aa70c0a8b47957f0addad13f3f23c189e44e5878.tar.gz
coreclr-aa70c0a8b47957f0addad13f3f23c189e44e5878.tar.bz2
coreclr-aa70c0a8b47957f0addad13f3f23c189e44e5878.zip
Restrict HW intrinsic name check to intrinsic types (#22116)
Avoids having to compare names of all types in CoreLib to see if they're HW intrinsics.
-rw-r--r--src/vm/methodtablebuilder.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/vm/methodtablebuilder.cpp b/src/vm/methodtablebuilder.cpp
index 688d98ac90..f9a28fb9a4 100644
--- a/src/vm/methodtablebuilder.cpp
+++ b/src/vm/methodtablebuilder.cpp
@@ -1489,8 +1489,25 @@ MethodTableBuilder::BuildMethodTableThrowing(
}
}
+ // If this type is marked by [Intrinsic] attribute, it may be specially treated by the runtime/compiler
+ // SIMD types have [Intrinsic] attribute, for example
+ //
+ // 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,
+ NULL,
+ NULL);
+
+ if (hr == S_OK)
+ {
+ bmtProp->fIsIntrinsicType = true;
+ }
+ }
+
#if defined(_TARGET_X86_) || defined(_TARGET_AMD64_) || defined(_TARGET_ARM64_)
- if (GetModule()->IsSystem() && !bmtGenerics->HasInstantiation())
+ if (bmtProp->fIsIntrinsicType && !bmtGenerics->HasInstantiation())
{
LPCUTF8 className;
LPCUTF8 nameSpace;
@@ -1520,23 +1537,6 @@ MethodTableBuilder::BuildMethodTableThrowing(
}
#endif
- // If this type is marked by [Intrinsic] attribute, it may be specially treated by the runtime/compiler
- // Currently, only SIMD types have [Intrinsic] attribute
- //
- // 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,
- NULL,
- NULL);
-
- if (hr == S_OK)
- {
- bmtProp->fIsIntrinsicType = true;
- }
- }
-
// Com Import classes are special. These types must derive from System.Object,
// and we then substitute the parent with System._ComObject.
if (IsComImport() && !IsEnum() && !IsInterface() && !IsValueClass() && !IsDelegate())