{
// Calls to methods or references to fields marked with this attribute may be replaced at
// some call sites with jit intrinsic expansions.
- // Types marked with this attribute may be specially treated by the rumtime/compiler.
+ // Types marked with this attribute may be specially treated by the runtime/compiler.
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Field, Inherited = false)]
internal sealed class IntrinsicAttribute : Attribute
{
STANDARD_VM_CONTRACT;
#if defined(_TARGET_X86_) || defined(_TARGET_AMD64_)
- if (!(GetAssembly()->IsSIMDVectorAssembly() || GetModule()->IsSystem()))
+ if (!(GetAssembly()->IsSIMDVectorAssembly() || bmtProp->fIsIntrinsicType))
return false;
if (bmtFP->NumInstanceFieldBytes != 16)
}
#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;
+ }
+ }
+
#ifdef FEATURE_COMINTEROP
// Com Import classes are special. These types must derive from System.Object,
}
pMT->SetInternalCorElementType(normalizedType);
- // 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()) &&
- ((IsValueClass() && bmtGenerics->HasInstantiation()) || (IsAbstract() && IsSealed())))
+ if (bmtProp->fIsIntrinsicType)
{
- HRESULT hr = GetMDImport()->GetCustomAttributeByName(bmtInternal->pType->GetTypeDefToken(),
- g_CompilerServicesIntrinsicAttribute,
- NULL,
- NULL);
-
- if (hr == S_OK)
- {
- pMT->SetIsIntrinsicType();
- }
+ pMT->SetIsIntrinsicType();
}
if (GetModule()->IsSystem())
BOOL HasNonPublicFields() { WRAPPER_NO_CONTRACT; return GetHalfBakedClass()->HasNonPublicFields(); }
BOOL IsValueClass() { WRAPPER_NO_CONTRACT; return bmtProp->fIsValueClass; }
BOOL IsUnsafeValueClass() { WRAPPER_NO_CONTRACT; return GetHalfBakedClass()->IsUnsafeValueClass(); }
- BOOL IsAbstract() { WRAPPER_NO_CONTRACT; return GetHalfBakedClass()->IsAbstract(); }
- BOOL IsSealed() { WRAPPER_NO_CONTRACT; return GetHalfBakedClass()->IsSealed(); }
+ BOOL IsAbstract() { WRAPPER_NO_CONTRACT; return GetHalfBakedClass()->IsAbstract(); }
BOOL HasLayout() { WRAPPER_NO_CONTRACT; return GetHalfBakedClass()->HasLayout(); }
BOOL IsDelegate() { WRAPPER_NO_CONTRACT; return GetHalfBakedClass()->IsDelegate(); }
BOOL IsNested() { WRAPPER_NO_CONTRACT; return GetHalfBakedClass()->IsNested(); }
bool fDynamicStatics; // Set to true if the statics will be allocated in the dynamic
bool fGenericsStatics; // Set to true if the there are per-instantiation statics
+ bool fIsIntrinsicType; // Set to true if the type has an [Intrinsic] attribute on it
bool fIsHardwareIntrinsic; // Set to true if the class is a hardware intrinsic
DWORD dwNonGCRegularStaticFieldBytes;