#endif // _TARGET_ARM_
}
- // If we saw any GC pointer fields above then the CORINFO_FLG_CONTAINS_GC_PTR has to be set!
- noway_assert((containsGCpointers == false) || ((typeFlags & CORINFO_FLG_CONTAINS_GC_PTR) != 0));
+ // If we saw any GC pointer or by-ref fields above then CORINFO_FLG_CONTAINS_GC_PTR or
+ // CORINFO_FLG_CONTAINS_STACK_PTR has to be set!
+ noway_assert((containsGCpointers == false) ||
+ ((typeFlags & (CORINFO_FLG_CONTAINS_GC_PTR | CORINFO_FLG_CONTAINS_STACK_PTR)) != 0));
// If we have "Custom Layout" then we might have an explicit Size attribute
// Managed C++ uses this for its structs, such C++ types will not contain GC pointers.
/// <exception cref="System.ArgumentOutOfRangeException">
/// Thrown when the specified <paramref name="start"/> index is not in range (<0 or >=Length).
/// </exception>
- [MethodImpl(MethodImplOptions.NoOptimization)] // TODO-SPAN: Workaround for https://github.com/dotnet/coreclr/issues/7894
public ReadOnlySpan<T> Slice(int start)
{
if ((uint)start > (uint)_length)
/// <exception cref="System.ArgumentOutOfRangeException">
/// Thrown when the specified <paramref name="start"/> or end index is not in range (<0 or >=Length).
/// </exception>
- [MethodImpl(MethodImplOptions.NoOptimization)] // TODO-SPAN: Workaround for https://github.com/dotnet/coreclr/issues/7894
public ReadOnlySpan<T> Slice(int start, int length)
{
if ((uint)start > (uint)_length || (uint)length > (uint)(_length - start))
// Until we get over the hurdle of C# 7 tooling, this temporary method will simulate the intended "ref T" indexer for those
// who need bypass the workaround for performance.
//[MethodImpl(MethodImplOptions.AggressiveInlining)]
- [MethodImpl(MethodImplOptions.NoOptimization)] // TODO-SPAN: Workaround for https://github.com/dotnet/coreclr/issues/7894
public ref T GetItem(int index)
{
if ((uint)index >= ((uint)_length))
/// <exception cref="System.ArgumentOutOfRangeException">
/// Thrown when the specified <paramref name="start"/> index is not in range (<0 or >=Length).
/// </exception>
- [MethodImpl(MethodImplOptions.NoOptimization)] // TODO-SPAN: Workaround for https://github.com/dotnet/coreclr/issues/7894
public Span<T> Slice(int start)
{
if ((uint)start > (uint)_length)
/// <exception cref="System.ArgumentOutOfRangeException">
/// Thrown when the specified <paramref name="start"/> or end index is not in range (<0 or >=Length).
/// </exception>
- [MethodImpl(MethodImplOptions.NoOptimization)] // TODO-SPAN: Workaround for https://github.com/dotnet/coreclr/issues/7894
public Span<T> Slice(int start, int length)
{
if ((uint)start > (uint)_length || (uint)length > (uint)(_length - start))
// <REVISIT_TODO>TODO should not burn the time to do this for anything but Value Classes</REVISIT_TODO>
_ASSERTE(type != ELEMENT_TYPE_BYREF);
- // For verifying code involving generics, use the class instantiation
- // of the optional owner (to provide exact, not representative,
- // type information)
- SigTypeContext typeContext(field, (TypeHandle) owner);
+ if (type == ELEMENT_TYPE_I)
+ {
+ PTR_MethodTable enclosingMethodTable = field->GetApproxEnclosingMethodTable();
+ if (enclosingMethodTable->IsByRefLike() && enclosingMethodTable->HasSameTypeDefAs(g_pByReferenceClass))
+ {
+ _ASSERTE(field->GetOffset() == 0);
+ return CORINFO_TYPE_BYREF;
+ }
+ }
if (!CorTypeInfo::IsPrimitiveType(type))
{
field->GetSig(&sig, &sigCount);
- conv = (CorCallingConvention) CorSigUncompressCallingConv(sig);
+ conv = (CorCallingConvention)CorSigUncompressCallingConv(sig);
_ASSERTE(isCallConv(conv, IMAGE_CEE_CS_CALLCONV_FIELD));
SigPointer ptr(sig, sigCount);
+ // For verifying code involving generics, use the class instantiation
+ // of the optional owner (to provide exact, not representative,
+ // type information)
+ SigTypeContext typeContext(field, (TypeHandle)owner);
+
clsHnd = ptr.GetTypeHandleThrowing(field->GetModule(), &typeContext);
_ASSERTE(!clsHnd.IsNull());