_ASSERTE(IsStructAligned((uint8_t *)this, GetMethodTable()->GetBaseAlignment()));
#endif // FEATURE_STRUCTALIGN
-#ifdef FEATURE_64BIT_ALIGNMENT
+#if defined(FEATURE_64BIT_ALIGNMENT) && !defined(FEATURE_REDHAWK)
if (pMT->RequiresAlign8())
{
_ASSERTE((((size_t)this) & 0x7) == (pMT->IsValueType() ? 4U : 0U));
}
}
+#ifndef FEATURE_REDHAWK
if (pMT->Collectible())
{
NumOfPointers += 1;
}
+#endif
return NumOfPointers;
}
MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE = (1 << 6)
};
+bool CanFlushUsingMembarrier()
+{
+ // Starting with Linux kernel 4.14, process memory barriers can be generated
+ // using MEMBARRIER_CMD_PRIVATE_EXPEDITED.
+
+ int mask = membarrier(MEMBARRIER_CMD_QUERY, 0);
+
+ if (mask >= 0 &&
+ mask & MEMBARRIER_CMD_PRIVATE_EXPEDITED &&
+ // Register intent to use the private expedited command.
+ membarrier(MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED, 0) == 0)
+ {
+ return true;
+ }
+
+ return false;
+}
+
//
// Tracks if the OS supports FlushProcessWriteBuffers using membarrier
//
assert(s_flushUsingMemBarrier == 0);
- // Starting with Linux kernel 4.14, process memory barriers can be generated
- // using MEMBARRIER_CMD_PRIVATE_EXPEDITED.
- int mask = membarrier(MEMBARRIER_CMD_QUERY, 0);
- if (mask >= 0 &&
- mask & MEMBARRIER_CMD_PRIVATE_EXPEDITED &&
- // Register intent to use the private expedited command.
- membarrier(MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED, 0) == 0)
+ if (CanFlushUsingMembarrier())
{
s_flushUsingMemBarrier = TRUE;
}
CV_ARM64_LR = 80,
CV_ARM64_SP = 81,
CV_ARM64_ZR = 82,
+ CV_ARM64_PC = 83,
- // statue register
+ // status registers
CV_ARM64_NZCV = 90,
+ CV_ARM64_CPSR = 91,
// 32-bit floating point registers
public void AddCompilationRoots(IRootingServiceProvider rootProvider)
{
- rootProvider.AddCompilationRoot(_method, rootMinimalDependencies: false, reason: "Single method root");
+ rootProvider.AddCompilationRoot(_method,
+#if READYTORUN
+ rootMinimalDependencies: false,
+#endif
+ reason: "Single method root");
}
}
}
else if (fromParamUnderlyingType.IsPrimitive)
{
TypeDesc toParamUnderlyingType = paramType.UnderlyingType;
- if (toParamUnderlyingType.IsPrimitive)
+ if (GetNormalizedIntegralArrayElementType(fromParamUnderlyingType) == GetNormalizedIntegralArrayElementType(toParamUnderlyingType))
{
- if (toParamUnderlyingType == fromParamUnderlyingType)
- {
- return true;
- }
-
- if (ArePrimitveTypesEquivalentSize(fromParamUnderlyingType, toParamUnderlyingType))
- {
- return true;
- }
+ return true;
}
}
return false;
}
- // Returns true of the two types are equivalent primitive types. Used by array casts.
- private static bool ArePrimitveTypesEquivalentSize(TypeDesc type1, TypeDesc type2)
+ private static TypeFlags GetNormalizedIntegralArrayElementType(TypeDesc type)
{
- Debug.Assert(type1.IsPrimitive && type2.IsPrimitive);
+ Debug.Assert(!type.IsEnum);
// Primitive types such as E_T_I4 and E_T_U4 are interchangeable
// Enums with interchangeable underlying types are interchangable
// BOOL is NOT interchangeable with I1/U1, neither CHAR -- with I2/U2
// Float and double are not interchangable here.
- int sourcePrimitiveTypeEquivalenceSize = type1.GetIntegralTypeMatchSize();
-
- // Quick check to see if the first type can be matched.
- if (sourcePrimitiveTypeEquivalenceSize == 0)
+ TypeFlags elementType = type.Category;
+ switch (elementType)
{
- return false;
+ case TypeFlags.Byte:
+ case TypeFlags.UInt16:
+ case TypeFlags.UInt32:
+ case TypeFlags.UInt64:
+ case TypeFlags.UIntPtr:
+ return elementType - 1;
}
- int targetPrimitiveTypeEquivalenceSize = type2.GetIntegralTypeMatchSize();
-
- return sourcePrimitiveTypeEquivalenceSize == targetPrimitiveTypeEquivalenceSize;
+ return elementType;
}
- private static int GetIntegralTypeMatchSize(this TypeDesc type)
- {
- Debug.Assert(type.IsPrimitive);
- switch (type.Category)
+ public static bool IsArrayElementTypeCastableBySize(TypeDesc elementType)
+ {
+ switch (elementType.UnderlyingType.Category)
{
- case TypeFlags.SByte:
case TypeFlags.Byte:
- return 1;
+ case TypeFlags.SByte:
case TypeFlags.UInt16:
case TypeFlags.Int16:
- return 2;
- case TypeFlags.Int32:
case TypeFlags.UInt32:
- return 4;
- case TypeFlags.Int64:
+ case TypeFlags.Int32:
case TypeFlags.UInt64:
- return 8;
- case TypeFlags.IntPtr:
+ case TypeFlags.Int64:
case TypeFlags.UIntPtr:
- return type.Context.Target.PointerSize;
- default:
- return 0;
+ case TypeFlags.IntPtr:
+ return true;
}
- }
- public static bool IsArrayElementTypeCastableBySize(TypeDesc elementType)
- {
- TypeDesc underlyingType = elementType.UnderlyingType;
- return underlyingType.IsPrimitive && GetIntegralTypeMatchSize(underlyingType) != 0;
+ return false;
}
private static bool CanCastToClassOrInterface(this TypeDesc thisType, TypeDesc otherType, StackOverflowProtect protect)
/// <summary>
/// Bit flags for layout
/// </summary>
- private class FieldLayoutFlags
+ private static class FieldLayoutFlags
{
/// <summary>
/// True if ContainsGCPointers has been computed
Assert.True(byteType.MakeArrayType().CanCastTo(sbyteType.MakeArrayType()));
Assert.False(byteType.CanCastTo(sbyteType));
- Assert.True(intPtrType.MakeArrayType().CanCastTo(ulongType.MakeArrayType()));
+ Assert.False(intPtrType.MakeArrayType().CanCastTo(ulongType.MakeArrayType()));
Assert.False(intPtrType.CanCastTo(ulongType));
// These are same size, but not allowed to cast
}
-#ifdef TARGET_UNIX
+#if defined(TARGET_UNIX) && !defined(FEATURE_REDHAWK)
OBJECTREF* GcInfoDecoder::GetCapturedRegister(
int regNum,
PREGDISPLAY pRD
return (OBJECTREF*)(pR0 + regNum);
}
-#endif // TARGET_UNIX
+#endif // TARGET_UNIX && !FEATURE_REDHAWK
bool GcInfoDecoder::IsScratchRegister(int regNum, PREGDISPLAY pRD)
_ASSERTE(regNum >= 0 && regNum <= 30);
_ASSERTE(regNum != 18); // TEB
+#ifdef FEATURE_REDHAWK
+ PTR_UIntNative* ppReg = &pRD->pX0;
+
+ return (OBJECTREF*)*(ppReg + regNum);
+#else
DWORD64 **ppReg;
if(regNum <= 17)
ppReg = &pRD->pCurrentContextPointers->X19;
return (OBJECTREF*)*(ppReg + regNum-19);
+#endif
}
bool GcInfoDecoder::IsScratchRegister(int regNum, PREGDISPLAY pRD)
LOG((LF_GCROOTS, LL_INFO1000, "Reporting " FMT_REG, regNum ));
OBJECTREF* pObjRef = GetRegisterSlot( regNum, pRD );
-#if defined(TARGET_UNIX) && !defined(SOS_TARGET_ARM64)
+#if defined(TARGET_UNIX) && !defined(FEATURE_REDHAWK) && !defined(SOS_TARGET_AMD64)
// On PAL, we don't always have the context pointers available due to
// a limitation of an unwinding library. In such case, the context
// pointers for some nonvolatile registers are NULL.
pCallBack(hCallBack, pObjRef, gcFlags DAC_ARG(DacSlotLocation(regNum, 0, false)));
}
-#ifdef TARGET_UNIX
+#if defined(TARGET_UNIX) && !defined(FEATURE_REDHAWK)
OBJECTREF* GcInfoDecoder::GetCapturedRegister(
int regNum,
PREGDISPLAY pRD
return (OBJECTREF*)(pX0 + regNum);
}
-#endif // TARGET_UNIX
+#endif // TARGET_UNIX && !FEATURE_REDHAWK
#else // Unknown platform
<Compile Include="$(MSBuildThisFileDirectory)System\AggregateException.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\AppContext.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\AppContext.AnyOS.cs" Condition="'$(TargetsBrowser)' != 'true'" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\AppContextConfigHelper.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\AppDomain.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\AppDomainSetup.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\AppDomainUnloadedException.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Diagnostics\Tracing\IEventProvider.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Diagnostics\Tracing\IncrementingEventCounter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Diagnostics\Tracing\IncrementingPollingCounter.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)System\Diagnostics\Tracing\NativeRuntimeEventSource.cs" Condition="'$(FeaturePerfTracing)' == 'true'" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Diagnostics\Tracing\NativeRuntimeEventSource.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Diagnostics\Tracing\PollingCounter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Diagnostics\Tracing\RuntimeEventSource.cs" Condition="'$(FeaturePerfTracing)' == 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Diagnostics\Tracing\Winmeta.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Diagnostics\Tracing\TraceLogging\TraceLoggingTypeInfo.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Diagnostics\Tracing\TraceLogging\TypeAnalysis.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Diagnostics\Tracing\TraceLogging\XplatEventLogger.cs" Condition="'$(FeatureXplatEventSource)' == 'true'" />
- <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\QCallHandles.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\QCallHandles.cs" Condition="'$(TargetsCoreRT)' != 'true'" />
</ItemGroup>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)\..\..\Common\src\System\HexConverter.cs">
</ItemGroup>
<ItemGroup Condition="'$(TargetsBrowser)' == 'true'">
<Compile Include="$(MSBuildThisFileDirectory)System\AppContext.Browser.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)System\AppContextConfigHelper.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Environment.Browser.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\IO\DriveInfoInternal.Browser.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\IO\PersistedFiles.Browser.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Intrinsics\Arm\Sha256.PlatformNotSupported.cs" />
</ItemGroup>
<ItemGroup Condition="'$(FeaturePortableThreadPool)' == 'true'">
- <Compile Include="$(MSBuildThisFileDirectory)System\AppContextConfigHelper.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\ThreadPool.Portable.cs" Condition="'$(FeatureCoreCLR)' != 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\ThreadPoolBoundHandle.PlatformNotSupported.cs" Condition="'$(FeatureCoreCLR)' != 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\PortableThreadPool.cs" />
{
protected Attribute() { }
-#if !CORERT
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2075:UnrecognizedReflectionPattern",
Justification = "Unused fields don't make a difference for equality")]
public override bool Equals([NotNullWhen(true)] object? obj)
return type.GetHashCode();
}
-#endif
// Compares values of custom-attribute fields.
private static bool AreFieldValuesEqual(object? thisValue, object? thatValue)
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
namespace System.Diagnostics.Tracing
{
/// <summary>
// as you can't make a constructor partial.
private NativeRuntimeEventSource(int _) { }
+#if FEATURE_PERFTRACING
/// <summary>
/// Dispatch a single event with the specified event ID and payload.
/// </summary>
childActivityID: &childActivityId,
args: decodedPayloadFields);
}
+#endif // FEATURE_PERFTRACING
}
}
case HResults.COR_E_EXCEPTION:
return new System.Exception();
case HResults.COR_E_EXECUTIONENGINE:
+#pragma warning disable CS0618 // ExecutionEngineException is obsolete
return new System.ExecutionEngineException();
+#pragma warning restore CS0618
case HResults.COR_E_FIELDACCESS:
return new System.FieldAccessException();
case HResults.COR_E_FILELOAD:
throw new ArgumentException(SR.Argument_NeedNonGenericType, nameof(t));
}
- // For backward compatibility, we allow lookup up of existing delegate to
+ // For backward compatibility, we allow lookup of existing delegate to
// function pointer mappings using abstract MulticastDelegate type. We will check
// for the non-abstract delegate type later if no existing mapping is found.
if (t.BaseType != typeof(MulticastDelegate) && t != typeof(MulticastDelegate))