diff --git a/docs/design/features/standalone-gc-loading.md b/docs/design/features/standalone-gc-loading.md index ed7440002e8da8..ddd121c3f09922 100644 --- a/docs/design/features/standalone-gc-loading.md +++ b/docs/design/features/standalone-gc-loading.md @@ -14,11 +14,11 @@ some terms that will be used often in this document. This is an intentionally vague definition. The GC does not care how (or even *if*) programs are compiled or executed, so it is up to the EE to invoke the GC whenever an executing program does something that requires the GC's attention. The EE is notable because the implementation - of an execution engine varies widely between runtimes; the CoreRT EE is primarily in managed code + of an execution engine varies widely between runtimes; the NativeAOT EE is primarily in managed code (C#), while CoreCLR (and the .NET Framework)'s EE is primarily in C++. * The **GC**, or **Garbage Collector** - The component of the CLR responsible for allocating managed objects and reclaiming unused memory. It is written in C++ and the code is shared by multiple runtimes. - (That is, CoreCLR/CoreRT may have different execution engines, but they share the *same* GC code.) + (That is, CoreCLR/NativeAOT may have different execution engines, but they share the *same* GC code.) * The **DAC**, or **Data Access Component** - A subset of the execution engine that is compiled in such a way that it can be run *out of process*, when debugging .NET code using a debugger. The DAC is used by higher-level components such as SOS (Son of Strike, a windbg/lldb debugger extension for @@ -45,8 +45,8 @@ to the codebase: Worth noting is that the JIT (both RyuJIT and the legacy JIT(s) before it) can be built standalone and have realized these same benefits. The existence of an interface and an implementation loadable -from shared libraries has enabled RyuJIT in particular to be used as the code generator for both the -CoreRT compiler and crossgen, while still being flexible enough to be tested using tools that implement +from shared libraries has enabled RyuJIT in particular to be reused as the code generator for the +AOT compilers, while still being flexible enough to be tested using tools that implement very non-standard execution engines such as [SuperPMI](https://github.com/dotnet/runtime/blob/main/src/coreclr/tools/superpmi/readme.md). The below loading protocol is inspired directly by the JIT loader and many aspects of the GC loader are identical diff --git a/src/coreclr/inc/cordebuginfo.h b/src/coreclr/inc/cordebuginfo.h index cc411cfd3193a3..b3f6cb96bc56c1 100644 --- a/src/coreclr/inc/cordebuginfo.h +++ b/src/coreclr/inc/cordebuginfo.h @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // -// Keep in sync with https://github.com/dotnet/corert/blob/master/src/Native/ObjWriter/cordebuginfo.h +// Keep in sync with llvm/tools/objwriter/cordebuginfo.h in current objwriter branch in https://github.com/dotnet/llvm-project repo // /**********************************************************************************/ diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.targets index c2ced0c8579086..f8390e280c0253 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.targets @@ -32,18 +32,18 @@ - + RunResolvePackageDependencies ImportRuntimeIlcPackageTarget SetupProperties - + - - + + diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Publish.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Publish.targets index 96d3f6aa981dc1..5ad1cf0d15581d 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Publish.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Publish.targets @@ -13,20 +13,13 @@ a target called ComputeFilesToPublish which produces the ItemGroup ResolvedFileToPublish based on the inputs of @(IntermediateAssembly) and @(ResolvedAssembliesToPublish). We modify those two item groups - to control what gets published after CoreRT optimizes the application. - - For .NET Core 3.0: - - The property has been renamed to _ResolvedCopyLocalPublishAssets in https://github.com/dotnet/sdk/pull/2646 - - The target has been renamed to ComputeResolvedFilesToPublishList in https://github.com/dotnet/sdk/pull/3281 + to control what gets published after NativeAOT optimizes the application. --> - - - <_ResolvedCopyLocalPublishAssets Remove="@(_AssembliesToSkipPublish)" /> <_ResolvedCopyLocalPublishAssets Include="@(_LinkedResolvedAssemblies)" /> @@ -59,14 +52,14 @@ + Text="Cross-OS native compilation is not supported." /> + Text="Cross-OS native compilation is not supported." /> + Text="Native compilation does not support targeting $(RuntimeIdentifier) yet." /> @@ -74,12 +67,12 @@ - + - + diff --git a/src/coreclr/nativeaot/BuildIntegration/CoreRTNatVis.natvis b/src/coreclr/nativeaot/BuildIntegration/NativeAOT.natvis similarity index 100% rename from src/coreclr/nativeaot/BuildIntegration/CoreRTNatVis.natvis rename to src/coreclr/nativeaot/BuildIntegration/NativeAOT.natvis diff --git a/src/coreclr/nativeaot/BuildIntegration/WindowsAPIs.txt b/src/coreclr/nativeaot/BuildIntegration/WindowsAPIs.txt index 845a90ca278443..1240b6ff122fda 100644 --- a/src/coreclr/nativeaot/BuildIntegration/WindowsAPIs.txt +++ b/src/coreclr/nativeaot/BuildIntegration/WindowsAPIs.txt @@ -2334,3 +2334,9 @@ ws2_32!WSCUnInstallNameSpace ws2_32!WSCUpdateProvider ws2_32!WSCWriteNameSpaceOrder ws2_32!WSCWriteProviderOrder +ucrtbase!_aligned_malloc +ucrtbase!_aligned_free +ucrtbase!_aligned_realloc +ucrtbase!calloc +ucrtbase!free +ucrtbase!malloc diff --git a/src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/RuntimeExports.cs b/src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/RuntimeExports.cs index 5656d6845c295f..3b081e5d64cfcf 100644 --- a/src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/RuntimeExports.cs +++ b/src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/RuntimeExports.cs @@ -21,7 +21,7 @@ internal static partial class RuntimeExports [RuntimeExport("RhNewObject")] public static unsafe object RhNewObject(MethodTable* pEEType) { - // This is structured in a funny way because at the present state of things in CoreRT, the Debug.Assert + // This is structured in a funny way because at the present state of things, the Debug.Assert // below will call into the assert defined in the class library (and not the MRT version of it). The one // in the class library is not low level enough to be callable when GC statics are not initialized yet. // Feel free to restructure once that's not a problem. diff --git a/src/coreclr/nativeaot/Runtime/AsmOffsets.h b/src/coreclr/nativeaot/Runtime/AsmOffsets.h index 0bc72e01abf695..4d240720ca0fbb 100644 --- a/src/coreclr/nativeaot/Runtime/AsmOffsets.h +++ b/src/coreclr/nativeaot/Runtime/AsmOffsets.h @@ -94,12 +94,12 @@ ASM_OFFSET( 18, 28, CallDescrData, pReturnBuffer) // constant to find to BogusFunction(), and build. // // Here's a sample compiler error: -// In file included from corert/src/Native/Runtime/AsmOffsetsVerify.cpp:38: -// corert/src/Native/Runtime/Full/../AsmOffsets.h:117:61: error: calling a private constructor of class +// In file included from nativeaot/Runtime/AsmOffsetsVerify.cpp:38: +// nativeaot/Runtime/Full/../AsmOffsets.h:117:61: error: calling a private constructor of class // 'AsmOffsets::FindCompileTimeConstant<25>' // FindCompileTimeConstant bogus_variable; // ^ -// corert/src/Native/Runtime/Full/../AsmOffsets.h:111:5: note: declared private here +// nativeaot/Runtime/Full/../AsmOffsets.h:111:5: note: declared private here // FindCompileTimeConstant(); // ^ template diff --git a/src/coreclr/nativeaot/Runtime/CMakeLists.txt b/src/coreclr/nativeaot/Runtime/CMakeLists.txt index 2500aab70c47b2..dcf8556ab711aa 100644 --- a/src/coreclr/nativeaot/Runtime/CMakeLists.txt +++ b/src/coreclr/nativeaot/Runtime/CMakeLists.txt @@ -235,7 +235,7 @@ add_definitions(-DFEATURE_DYNAMIC_CODE) add_compile_definitions($<$,$>:FEATURE_GC_STRESS>) add_definitions(-DFEATURE_REDHAWK) add_definitions(-DVERIFY_HEAP) -add_definitions(-DCORERT) +add_definitions(-DNATIVEAOT) add_definitions(-DFEATURE_CACHED_INTERFACE_DISPATCH) add_definitions(-D_LIB) diff --git a/src/coreclr/nativeaot/Runtime/DebugHeader.cpp b/src/coreclr/nativeaot/Runtime/DebugHeader.cpp index 991f67bb9b2274..7460ed29303794 100644 --- a/src/coreclr/nativeaot/Runtime/DebugHeader.cpp +++ b/src/coreclr/nativeaot/Runtime/DebugHeader.cpp @@ -65,7 +65,7 @@ static GlobalValueEntry s_GlobalEntries[GlobalEntriesArraySize]; struct DotNetRuntimeDebugHeader { // The cookie serves as a sanity check against process corruption or being requested - // to treat some other non-.Net module as though it did contain the coreRT runtime. + // to treat some other non-.Net module as though it did contain the .Net runtime. // It can also be changed if we want to make a breaking change so drastic that // earlier debuggers should treat the module as if it had no .Net runtime at all. // If the cookie is valid a debugger is safe to assume the Major/Minor version fields diff --git a/src/coreclr/nativeaot/Runtime/ICodeManager.h b/src/coreclr/nativeaot/Runtime/ICodeManager.h index ee5fb474b9bdbe..d3b46b626ab9d3 100644 --- a/src/coreclr/nativeaot/Runtime/ICodeManager.h +++ b/src/coreclr/nativeaot/Runtime/ICodeManager.h @@ -145,8 +145,6 @@ class ICodeManager PTR_PTR_VOID * ppvRetAddrLocation, // out GCRefKind * pRetValueKind) = 0; // out - virtual void UnsynchronizedHijackMethodLoops(MethodInfo * pMethodInfo) = 0; - virtual PTR_VOID RemapHardwareFaultToGCSafePoint(MethodInfo * pMethodInfo, PTR_VOID controlPC) = 0; virtual bool EHEnumInit(MethodInfo * pMethodInfo, PTR_VOID * pMethodStartAddress, EHEnumState * pEHEnumState) = 0; diff --git a/src/coreclr/nativeaot/Runtime/StackFrameIterator.cpp b/src/coreclr/nativeaot/Runtime/StackFrameIterator.cpp index 335dd71fb4327b..af12ff4fc92a82 100644 --- a/src/coreclr/nativeaot/Runtime/StackFrameIterator.cpp +++ b/src/coreclr/nativeaot/Runtime/StackFrameIterator.cpp @@ -30,7 +30,7 @@ // warning C4061: enumerator '{blah}' in switch of enum '{blarg}' is not explicitly handled by a case label #pragma warning(disable:4061) -#if !defined(USE_PORTABLE_HELPERS) // @TODO: CORERT: these are (currently) only implemented in assembly helpers +#if !defined(USE_PORTABLE_HELPERS) // @TODO: these are (currently) only implemented in assembly helpers #if defined(FEATURE_DYNAMIC_CODE) EXTERN_C void * RhpUniversalTransition(); @@ -163,7 +163,7 @@ void StackFrameIterator::InternalInit(Thread * pThreadToWalk, PTR_PInvokeTransit // properly walk it in parallel. ResetNextExInfoForSP((uintptr_t)dac_cast(pFrame)); -#if !defined(USE_PORTABLE_HELPERS) // @TODO: CORERT: no portable version of regdisplay +#if !defined(USE_PORTABLE_HELPERS) // @TODO: no portable version of regdisplay memset(&m_RegDisplay, 0, sizeof(m_RegDisplay)); m_RegDisplay.SetIP((PCODE)pFrame->m_RIP); m_RegDisplay.SetAddrOfIP((PTR_PCODE)PTR_HOST_MEMBER(PInvokeTransitionFrame, pFrame, m_RIP)); @@ -652,7 +652,7 @@ void StackFrameIterator::UnwindFuncletInvokeThunk() { ASSERT((m_dwFlags & MethodStateCalculated) == 0); -#if defined(USE_PORTABLE_HELPERS) // @TODO: CORERT: Currently no funclet invoke defined in a portable way +#if defined(USE_PORTABLE_HELPERS) // @TODO: Currently no funclet invoke defined in a portable way return; #else // defined(USE_PORTABLE_HELPERS) ASSERT(CategorizeUnadjustedReturnAddress(m_ControlPC) == InFuncletInvokeThunk); @@ -1041,7 +1041,7 @@ void StackFrameIterator::UnwindUniversalTransitionThunk() { ASSERT((m_dwFlags & MethodStateCalculated) == 0); -#if defined(USE_PORTABLE_HELPERS) // @TODO: CORERT: Corresponding helper code is only defined in assembly code +#if defined(USE_PORTABLE_HELPERS) // @TODO: Corresponding helper code is only defined in assembly code return; #else // defined(USE_PORTABLE_HELPERS) ASSERT(CategorizeUnadjustedReturnAddress(m_ControlPC) == InUniversalTransitionThunk); @@ -1126,7 +1126,7 @@ void StackFrameIterator::UnwindCallDescrThunk() { ASSERT((m_dwFlags & MethodStateCalculated) == 0); -#if defined(USE_PORTABLE_HELPERS) // @TODO: CORERT: Corresponding helper code is only defined in assembly code +#if defined(USE_PORTABLE_HELPERS) // @TODO: Corresponding helper code is only defined in assembly code return; #else // defined(USE_PORTABLE_HELPERS) ASSERT(CategorizeUnadjustedReturnAddress(m_ControlPC) == InCallDescrThunk); @@ -1208,7 +1208,7 @@ void StackFrameIterator::UnwindThrowSiteThunk() { ASSERT((m_dwFlags & MethodStateCalculated) == 0); -#if defined(USE_PORTABLE_HELPERS) // @TODO: CORERT: no portable version of throw helpers +#if defined(USE_PORTABLE_HELPERS) // @TODO: no portable version of throw helpers return; #else // defined(USE_PORTABLE_HELPERS) ASSERT(CategorizeUnadjustedReturnAddress(m_ControlPC) == InThrowSiteThunk); @@ -1758,7 +1758,7 @@ PTR_VOID StackFrameIterator::AdjustReturnAddressBackward(PTR_VOID controlPC) // static StackFrameIterator::ReturnAddressCategory StackFrameIterator::CategorizeUnadjustedReturnAddress(PTR_VOID returnAddress) { -#if defined(USE_PORTABLE_HELPERS) // @TODO: CORERT: no portable thunks are defined +#if defined(USE_PORTABLE_HELPERS) // @TODO: no portable thunks are defined return InManagedCode; diff --git a/src/coreclr/nativeaot/Runtime/gcheaputilities.cpp b/src/coreclr/nativeaot/Runtime/gcheaputilities.cpp index 1a0125b1316a13..f615c54451c75f 100644 --- a/src/coreclr/nativeaot/Runtime/gcheaputilities.cpp +++ b/src/coreclr/nativeaot/Runtime/gcheaputilities.cpp @@ -77,7 +77,7 @@ HRESULT GCHeapUtilities::InitializeDefaultGC() void GCHeapUtilities::RecordEventStateChange(bool isPublicProvider, GCEventKeyword keywords, GCEventLevel level) { - // CoreRT does not support standalone GC. Call GCEventStatus directly to keep things simple. + // NativeAOT does not support standalone GC. Call GCEventStatus directly to keep things simple. GCEventStatus::Set(isPublicProvider ? GCEventProvider_Default : GCEventProvider_Private, keywords, level); } diff --git a/src/coreclr/nativeaot/Runtime/gcrhenv.cpp b/src/coreclr/nativeaot/Runtime/gcrhenv.cpp index 0001de5370c1db..11f807ec486341 100644 --- a/src/coreclr/nativeaot/Runtime/gcrhenv.cpp +++ b/src/coreclr/nativeaot/Runtime/gcrhenv.cpp @@ -1180,7 +1180,7 @@ void GCToEEInterface::DiagWalkBGCSurvivors(void* gcContext) void GCToEEInterface::StompWriteBarrier(WriteBarrierParameters* args) { - // CoreRT doesn't patch the write barrier like CoreCLR does, but it + // NativeAOT doesn't patch the write barrier like CoreCLR does, but it // still needs to record the changes in the GC heap. bool is_runtime_suspended = args->is_runtime_suspended; @@ -1399,7 +1399,7 @@ bool GCToEEInterface::CreateThread(void (*threadStart)(void*), void* arg, bool i return true; } -// CoreRT does not use async pinned handles +// NativeAOT does not use async pinned handles void GCToEEInterface::WalkAsyncPinnedForPromotion(Object* object, ScanContext* sc, promote_func* callback) { UNREFERENCED_PARAMETER(object); diff --git a/src/coreclr/nativeaot/Runtime/inc/rhbinder.h b/src/coreclr/nativeaot/Runtime/inc/rhbinder.h index 7a2503b8a7a16b..b5c7394824cd90 100644 --- a/src/coreclr/nativeaot/Runtime/inc/rhbinder.h +++ b/src/coreclr/nativeaot/Runtime/inc/rhbinder.h @@ -338,7 +338,7 @@ struct InterfaceDispatchCell // a single instruction within our stubs. enum PInvokeTransitionFrameFlags { - // NOTE: Keep in sync with ndp\FxCore\CoreRT\src\Native\Runtime\arm\AsmMacros.h + // NOTE: Keep in sync with src\coreclr\nativeaot\Runtime\arm\AsmMacros.h // NOTE: The order in which registers get pushed in the PInvokeTransitionFrame's m_PreservedRegs list has // to match the order of these flags (that's also the order in which they are read in StackFrameIterator.cpp @@ -374,7 +374,7 @@ enum PInvokeTransitionFrameFlags #elif defined(TARGET_ARM64) enum PInvokeTransitionFrameFlags : uint64_t { - // NOTE: Keep in sync with ndp\FxCore\CoreRT\src\Native\Runtime\arm64\AsmMacros.h + // NOTE: Keep in sync with src\coreclr\nativeaot\Runtime\arm64\AsmMacros.h // NOTE: The order in which registers get pushed in the PInvokeTransitionFrame's m_PreservedRegs list has // to match the order of these flags (that's also the order in which they are read in StackFrameIterator.cpp @@ -459,7 +459,7 @@ inline GCRefKind TransitionFrameFlagsToReturnKind(uint64_t transFrameFlags) #else // TARGET_ARM enum PInvokeTransitionFrameFlags { - // NOTE: Keep in sync with ndp\FxCore\CoreRT\src\Native\Runtime\[amd64|i386]\AsmMacros.inc + // NOTE: Keep in sync with src\coreclr\nativeaot\Runtime\[amd64|i386]\AsmMacros.inc // NOTE: The order in which registers get pushed in the PInvokeTransitionFrame's m_PreservedRegs list has // to match the order of these flags (that's also the order in which they are read in StackFrameIterator.cpp diff --git a/src/coreclr/nativeaot/Runtime/stressLog.cpp b/src/coreclr/nativeaot/Runtime/stressLog.cpp index 2e25b6bcfa7928..8af0b5ef777123 100644 --- a/src/coreclr/nativeaot/Runtime/stressLog.cpp +++ b/src/coreclr/nativeaot/Runtime/stressLog.cpp @@ -543,7 +543,7 @@ void StressLog::EnumerateStressMsgs(/*STRESSMSGCALLBACK*/void* smcbWrapper, /*EN // entries (this was the case for %s arguments) memcpy_s(argsCopy, sizeof(argsCopy), latestMsg->args, (latestMsg->numberOfArgs)*sizeof(void*)); - // @TODO: CORERT: Truncating threadId to 32-bit + // @TODO: Truncating threadId to 32-bit if (!smcb((UINT32)latestLog->threadId, deltaTime, latestMsg->facility, format, argsCopy, token)) break; } @@ -553,7 +553,7 @@ void StressLog::EnumerateStressMsgs(/*STRESSMSGCALLBACK*/void* smcbWrapper, /*EN { latestLog->readPtr = NULL; - // @TODO: CORERT: Truncating threadId to 32-bit + // @TODO: Truncating threadId to 32-bit if (!etcb((UINT32)latestLog->threadId, token)) break; } diff --git a/src/coreclr/nativeaot/Runtime/thread.cpp b/src/coreclr/nativeaot/Runtime/thread.cpp index f091318acf641c..cb1a4e3e3281da 100644 --- a/src/coreclr/nativeaot/Runtime/thread.cpp +++ b/src/coreclr/nativeaot/Runtime/thread.cpp @@ -737,8 +737,6 @@ bool Thread::InternalHijack(PAL_LIMITED_CONTEXT * pSuspendCtx, void * pvHijackTa { frameIterator.CalculateCurrentMethodState(); - frameIterator.GetCodeManager()->UnsynchronizedHijackMethodLoops(frameIterator.GetMethodInfo()); - PTR_PTR_VOID ppvRetAddrLocation; GCRefKind retValueKind; diff --git a/src/coreclr/nativeaot/Runtime/unix/HardwareExceptions.cpp b/src/coreclr/nativeaot/Runtime/unix/HardwareExceptions.cpp index b904c9e9ed4df4..3c1ce8d13eedaa 100644 --- a/src/coreclr/nativeaot/Runtime/unix/HardwareExceptions.cpp +++ b/src/coreclr/nativeaot/Runtime/unix/HardwareExceptions.cpp @@ -640,7 +640,7 @@ bool InitializeHardwareExceptionHandling() return true; } -// Set CoreRT hardware exception handler +// Set hardware exception handler REDHAWK_PALEXPORT void REDHAWK_PALAPI PalSetHardwareExceptionHandler(PHARDWARE_EXCEPTION_HANDLER handler) { ASSERT_MSG(g_hardwareExceptionHandler == NULL, "Hardware exception handler already set") diff --git a/src/coreclr/nativeaot/Runtime/unix/UnixNativeCodeManager.cpp b/src/coreclr/nativeaot/Runtime/unix/UnixNativeCodeManager.cpp index 9b3ae03cb30c37..88a850c04f079a 100644 --- a/src/coreclr/nativeaot/Runtime/unix/UnixNativeCodeManager.cpp +++ b/src/coreclr/nativeaot/Runtime/unix/UnixNativeCodeManager.cpp @@ -286,15 +286,10 @@ bool UnixNativeCodeManager::GetReturnAddressHijackInfo(MethodInfo * pMethodIn PTR_PTR_VOID * ppvRetAddrLocation, // out GCRefKind * pRetValueKind) // out { - // @TODO: CORERT: GetReturnAddressHijackInfo + // @TODO: GetReturnAddressHijackInfo return false; } -void UnixNativeCodeManager::UnsynchronizedHijackMethodLoops(MethodInfo * pMethodInfo) -{ - // @TODO: CORERT: UnsynchronizedHijackMethodLoops -} - PTR_VOID UnixNativeCodeManager::RemapHardwareFaultToGCSafePoint(MethodInfo * pMethodInfo, PTR_VOID controlPC) { // GCInfo decoder needs to know whether execution of the method is aborted @@ -390,7 +385,7 @@ bool UnixNativeCodeManager::EHEnumNext(EHEnumState * pEHEnumState, EHClause * pE // Read target type { - // @TODO: CORERT: Compress EHInfo using type table index scheme + // @TODO: Compress EHInfo using type table index scheme // https://github.com/dotnet/corert/issues/972 int32_t typeRelAddr = *((PTR_Int32&)pEnumState->pEHInfo); pEHClauseOut->m_pTargetType = dac_cast(pEnumState->pEHInfo + typeRelAddr); diff --git a/src/coreclr/nativeaot/Runtime/unix/UnixNativeCodeManager.h b/src/coreclr/nativeaot/Runtime/unix/UnixNativeCodeManager.h index 84eb852473f3c8..8603a2b0cff4ba 100644 --- a/src/coreclr/nativeaot/Runtime/unix/UnixNativeCodeManager.h +++ b/src/coreclr/nativeaot/Runtime/unix/UnixNativeCodeManager.h @@ -51,8 +51,6 @@ class UnixNativeCodeManager : public ICodeManager PTR_PTR_VOID * ppvRetAddrLocation, // out GCRefKind * pRetValueKind); // out - void UnsynchronizedHijackMethodLoops(MethodInfo * pMethodInfo); - PTR_VOID RemapHardwareFaultToGCSafePoint(MethodInfo * pMethodInfo, PTR_VOID controlPC); bool EHEnumInit(MethodInfo * pMethodInfo, PTR_VOID * pMethodStartAddress, EHEnumState * pEHEnumState); diff --git a/src/coreclr/nativeaot/Runtime/windows/CoffNativeCodeManager.cpp b/src/coreclr/nativeaot/Runtime/windows/CoffNativeCodeManager.cpp index 28732604fc425c..290a308c6bff67 100644 --- a/src/coreclr/nativeaot/Runtime/windows/CoffNativeCodeManager.cpp +++ b/src/coreclr/nativeaot/Runtime/windows/CoffNativeCodeManager.cpp @@ -630,7 +630,7 @@ bool CoffNativeCodeManager::UnwindStackFrame(MethodInfo * pMethodInfo, } // Convert the return kind that was encoded by RyuJIT to the -// value that CoreRT runtime can understand and support. +// enum used by the runtime. GCRefKind GetGcRefKind(ReturnKind returnKind) { static_assert((GCRefKind)ReturnKind::RT_Scalar == GCRK_Scalar, "ReturnKind::RT_Scalar does not match GCRK_Scalar"); @@ -706,11 +706,6 @@ bool CoffNativeCodeManager::GetReturnAddressHijackInfo(MethodInfo * pMethodIn #endif // defined(TARGET_AMD64) } -void CoffNativeCodeManager::UnsynchronizedHijackMethodLoops(MethodInfo * pMethodInfo) -{ - // @TODO: CORERT: UnsynchronizedHijackMethodLoops -} - PTR_VOID CoffNativeCodeManager::RemapHardwareFaultToGCSafePoint(MethodInfo * pMethodInfo, PTR_VOID controlPC) { // GCInfo decoder needs to know whether execution of the method is aborted @@ -805,7 +800,7 @@ bool CoffNativeCodeManager::EHEnumNext(EHEnumState * pEHEnumState, EHClause * pE // Read target type { - // @TODO: CORERT: Compress EHInfo using type table index scheme + // @TODO: Compress EHInfo using type table index scheme // https://github.com/dotnet/corert/issues/972 uint32_t typeRVA = *((PTR_UInt32&)pEnumState->pEHInfo)++; pEHClauseOut->m_pTargetType = dac_cast(m_moduleBase + typeRVA); diff --git a/src/coreclr/nativeaot/Runtime/windows/CoffNativeCodeManager.h b/src/coreclr/nativeaot/Runtime/windows/CoffNativeCodeManager.h index 3a67ecc3f95384..1bebb4d876f368 100644 --- a/src/coreclr/nativeaot/Runtime/windows/CoffNativeCodeManager.h +++ b/src/coreclr/nativeaot/Runtime/windows/CoffNativeCodeManager.h @@ -87,8 +87,6 @@ class CoffNativeCodeManager : public ICodeManager PTR_PTR_VOID * ppvRetAddrLocation, // out GCRefKind * pRetValueKind); // out - void UnsynchronizedHijackMethodLoops(MethodInfo * pMethodInfo); - PTR_VOID RemapHardwareFaultToGCSafePoint(MethodInfo * pMethodInfo, PTR_VOID controlPC); bool EHEnumInit(MethodInfo * pMethodInfo, PTR_VOID * pMethodStartAddress, EHEnumState * pEHEnumState); diff --git a/src/coreclr/nativeaot/Runtime/windows/PalRedhawkMinWin.cpp b/src/coreclr/nativeaot/Runtime/windows/PalRedhawkMinWin.cpp index a119b65a589ca2..9944742d23e3f5 100644 --- a/src/coreclr/nativeaot/Runtime/windows/PalRedhawkMinWin.cpp +++ b/src/coreclr/nativeaot/Runtime/windows/PalRedhawkMinWin.cpp @@ -265,7 +265,7 @@ REDHAWK_PALEXPORT UInt32_BOOL REDHAWK_PALAPI PalMarkThunksAsValidCallTargets( int thunkBlockSize, int thunkBlocksPerMapping) { - // For CoreRT we are using RWX pages so there is no need for this API for now. + // We are using RWX pages so there is no need for this API for now. // Once we have a scenario for non-RWX pages we should be able to put the implementation here return TRUE; } @@ -464,7 +464,7 @@ REDHAWK_PALEXPORT void REDHAWK_PALAPI PalTerminateCurrentProcess(uint32_t arg2) REDHAWK_PALEXPORT HANDLE REDHAWK_PALAPI PalGetModuleHandleFromPointer(_In_ void* pointer) { - // CoreRT is not designed to be unloadable today. Use GET_MODULE_HANDLE_EX_FLAG_PIN to prevent + // The runtime is not designed to be unloadable today. Use GET_MODULE_HANDLE_EX_FLAG_PIN to prevent // the module from ever unloading. HMODULE module; diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/CompilerServices/FunctionPointerOps.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/CompilerServices/FunctionPointerOps.cs index cb89e087340fc7..30c62e9b436cb9 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/CompilerServices/FunctionPointerOps.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/CompilerServices/FunctionPointerOps.cs @@ -82,7 +82,7 @@ public static unsafe IntPtr GetGenericMethodFunctionPointer(IntPtr canonFunction System.Diagnostics.Debug.Assert(newSubChunkIndex == 0); // New generic descriptors are allocated on the native heap and not tracked in the GC. - IntPtr pNewMem = Marshal.AllocHGlobal((int)(c_genericDictionaryChunkSize * sizeof(GenericMethodDescriptor))); + IntPtr pNewMem = (IntPtr)NativeMemory.Alloc(c_genericDictionaryChunkSize, (nuint)sizeof(GenericMethodDescriptor)); s_genericFunctionPointerCollection.Add(pNewMem); } diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/CompilerServices/OpenMethodResolver.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/CompilerServices/OpenMethodResolver.cs index 7b458a8539d33b..b4fffe59189370 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/CompilerServices/OpenMethodResolver.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/CompilerServices/OpenMethodResolver.cs @@ -245,7 +245,7 @@ public unsafe IntPtr ToIntPtr() IntPtr returnValue; if (s_internedResolverHash.TryGetValue(this, out returnValue)) return returnValue; - returnValue = Marshal.AllocHGlobal(sizeof(OpenMethodResolver)); + returnValue = (IntPtr)NativeMemory.Alloc((nuint)sizeof(OpenMethodResolver)); *((OpenMethodResolver*)returnValue) = this; s_internedResolverHash.Add(this, returnValue); return returnValue; diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj b/src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj index c2060f95d52140..112d4aecd77062 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj @@ -376,7 +376,7 @@ Internal\Runtime\LowLevelStringConverter.cs - + true diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Collections/Generic/Comparer.NativeAot.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Collections/Generic/Comparer.NativeAot.cs index 091b5a18fd57c1..d22979ebb33652 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Collections/Generic/Comparer.NativeAot.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Collections/Generic/Comparer.NativeAot.cs @@ -38,7 +38,7 @@ public static Comparer Default [Intrinsic] get { - // Lazy initialization produces smaller code for CoreRT than initialization in constructor + // Lazy initialization produces smaller code for AOT compilation than initialization in constructor return s_default ?? Create(); } } diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Collections/Generic/EqualityComparer.NativeAot.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Collections/Generic/EqualityComparer.NativeAot.cs index e3019e4c7baae9..e88a62173b6a23 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Collections/Generic/EqualityComparer.NativeAot.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Collections/Generic/EqualityComparer.NativeAot.cs @@ -38,7 +38,7 @@ public static EqualityComparer Default [Intrinsic] get { - // Lazy initialization produces smaller code for CoreRT than initialization in constructor + // Lazy initialization produces smaller code for AOT compilation than initialization in constructor return s_default ?? Create(); } } diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Diagnostics/Debugger.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Diagnostics/Debugger.cs index b05cbfee697410..0f6614fd3ca7ef 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Diagnostics/Debugger.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Diagnostics/Debugger.cs @@ -63,7 +63,7 @@ public static void Log(int level, string category, string message) { if (IsLogging()) { - throw new NotImplementedException(); // TODO: CoreRT issue# 3235: NS2.0 - implement Debugger.Log, IsLogging + throw new NotImplementedException(); // TODO: Implement Debugger.Log, IsLogging } } @@ -74,7 +74,7 @@ public static bool IsLogging() { if (string.Empty.Length != 0) { - throw new NotImplementedException(); // TODO: CoreRT issue# 3235: NS2.0 - implement Debugger.Log, IsLogging + throw new NotImplementedException(); // TODO: Implement Debugger.Log, IsLogging } return false; } diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Environment.NativeAot.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Environment.NativeAot.cs index d6b47493359c8a..2573576699927a 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Environment.NativeAot.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Environment.NativeAot.cs @@ -46,7 +46,7 @@ public static void FailFast(string message, Exception exception) => internal static void FailFast(string message, Exception exception, string errorSource) { // TODO: errorSource originates from CoreCLR (See: https://github.com/dotnet/coreclr/pull/15895) - // For now, we ignore errorSource on CoreRT but we should distinguish the way FailFast prints exception message using errorSource + // For now, we ignore errorSource but we should distinguish the way FailFast prints exception message using errorSource bool result = DeveloperExperience.Default.OnContractFailure(exception.StackTrace, ContractFailureKind.Assert, message, null, null, null); if (!result) { diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Exception.NativeAot.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Exception.NativeAot.cs index a2cb614d3ef910..f454f6a81a8c03 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Exception.NativeAot.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Exception.NativeAot.cs @@ -30,10 +30,6 @@ public MethodBase? TargetSite private static string? SerializationWatsonBuckets => null; - // WARNING: We allow diagnostic tools to directly inspect these three members (_message, _innerException and _HResult) - // See https://github.com/dotnet/corert/blob/master/Documentation/design-docs/diagnostics/diagnostics-tools-contract.md for more details. - // Please do not change the type, the name, or the semantic usage of this member without understanding the implication for tools. - // Get in touch with the diagnostics team if you have questions. internal string? _message; private IDictionary? _data; private Exception? _innerException; @@ -55,13 +51,6 @@ internal IntPtr[] GetStackIPs() return ips; } - // WARNING: We allow diagnostic tools to directly inspect these two members (_corDbgStackTrace and _idxFirstFreeStackTraceEntry) - // See https://github.com/dotnet/corert/blob/master/Documentation/design-docs/diagnostics/diagnostics-tools-contract.md for more details. - // Please do not change the type, the name, or the semantic usage of this member without understanding the implication for tools. - // Get in touch with the diagnostics team if you have questions. - - // _corDbgStackTrace: Do not rename: This is for the use of the CorDbg interface. Contains the stack trace as an array of EIP's (ordered from - // most nested call to least.) May also include a few "special" IP's from the SpecialIP class: private IntPtr[]? _corDbgStackTrace; private int _idxFirstFreeStackTraceEntry; @@ -272,7 +261,7 @@ private bool CanSetRemoteStackTrace() ThrowHelper.ThrowInvalidOperationException(); } - return true; // CoreRT runtime doesn't have immutable agile exceptions, always return true + return true; // NativeAOT runtime doesn't have immutable agile exceptions, always return true } } } diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/InteropServices/ComWrappers.NativeAot.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/InteropServices/ComWrappers.NativeAot.cs index 1c55a0ed037549..319f48a9003ac2 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/InteropServices/ComWrappers.NativeAot.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/InteropServices/ComWrappers.NativeAot.cs @@ -274,7 +274,7 @@ public ManagedObjectWrapperHolder(ManagedObjectWrapper* wrapper) { // Release GC handle created when MOW was built. _wrapper->Destroy(); - Marshal.FreeCoTaskMem((IntPtr)_wrapper); + NativeMemory.Free(_wrapper); } } @@ -367,8 +367,8 @@ public unsafe IntPtr GetOrCreateComInterfaceForObject(object instance, CreateCom int totalDefinedCount = runtimeDefinedCount + userDefinedCount; // Allocate memory for the ManagedObjectWrapper. - IntPtr wrapperMem = Marshal.AllocCoTaskMem( - sizeof(ManagedObjectWrapper) + totalDefinedCount * sizeof(InternalComInterfaceDispatch)); + IntPtr wrapperMem = (IntPtr)NativeMemory.Alloc( + (nuint)sizeof(ManagedObjectWrapper) + (nuint)totalDefinedCount * (nuint)sizeof(InternalComInterfaceDispatch)); // Compute the dispatch section offset and ensure it is aligned. ManagedObjectWrapper* mow = (ManagedObjectWrapper*)wrapperMem; diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.NativeAot.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.NativeAot.cs index 01bdf6fa5e55c2..2dc5bc3310fbd7 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.NativeAot.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.NativeAot.cs @@ -181,8 +181,7 @@ public static unsafe void StructureToPtr(object structure, IntPtr ptr, bool fDel private static void PrelinkCore(MethodInfo m) { - // Note: This method is effectively a no-op in ahead-of-time compilation scenarios. In CoreCLR and Desktop, this will pre-generate - // the P/Invoke, but everything is pre-generated in CoreRT. + // This method is effectively a no-op for NativeAOT, everything pre-generated. } internal static Delegate GetDelegateForFunctionPointerInternal(IntPtr ptr, Type t) diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/InteropServices/PInvokeMarshal.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/InteropServices/PInvokeMarshal.cs index 57a2a7c8375ef5..d82559e93712b1 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/InteropServices/PInvokeMarshal.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/InteropServices/PInvokeMarshal.cs @@ -118,9 +118,10 @@ public PInvokeDelegateThunk(Delegate del) // Allocate unmanaged memory for GCHandle of delegate and function pointer of open static delegate // We will store this pointer on the context slot of thunk data // - ContextData = Marshal.AllocHGlobal(2 * IntPtr.Size); unsafe { + ContextData = (IntPtr)NativeMemory.Alloc((nuint)(2 * IntPtr.Size)); + ThunkContextData* thunkData = (ThunkContextData*)ContextData; // allocate a weak GChandle for the delegate @@ -148,7 +149,7 @@ public PInvokeDelegateThunk(Delegate del) } // Free the allocated context data memory - Marshal.FreeHGlobal(ContextData); + NativeMemory.Free((void*)ContextData); } } } diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/Overlapped.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/Overlapped.cs index 9bbde9240f2c5b..e1417c4847782a 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/Overlapped.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/Overlapped.cs @@ -102,7 +102,7 @@ internal sealed unsafe class OverlappedData } } - NativeOverlapped* pNativeOverlapped = (NativeOverlapped*)Marshal.AllocHGlobal(sizeof(NativeOverlapped) + sizeof(GCHandle)); + NativeOverlapped* pNativeOverlapped = (NativeOverlapped*)NativeMemory.Alloc((nuint)(sizeof(NativeOverlapped) + sizeof(GCHandle))); *(GCHandle*)(pNativeOverlapped + 1) = default(GCHandle); _pNativeOverlapped = pNativeOverlapped; @@ -150,7 +150,7 @@ private void FreeNativeOverlapped() if (handle.IsAllocated) handle.Free(); - Marshal.FreeHGlobal((IntPtr)_pNativeOverlapped); + NativeMemory.Free(_pNativeOverlapped); _pNativeOverlapped = null; } } diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/SyncTable.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/SyncTable.cs index c58a719a72bbc7..e531323d62a81b 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/SyncTable.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/SyncTable.cs @@ -49,11 +49,6 @@ internal static class SyncTable /// The initial size of the table. Must be positive and not greater than /// ObjectHeader.MASK_HASHCODE_INDEX + 1. /// - /// - /// CLR uses 250 as the initial table size. In contrast to CoreRT, CLR creates sync - /// entries less frequently since uncontended Monitor synchronization employs a thin lock - /// stored in the object header. - /// #if DEBUG // Exercise table expansion more frequently in debug builds private const int InitialSize = 1; diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/Win32ThreadPoolNativeOverlapped.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/Win32ThreadPoolNativeOverlapped.cs index d5e88723b49fee..9f139af0ad1de1 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/Win32ThreadPoolNativeOverlapped.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/Win32ThreadPoolNativeOverlapped.cs @@ -62,7 +62,7 @@ internal OverlappedData Data } // None are free; allocate a new one. - overlapped = (Win32ThreadPoolNativeOverlapped*)Marshal.AllocHGlobal(sizeof(Win32ThreadPoolNativeOverlapped)); + overlapped = (Win32ThreadPoolNativeOverlapped*)NativeMemory.Alloc((nuint)sizeof(Win32ThreadPoolNativeOverlapped)); *overlapped = default(Win32ThreadPoolNativeOverlapped); // Allocate a OverlappedData object, and an index at which to store it in _dataArray. diff --git a/src/coreclr/nativeaot/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/ExecutionEnvironmentImplementation.MappingTables.cs b/src/coreclr/nativeaot/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/ExecutionEnvironmentImplementation.MappingTables.cs index 318ece00699b94..228dc1979700af 100644 --- a/src/coreclr/nativeaot/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/ExecutionEnvironmentImplementation.MappingTables.cs +++ b/src/coreclr/nativeaot/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/ExecutionEnvironmentImplementation.MappingTables.cs @@ -422,7 +422,7 @@ private unsafe void GetDynamicMethodInvokeMethodInfo(NativeFormatModuleInfo modu // All methods referred from this blob are contained in the same type. The first UINT in the blob is a reloc to that MethodTable if (RuntimeAugments.SupportsRelativePointers) { - // CoreRT uses 32bit relative relocs + // 32bit relative relocs declaringTypeHandle = RuntimeAugments.CreateRuntimeTypeHandle((IntPtr)(pBlobAsBytes + *(int*)pBlobAsBytes)); } else @@ -454,7 +454,7 @@ private unsafe void GetDynamicMethodInvokeMethodInfo(NativeFormatModuleInfo modu if (RuntimeAugments.SupportsRelativePointers) { - // CoreRT uses 32bit relative relocs + // 32bit relative relocs int* pRelPtr32 = &((int*)pBlobAsBytes)[index + 1]; dynamicInvokeMethod = (IntPtr)((byte*)pRelPtr32 + *pRelPtr32); } diff --git a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/EETypeCreator.cs b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/EETypeCreator.cs index c7dc8afd6faf59..f5bdf03faa20ad 100644 --- a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/EETypeCreator.cs +++ b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/EETypeCreator.cs @@ -122,14 +122,14 @@ public static unsafe void Memset(IntPtr destination, int length, byte value) } } - public static IntPtr AllocateMemory(int cbBytes) + public static unsafe IntPtr AllocateMemory(int cbBytes) { - return Marshal.AllocHGlobal(new IntPtr(cbBytes)); + return (IntPtr)NativeMemory.Alloc((nuint)cbBytes); } - public static void FreeMemory(IntPtr memoryPtrToFree) + public static unsafe void FreeMemory(IntPtr memoryPtrToFree) { - Marshal.FreeHGlobal(memoryPtrToFree); + NativeMemory.Free((void*)memoryPtrToFree); } } diff --git a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.FieldAccess.cs b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.FieldAccess.cs index e521b9ef3a792b..dca219f10afb60 100644 --- a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.FieldAccess.cs +++ b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.FieldAccess.cs @@ -267,7 +267,7 @@ private struct RemoteStaticFieldDescriptor /// public static unsafe IntPtr RvaToNonGenericStaticFieldAddress(TypeManagerHandle moduleHandle, int staticFieldRVA) { - // TODO: implement for CoreRT + // TODO: implement throw new NotImplementedException(); } diff --git a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.Metadata.cs b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.Metadata.cs index 425fc6e627f169..a0c3379a3efb08 100644 --- a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.Metadata.cs +++ b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.Metadata.cs @@ -792,7 +792,7 @@ public static bool TryGetVirtualResolveData(NativeFormatModuleInfo module, // If there's a call to Foo.Method1 and a call to Foo.Method2, given that both // of these instantiations share the same canonical form, Foo<__Canon> will have both method // entries, and therefore Foo and Foo will have both entries too. - // For this reason, the entries that we write to the map in CoreRT will be based on the canonical form + // For this reason, the entries that we write to the map will be based on the canonical form // of the method's containing type instead of the open type definition. // diff --git a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/TypeSystem/TypeSystemContext.Runtime.cs b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/TypeSystem/TypeSystemContext.Runtime.cs index 19d6028102ed0f..55923303d641e2 100644 --- a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/TypeSystem/TypeSystemContext.Runtime.cs +++ b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/TypeSystem/TypeSystemContext.Runtime.cs @@ -433,7 +433,7 @@ internal MethodDesc ResolveRuntimeMethod(bool unboxingStub, DefType owningType, /// /// Get a DefType that is the generic instantiation of an open generic type over instantiation arguments - /// This looks like a rename of GetInstantiatedType, but isn't because the corert GetInstantiatedType + /// This looks like a rename of GetInstantiatedType, but isn't because the GetInstantiatedType /// relies on typeDef being a MetadataType, whereas this permits non-metadata types. /// public DefType ResolveGenericInstantiation(DefType typeDef, Instantiation arguments) diff --git a/src/coreclr/nativeaot/docs/rd-xml-format.md b/src/coreclr/nativeaot/docs/rd-xml-format.md index 35d7880d4ab275..a0ccf441c2d5b4 100644 --- a/src/coreclr/nativeaot/docs/rd-xml-format.md +++ b/src/coreclr/nativeaot/docs/rd-xml-format.md @@ -1,8 +1,8 @@ Rd.xml File Format ================== -The CoreRT ahead of time compiler discovers methods to compile and types to generate by compiling the application entry point and its transitive dependencies. The compiler may miss types if an application uses reflection. For more information about the problem see [Reflection in AOT mode](reflection-in-aot-mode.md). -An rd.xml file can be supplemented to help ILCompiler find types that should be analyzed. This file is similar but more limited than the rd.xml file used by .NET Native. +The NativeAOT compiler discovers methods to compile and types to generate by compiling the application entry point and its transitive dependencies. The compiler may miss types if an application uses reflection. For more information about the problem see [Reflection in AOT mode](reflection-in-aot-mode.md). +An rd.xml file can be supplemented to help the compiler find types that should be analyzed. This file is similar but more limited than the rd.xml file used by .NET Native. Minimal Rd.xml configuration @@ -14,7 +14,7 @@ Minimal Rd.xml configuration ``` -ILCompiler supports 2 top level directives `Application` or `Library`. Right now both of them can be used interchangeably and just define area where actual assembly configuration happens. +The compiler supports 2 top level directives `Application` or `Library`. Right now both of them can be used interchangeably and just define area where actual assembly configuration happens. You can put multiple `` tags inside the `` directive to configure each assembly individually. ## Assembly directive diff --git a/src/coreclr/nativeaot/docs/reflection-free-mode.md b/src/coreclr/nativeaot/docs/reflection-free-mode.md index 2cc7f396f3b457..644421e36c1f1c 100644 --- a/src/coreclr/nativeaot/docs/reflection-free-mode.md +++ b/src/coreclr/nativeaot/docs/reflection-free-mode.md @@ -8,7 +8,7 @@ Reflection-free mode is a mode of the NativeAOT compiler and runtime that greatl Of course the benefits come with a drawback: not all .NET code can work in such environment. In fact, most of the existing code probably won't. Use this mode with caution. https://github.com/dotnet/runtime/issues/67193 tracks potential improvements of this mode. -To enable reflection-free mode in a project that is already using CoreRT, add the following property to a `PropertyGroup` in your project file: +To enable reflection-free mode in a project that is already using NativeAOT, add the following property to a `PropertyGroup` in your project file: ```xml diff --git a/src/coreclr/nativeaot/docs/reflection-in-aot-mode.md b/src/coreclr/nativeaot/docs/reflection-in-aot-mode.md index 3fcfdae3e94b47..ee3ac192ea371a 100644 --- a/src/coreclr/nativeaot/docs/reflection-in-aot-mode.md +++ b/src/coreclr/nativeaot/docs/reflection-in-aot-mode.md @@ -59,7 +59,7 @@ This is the algorithm we discussed above - only things that are reachable throug ### Assume code computed by static analysis is accessed dynamically ### -The compiler can build insights into how reflection is used by analyzing the use of reflection APIs within the compiled program and using data flow analysis to see what elements are reflected on. This is effective for a lot of patterns (such as `typeof(Foo).GetMethod("Bar")`), but can also miss a lot of reflection use in practice. Currently, the .NET Native compiler used to build Universal Windows Apps can do this analysis. The CoreRT compiler is structured so that it can consume these inputs, but there's no component to provide them right now. +The compiler can build insights into how reflection is used by analyzing the use of reflection APIs within the compiled program and using data flow analysis to see what elements are reflected on. This is effective for a lot of patterns (such as `typeof(Foo).GetMethod("Bar")`), but can also miss a lot of reflection use in practice. ### Assume nothing is accessed dynamically ### diff --git a/src/coreclr/nativeaot/docs/troubleshooting.md b/src/coreclr/nativeaot/docs/troubleshooting.md index 07793b46a2323a..8e4b2998ddddaf 100644 --- a/src/coreclr/nativeaot/docs/troubleshooting.md +++ b/src/coreclr/nativeaot/docs/troubleshooting.md @@ -1,9 +1,9 @@ # Troubleshooting NativeAOT compiler -Sometimes you want to have more information how CoreRT work. ILC Compiler provide couple switches for that: +Sometimes you want to have more information how NativeAOT works. The compiler provides several switches for that: * `true`: Enable generation of metadata log. This class is CSV format with following structure: `Handle, Kind, Name, Children`. * `true`: Generates log files `ProjectName.codegen.dgml.xml` and `ProjectName.scan.dgml.xml` in DGML format. -* `true`: Generates log files `ProjectName.map.xml` which describe layout of objects how CoreRT sees them. +* `true`: Generates log files `ProjectName.map.xml` which describe layout of objects. * `true`: Perform compilation on single thread. * `true`: Dump IL for method bodies the compiler generated on the fly into `ProjectName.il`. This can be helpful when debugging IL generation - e.g. marshalling. The compiler maps debug information to this file, so it's possible to step in it and set breakpoints. diff --git a/src/coreclr/tools/Common/Compiler/DependencyAnalysis/SortableDependencyNode.cs b/src/coreclr/tools/Common/Compiler/DependencyAnalysis/SortableDependencyNode.cs index 44dade4bad521c..870095e4b9389f 100644 --- a/src/coreclr/tools/Common/Compiler/DependencyAnalysis/SortableDependencyNode.cs +++ b/src/coreclr/tools/Common/Compiler/DependencyAnalysis/SortableDependencyNode.cs @@ -66,7 +66,7 @@ protected enum ObjectNodeOrder // - // CoreRT Nodes + // NativeAOT Nodes // MetadataNode, ResourceDataNode, diff --git a/src/coreclr/tools/Common/Compiler/CoreRTNameMangler.cs b/src/coreclr/tools/Common/Compiler/NativeAotNameMangler.cs similarity index 99% rename from src/coreclr/tools/Common/Compiler/CoreRTNameMangler.cs rename to src/coreclr/tools/Common/Compiler/NativeAotNameMangler.cs index 2b2250f2f957ea..c93e19a9173e4f 100644 --- a/src/coreclr/tools/Common/Compiler/CoreRTNameMangler.cs +++ b/src/coreclr/tools/Common/Compiler/NativeAotNameMangler.cs @@ -13,14 +13,14 @@ namespace ILCompiler { - public class CoreRTNameMangler : NameMangler + public class NativeAotNameMangler : NameMangler { private SHA256 _sha256; #if !READYTORUN private readonly bool _mangleForCplusPlus; - public CoreRTNameMangler(NodeMangler nodeMangler, bool mangleForCplusPlus) : base(nodeMangler) + public NativeAotNameMangler(NodeMangler nodeMangler, bool mangleForCplusPlus) : base(nodeMangler) { _mangleForCplusPlus = mangleForCplusPlus; } diff --git a/src/coreclr/tools/Common/Internal/Runtime/ModuleHeaders.cs b/src/coreclr/tools/Common/Internal/Runtime/ModuleHeaders.cs index 47238ec82aa491..3a84d0606416ac 100644 --- a/src/coreclr/tools/Common/Internal/Runtime/ModuleHeaders.cs +++ b/src/coreclr/tools/Common/Internal/Runtime/ModuleHeaders.cs @@ -69,7 +69,7 @@ public enum ReadyToRunSectionType ManifestAssemblyMvids = 118, // Added in 5.3 // - // CoreRT ReadyToRun sections + // NativeAOT ReadyToRun sections // StringTable = 200, // Unused GCStaticRegion = 201, diff --git a/src/coreclr/tools/Common/TypeSystem/Common/MetadataFieldLayoutAlgorithm.cs b/src/coreclr/tools/Common/TypeSystem/Common/MetadataFieldLayoutAlgorithm.cs index 61d06a4838f77d..76a390e5fe52b3 100644 --- a/src/coreclr/tools/Common/TypeSystem/Common/MetadataFieldLayoutAlgorithm.cs +++ b/src/coreclr/tools/Common/TypeSystem/Common/MetadataFieldLayoutAlgorithm.cs @@ -894,11 +894,7 @@ public override ValueTypeShapeCharacteristics ComputeValueTypeShapeCharacteristi if (!type.IsValueType) return ValueTypeShapeCharacteristics.None; - ValueTypeShapeCharacteristics result = ComputeHomogeneousAggregateCharacteristic(type); - - // TODO: System V AMD64 characteristics (https://github.com/dotnet/corert/issues/158) - - return result; + return ComputeHomogeneousAggregateCharacteristic(type); } private ValueTypeShapeCharacteristics ComputeHomogeneousAggregateCharacteristic(DefType type) diff --git a/src/coreclr/tools/Common/TypeSystem/IL/CoreRTILProvider.cs b/src/coreclr/tools/Common/TypeSystem/IL/NativeAotILProvider.cs similarity index 99% rename from src/coreclr/tools/Common/TypeSystem/IL/CoreRTILProvider.cs rename to src/coreclr/tools/Common/TypeSystem/IL/NativeAotILProvider.cs index 95e8e7e9d27a31..fb64e67c9dc614 100644 --- a/src/coreclr/tools/Common/TypeSystem/IL/CoreRTILProvider.cs +++ b/src/coreclr/tools/Common/TypeSystem/IL/NativeAotILProvider.cs @@ -12,7 +12,7 @@ namespace Internal.IL { - public sealed class CoreRTILProvider : ILProvider + public sealed class NativeAotILProvider : ILProvider { private MethodIL TryGetRuntimeImplementedMethodIL(MethodDesc method) { diff --git a/src/coreclr/tools/aot/DependencyGraphViewer/DependencyGraphsForm.cs b/src/coreclr/tools/aot/DependencyGraphViewer/DependencyGraphsForm.cs index 835397abd903ad..17d13af0ad8e34 100644 --- a/src/coreclr/tools/aot/DependencyGraphViewer/DependencyGraphsForm.cs +++ b/src/coreclr/tools/aot/DependencyGraphViewer/DependencyGraphsForm.cs @@ -54,7 +54,7 @@ private void help_Click(object sender, EventArgs e) { string helpMessage = @" Dependency Graph Viewer -This application allows viewing the dependency graph produced by the CoreRT compilation. +This application allows viewing the dependency graph produced by the AOT compilation. Usage instructions: 1. Launch the process as an administrator diff --git a/src/coreclr/tools/aot/ILCompiler.Build.Tasks/ComputeManagedAssembliesToCompileToNative.cs b/src/coreclr/tools/aot/ILCompiler.Build.Tasks/ComputeManagedAssembliesToCompileToNative.cs index 741a322594a084..a21d27e277aa10 100644 --- a/src/coreclr/tools/aot/ILCompiler.Build.Tasks/ComputeManagedAssembliesToCompileToNative.cs +++ b/src/coreclr/tools/aot/ILCompiler.Build.Tasks/ComputeManagedAssembliesToCompileToNative.cs @@ -23,7 +23,7 @@ public ITaskItem[] Assemblies } /// - /// The CoreRT-specific System.Private.* assemblies that must be used instead of the netcoreapp2.1 versions. + /// The NativeAOT-specific System.Private.* assemblies that must be used instead of the default CoreCLR versions. /// [Required] public ITaskItem[] SdkAssemblies @@ -33,7 +33,7 @@ public ITaskItem[] SdkAssemblies } /// - /// The set of AOT-specific framework assemblies we currently need to use which will replace the same-named ones + /// The set of NativeAOT-specific framework assemblies we currently need to use which will replace the same-named ones /// in the app's closure. /// [Required] @@ -44,7 +44,7 @@ public ITaskItem[] FrameworkAssemblies } /// - /// The native apphost (whose name ends up colliding with the CoreRT output binary) + /// The native apphost (whose name ends up colliding with the native output binary) /// [Required] public string DotNetAppHostExecutableName @@ -91,16 +91,16 @@ public override bool Execute() { var list = new List(); var assembliesToSkipPublish = new List(); - var coreRTFrameworkAssembliesToUse = new HashSet(); + var nativeAotFrameworkAssembliesToUse = new HashSet(); foreach (ITaskItem taskItem in SdkAssemblies) { - coreRTFrameworkAssembliesToUse.Add(Path.GetFileName(taskItem.ItemSpec)); + nativeAotFrameworkAssembliesToUse.Add(Path.GetFileName(taskItem.ItemSpec)); } foreach (ITaskItem taskItem in FrameworkAssemblies) { - coreRTFrameworkAssembliesToUse.Add(Path.GetFileName(taskItem.ItemSpec)); + nativeAotFrameworkAssembliesToUse.Add(Path.GetFileName(taskItem.ItemSpec)); } foreach (ITaskItem taskItem in Assemblies) @@ -108,7 +108,7 @@ public override bool Execute() // In the case of disk-based assemblies, this holds the file path string itemSpec = taskItem.ItemSpec; - // Skip the native apphost (whose name ends up colliding with the CoreRT output binary) and supporting libraries + // Skip the native apphost (whose name ends up colliding with the native output binary) and supporting libraries if (itemSpec.EndsWith(DotNetAppHostExecutableName, StringComparison.OrdinalIgnoreCase) || itemSpec.Contains(DotNetHostFxrLibraryName) || itemSpec.Contains(DotNetHostPolicyLibraryName)) { assembliesToSkipPublish.Add(taskItem); @@ -143,9 +143,9 @@ public override bool Execute() continue; } - // Remove any assemblies whose implementation we want to come from CoreRT's package. + // Remove any assemblies whose implementation we want to come from NativeAOT's package. // Currently that's System.Private.* SDK assemblies and a bunch of framework assemblies. - if (coreRTFrameworkAssembliesToUse.Contains(assemblyFileName)) + if (nativeAotFrameworkAssembliesToUse.Contains(assemblyFileName)) { assembliesToSkipPublish.Add(taskItem); continue; @@ -166,7 +166,7 @@ public override bool Execute() assembliesToSkipPublish.Add(taskItem); if (culture == "" || culture.Equals("neutral", StringComparison.OrdinalIgnoreCase)) { - // CoreRT doesn't consume resource assemblies yet so skip them + // NativeAOT doesn't consume resource assemblies yet so skip them list.Add(taskItem); } } diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler.Tests/DependencyGraphTests.cs b/src/coreclr/tools/aot/ILCompiler.Compiler.Tests/DependencyGraphTests.cs index 7fe88254c3952a..a4e3ee1ae0df14 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler.Tests/DependencyGraphTests.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler.Tests/DependencyGraphTests.cs @@ -66,7 +66,7 @@ public void TestDependencyGraphInvariants(EcmaMethod method) var context = (CompilerTypeSystemContext)method.Context; CompilationModuleGroup compilationGroup = new SingleFileCompilationModuleGroup(); - CoreRTILProvider ilProvider = new CoreRTILProvider(); + NativeAotILProvider ilProvider = new NativeAotILProvider(); UsageBasedMetadataManager metadataManager = new UsageBasedMetadataManager(compilationGroup, context, new FullyBlockedMetadataBlockingPolicy(), new FullyBlockedManifestResourceBlockingPolicy(), diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerMetadataFieldLayoutAlgorithm.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerMetadataFieldLayoutAlgorithm.cs index 99df8e77fc5a1a..8c0882b08f2317 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerMetadataFieldLayoutAlgorithm.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerMetadataFieldLayoutAlgorithm.cs @@ -37,7 +37,7 @@ protected override void FinalizeRuntimeSpecificStaticFieldLayout(TypeSystemConte layout.ThreadGcStatics.Size = LayoutInt.Zero; } - // CoreRT makes no distinction between Gc / non-Gc thread statics. All are placed into ThreadGcStatics since thread statics + // NativeAOT makes no distinction between Gc / non-Gc thread statics. All are placed into ThreadGcStatics since thread statics // are typically rare. Debug.Assert(layout.ThreadNonGcStatics.Size == LayoutInt.Zero); } diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/EETypeNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/EETypeNode.cs index 24f0da03efd997..906bcc79d2a619 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/EETypeNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/EETypeNode.cs @@ -445,9 +445,9 @@ internal static bool MethodHasNonGenericILMethodBody(MethodDesc method) if (method.IsPInvoke) return false; - // CoreRT can generate method bodies for these no matter what (worst case - // they'll be throwing). We don't want to take the "return false" code path on CoreRT because - // delegate methods fall into the runtime implemented category on CoreRT, but we + // NativeAOT can generate method bodies for these no matter what (worst case + // they'll be throwing). We don't want to take the "return false" code path because + // delegate methods fall into the runtime implemented category on NativeAOT, but we // just treat them like regular method bodies. return true; } diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GCStaticEETypeNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GCStaticEETypeNode.cs index 5186adac0daa8c..653e7c378c8266 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GCStaticEETypeNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GCStaticEETypeNode.cs @@ -67,7 +67,7 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly) dataBuilder.RequireInitialPointerAlignment(); dataBuilder.AddSymbol(this); - // +1 for SyncBlock (in CoreRT static size already includes MethodTable) + // +1 for SyncBlock (static size already includes MethodTable) Debug.Assert(factory.Target.Abi == TargetAbi.NativeAot || factory.Target.Abi == TargetAbi.CppCodegen); int totalSize = (_gcMap.Size + 1) * _target.PointerSize; diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ObjectWriter.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ObjectWriter.cs index 9e5cfcc0ea1086..fc540bf7b09295 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ObjectWriter.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ObjectWriter.cs @@ -71,7 +71,7 @@ public class ObjectWriter : IDisposable, ITypesDebugInfoWriter private readonly bool _isSingleFileCompilation; // Unix section containing LSDA data, like EH Info and GC Info - public static readonly ObjectNodeSection LsdaSection = new ObjectNodeSection(".corert_eh_table", SectionType.ReadOnly); + public static readonly ObjectNodeSection LsdaSection = new ObjectNodeSection(".dotnet_eh_table", SectionType.ReadOnly); private UserDefinedTypeDescriptor _userDefinedTypeDescriptor; diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/ILCompiler.Compiler.csproj b/src/coreclr/tools/aot/ILCompiler.Compiler/ILCompiler.Compiler.csproj index b0ef03d7051be9..dee4e194df86ca 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/ILCompiler.Compiler.csproj +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/ILCompiler.Compiler.csproj @@ -212,8 +212,8 @@ Ecma\EcmaSignatureEncoder.cs - - IL\CoreRTILProvider.cs + + IL\NativeAotILProvider.cs IL\ILImporter.cs @@ -265,7 +265,7 @@ - + diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunCodegenCompilationBuilder.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunCodegenCompilationBuilder.cs index c239f6534a368c..357946bb4870cf 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunCodegenCompilationBuilder.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunCodegenCompilationBuilder.cs @@ -55,7 +55,7 @@ public ReadyToRunCodegenCompilationBuilder( ReadyToRunCompilationModuleGroupBase group, IEnumerable inputFiles, string compositeRootPath) - : base(context, group, new CoreRTNameMangler()) + : base(context, group, new NativeAotNameMangler()) { _inputFiles = inputFiles; _compositeRootPath = compositeRootPath; diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunHashCode.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunHashCode.cs index 9380a829b8f3c9..ff511d98c49f7f 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunHashCode.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunHashCode.cs @@ -30,7 +30,7 @@ public static int NameHashCode(string name) int hash1 = 0x6DA3B944; int hash2 = 0; - // DIFFERENT FROM CORERT: We hash UTF-8 bytes here, while CoreRT hashes UTF-16 characters. + // DIFFERENT FROM NATIVEAOT: We hash UTF-8 bytes here, while NativeAOT hashes UTF-16 characters. byte[] src = Encoding.UTF8.GetBytes(name); for (int i = 0; i < src.Length; i += 2) { @@ -54,7 +54,7 @@ public static int NameHashCode(string name) /// /// Calculate hash code for a namespace - name combination. /// CoreCLR 2-parameter ComputeNameHashCode - /// DIFFERENT FROM CORERT: CoreRT hashes the full name as one string ("namespace.name"), + /// DIFFERENT FROM NATIVEAOT: NativeAOT hashes the full name as one string ("namespace.name"), /// as the full name is already available. In CoreCLR we normally only have separate /// strings for namespace and name, thus we hash them separately. /// @@ -140,8 +140,8 @@ private static int NestedTypeHashCode(int enclosingTypeHashcode, int nestedTypeN /// Array rank private static int ArrayTypeHashCode(int elementTypeHashcode, int rank) { - // DIFFERENT FROM CORERT: This is much simplified compared to CoreRT, to avoid converting rank to string. - // For single-dimensinal array, the result is identical to CoreRT. + // DIFFERENT FROM NATIVEAOT: This is much simplified compared to NativeAOT, to avoid converting rank to string. + // For single-dimensinal array, the result is identical to NativeAOT. int hashCode = unchecked((int)0xd5313556 + rank); if (rank == 1) { diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ILCompiler.ReadyToRun.csproj b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ILCompiler.ReadyToRun.csproj index 6c7d67517a9ee1..3655d355f0c67c 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ILCompiler.ReadyToRun.csproj +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ILCompiler.ReadyToRun.csproj @@ -52,7 +52,7 @@ - + diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ObjectWriter/SectionBuilder.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ObjectWriter/SectionBuilder.cs index 02378eebf555d0..dc34b650f03413 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ObjectWriter/SectionBuilder.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ObjectWriter/SectionBuilder.cs @@ -418,14 +418,14 @@ public void SetWin32Resources(ISymbolNode symbol, int resourcesSize) _win32ResourcesSize = resourcesSize; } - private CoreRTNameMangler _nameMangler; + private NativeAotNameMangler _nameMangler; private NameMangler GetNameMangler() { if (_nameMangler == null) { // TODO-REFACTOR: why do we have two name manglers? - _nameMangler = new CoreRTNameMangler(); + _nameMangler = new NativeAotNameMangler(); _nameMangler.CompilationUnitPrefix = ""; } return _nameMangler; diff --git a/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilationBuilder.cs b/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilationBuilder.cs index a9997a0b04736d..013de73cec569a 100644 --- a/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilationBuilder.cs +++ b/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilationBuilder.cs @@ -20,13 +20,13 @@ public sealed class RyuJitCompilationBuilder : CompilationBuilder // These need to provide reasonable defaults so that the user can optionally skip // calling the Use/Configure methods and still get something reasonable back. private KeyValuePair[] _ryujitOptions = Array.Empty>(); - private ILProvider _ilProvider = new CoreRTILProvider(); + private ILProvider _ilProvider = new NativeAotILProvider(); private ProfileDataManager _profileDataManager; private string _jitPath; public RyuJitCompilationBuilder(CompilerTypeSystemContext context, CompilationModuleGroup group) : base(context, group, - new CoreRTNameMangler(context.Target.IsWindows ? (NodeMangler)new WindowsNodeMangler() : (NodeMangler)new UnixNodeMangler(), false)) + new NativeAotNameMangler(context.Target.IsWindows ? (NodeMangler)new WindowsNodeMangler() : (NodeMangler)new UnixNodeMangler(), false)) { } diff --git a/src/coreclr/tools/aot/ILCompiler.RyuJit/JitInterface/CorInfoImpl.RyuJit.cs b/src/coreclr/tools/aot/ILCompiler.RyuJit/JitInterface/CorInfoImpl.RyuJit.cs index c5e8cedc58bbe0..6c691b46692408 100644 --- a/src/coreclr/tools/aot/ILCompiler.RyuJit/JitInterface/CorInfoImpl.RyuJit.cs +++ b/src/coreclr/tools/aot/ILCompiler.RyuJit/JitInterface/CorInfoImpl.RyuJit.cs @@ -1593,7 +1593,7 @@ private void getCallInfo(ref CORINFO_RESOLVED_TOKEN pResolvedToken, CORINFO_RESO _compilation.NodeFactory.ReadyToRunHelper(helperId, slotDefiningMethod)); } - // The current CoreRT ReadyToRun helpers do not handle null thisptr - ask the JIT to emit explicit null checks + // The current NativeAOT ReadyToRun helpers do not handle null thisptr - ask the JIT to emit explicit null checks // TODO: Optimize this pResult->nullInstanceCheck = true; } diff --git a/src/coreclr/tools/aot/ILCompiler/Program.cs b/src/coreclr/tools/aot/ILCompiler/Program.cs index 4d30c1cd4f564a..760286c0565606 100644 --- a/src/coreclr/tools/aot/ILCompiler/Program.cs +++ b/src/coreclr/tools/aot/ILCompiler/Program.cs @@ -723,7 +723,7 @@ static string ILLinkify(string rootedAssembly) PInvokeILEmitterConfiguration pinvokePolicy = new ConfigurablePInvokePolicy(typeSystemContext.Target, _directPInvokes, _directPInvokeLists); - ILProvider ilProvider = new CoreRTILProvider(); + ILProvider ilProvider = new NativeAotILProvider(); List> featureSwitches = new List>(); foreach (var switchPair in _featureSwitches) diff --git a/src/coreclr/tools/aot/ILCompiler/reproNative/reproNative.vcxproj b/src/coreclr/tools/aot/ILCompiler/reproNative/reproNative.vcxproj index c369a6e279ed44..8e321d59f35ea9 100644 --- a/src/coreclr/tools/aot/ILCompiler/reproNative/reproNative.vcxproj +++ b/src/coreclr/tools/aot/ILCompiler/reproNative/reproNative.vcxproj @@ -129,7 +129,7 @@ - + diff --git a/src/coreclr/tools/aot/jitinterface/jitwrapper.cpp b/src/coreclr/tools/aot/jitinterface/jitwrapper.cpp index cbacd3c190d5ed..c978af57ca2561 100644 --- a/src/coreclr/tools/aot/jitinterface/jitwrapper.cpp +++ b/src/coreclr/tools/aot/jitinterface/jitwrapper.cpp @@ -25,8 +25,6 @@ DLL_EXPORT int JitCompileMethod( if (memcmp(&versionId, &JITEEVersionIdentifier, sizeof(GUID)) != 0) { // JIT and the compiler disagree on how the interface looks like. - // Either get a matching version of the JIT from the CoreCLR repo or update the interface - // on the CoreRT side. Under no circumstances should you comment this line out. return 1; } diff --git a/src/coreclr/tools/r2rtest/PathHelpers.cs b/src/coreclr/tools/r2rtest/PathHelpers.cs index d180032d3dcbb0..6b2fd106aa27ce 100644 --- a/src/coreclr/tools/r2rtest/PathHelpers.cs +++ b/src/coreclr/tools/r2rtest/PathHelpers.cs @@ -58,7 +58,7 @@ internal static string ConcatenatePaths(this IEnumerable paths) return string.Join(Path.PathSeparator, paths); } - // TODO: this assumes we're running tests from the CoreRT root + // TODO: this assumes we're running tests from the root internal static string DotNetAppPath => RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "dotnet" : "Tools/dotnetcli/dotnet"; internal static void RecreateDirectory(this string path) diff --git a/src/coreclr/vm/jitinterface.cpp b/src/coreclr/vm/jitinterface.cpp index e73be506760d55..6b50ad36205eab 100644 --- a/src/coreclr/vm/jitinterface.cpp +++ b/src/coreclr/vm/jitinterface.cpp @@ -8781,7 +8781,7 @@ void CEEInfo::expandRawHandleIntrinsic( CORINFO_GENERICHANDLE_RESULT * pResult) { LIMITED_METHOD_CONTRACT; - UNREACHABLE(); // only called with CoreRT. + UNREACHABLE(); // only called with NativeAOT. } /*********************************************************************/ diff --git a/src/coreclr/vm/typehashingalgorithms.h b/src/coreclr/vm/typehashingalgorithms.h index 76e82bb8f7ede6..fc428c1ef3de6a 100644 --- a/src/coreclr/vm/typehashingalgorithms.h +++ b/src/coreclr/vm/typehashingalgorithms.h @@ -21,7 +21,7 @@ inline static int ComputeNameHashCode(LPCUTF8 src) int hash1 = 0x6DA3B944; int hash2 = 0; - // DIFFERENT FROM CORERT: We hash UTF-8 bytes here, while CoreRT hashes UTF-16 characters. + // DIFFERENT FROM NATIVEAOT: We hash UTF-8 bytes here, while NativeAOT hashes UTF-16 characters. for (COUNT_T i = 0; src[i] != '\0'; i += 2) { @@ -42,7 +42,7 @@ inline static int ComputeNameHashCode(LPCUTF8 pszNamespace, LPCUTF8 pszName) { LIMITED_METHOD_CONTRACT; - // DIFFERENT FROM CORERT: CoreRT hashes the full name as one string ("namespace.name"), + // DIFFERENT FROM NATIVEAOT: NativeAOT hashes the full name as one string ("namespace.name"), // as the full name is already available. In CoreCLR we normally only have separate // strings for namespace and name, thus we hash them separately. return ComputeNameHashCode(pszNamespace) ^ ComputeNameHashCode(pszName); @@ -52,8 +52,8 @@ inline static int ComputeArrayTypeHashCode(int elementTypeHashcode, int rank) { LIMITED_METHOD_CONTRACT; - // DIFFERENT FROM CORERT: This is much simplified compared to CoreRT, to avoid converting.rank to string. - // For single-dimensinal array, the result is identical to CoreRT. + // DIFFERENT FROM NATIVEAOT: This is much simplified compared to NativeAOT, to avoid converting.rank to string. + // For single-dimensinal array, the result is identical to NativeAOT. int hashCode = 0xd5313556 + rank; if (rank == 1) _ASSERTE(hashCode == ComputeNameHashCode("System.Array`1")); diff --git a/src/libraries/Common/src/System/Text/StringBuilderCache.cs b/src/libraries/Common/src/System/Text/StringBuilderCache.cs index 2f380dc5eb9ea2..9bcf4f0696c0b1 100644 --- a/src/libraries/Common/src/System/Text/StringBuilderCache.cs +++ b/src/libraries/Common/src/System/Text/StringBuilderCache.cs @@ -12,10 +12,6 @@ internal static class StringBuilderCache internal const int MaxBuilderSize = 360; private const int DefaultCapacity = 16; // == StringBuilder.DefaultCapacity - // WARNING: We allow diagnostic tools to directly inspect this member (t_cachedInstance). - // See https://github.com/dotnet/corert/blob/master/Documentation/design-docs/diagnostics/diagnostics-tools-contract.md for more details. - // Please do not change the type, the name, or the semantic usage of this member without understanding the implication for tools. - // Get in touch with the diagnostics team if you have questions. [ThreadStatic] private static StringBuilder? t_cachedInstance; diff --git a/src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props b/src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props index ba746b93e775bb..c9d93d31311609 100644 --- a/src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props +++ b/src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props @@ -269,7 +269,7 @@ x64;x86;arm;arm64 7;8;81;10 - + diff --git a/src/libraries/System.Collections.Immutable/src/MembersMustExist.AnalyzerData b/src/libraries/System.Collections.Immutable/src/MembersMustExist.AnalyzerData deleted file mode 100644 index 06a66d50e6fff8..00000000000000 --- a/src/libraries/System.Collections.Immutable/src/MembersMustExist.AnalyzerData +++ /dev/null @@ -1 +0,0 @@ -internal static System.Collections.Generic.Dictionary System.Collections.Immutable.AllocFreeConcurrentStack.t_stacks \ No newline at end of file diff --git a/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/AllocFreeConcurrentStack.cs b/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/AllocFreeConcurrentStack.cs index e44135512ed8e5..503ea3708f5d15 100644 --- a/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/AllocFreeConcurrentStack.cs +++ b/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/AllocFreeConcurrentStack.cs @@ -9,13 +9,28 @@ namespace System.Collections.Immutable internal static class AllocFreeConcurrentStack { private const int MaxSize = 35; + +#if NETCOREAPP + [ThreadStatic] + private static Stack>? t_stack; +#else private static readonly Type s_typeOfT = typeof(T); +#endif public static void TryAdd(T item) { +#if NETCOREAPP + Stack>? localStack = t_stack; // cache in a local to avoid unnecessary TLS hits on repeated accesses + if (localStack == null) + { + t_stack = localStack = new Stack>(MaxSize); + } +#else + Stack> localStack = ThreadLocalStack; +#endif + // Just in case we're in a scenario where an object is continually requested on one thread // and returned on another, avoid unbounded growth of the stack. - Stack> localStack = ThreadLocalStack; if (localStack.Count < MaxSize) { localStack.Push(new RefAsValueType(item)); @@ -24,7 +39,11 @@ public static void TryAdd(T item) public static bool TryTake([MaybeNullWhen(false)] out T item) { +#if NETCOREAPP + Stack>? localStack = t_stack; // cache in a local to avoid unnecessary TLS hits on repeated accesses +#else Stack> localStack = ThreadLocalStack; +#endif if (localStack != null && localStack.Count > 0) { item = localStack.Pop().Value; @@ -35,6 +54,7 @@ public static bool TryTake([MaybeNullWhen(false)] out T item) return false; } +#if !NETCOREAPP private static Stack> ThreadLocalStack { get @@ -57,19 +77,15 @@ private static Stack> ThreadLocalStack return (Stack>)stackObj; } } +#endif } +#if !NETCOREAPP internal static class AllocFreeConcurrentStack { - // WARNING: We allow diagnostic tools to directly inspect this member (t_stacks). - // See https://github.com/dotnet/corert/blob/master/Documentation/design-docs/diagnostics/diagnostics-tools-contract.md for more details. - // Please do not change the type, the name, or the semantic usage of this member without understanding the implication for tools. - // Get in touch with the diagnostics team if you have questions. - // Workaround for https://github.com/dotnet/runtime/issues/4731. - // When that's fixed, a [ThreadStatic] Stack should be added back to AllocFreeConcurrentStack. - [ThreadStatic] internal static Dictionary? t_stacks; } +#endif } diff --git a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/TraceLogging/PropertyValue.cs b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/TraceLogging/PropertyValue.cs index 6d94b161d040be..d621a371279492 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/TraceLogging/PropertyValue.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/TraceLogging/PropertyValue.cs @@ -23,7 +23,7 @@ namespace System.Diagnostics.Tracing /// #if NATIVEAOT [CLSCompliant(false)] - public // On CoreRT, this must be public to prevent it from getting reflection blocked. + public // On NativeAOT, this must be public to prevent it from getting reflection blocked. #else internal #endif @@ -213,7 +213,7 @@ private static Func GetReferenceTypePropertyGetter } #if NATIVEAOT - public // On CoreRT, this must be public to prevent it from getting reflection blocked. + public // On NativeAOT, this must be public to prevent it from getting reflection blocked. #else private #endif @@ -232,7 +232,7 @@ protected static Delegate GetGetMethod(PropertyInfo property, Type propertyType) } #if NATIVEAOT - public // On CoreRT, this must be public to prevent it from getting reflection blocked. + public // On NativeAOT, this must be public to prevent it from getting reflection blocked. #else private #endif diff --git a/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureInfo.cs b/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureInfo.cs index 3b73e45d77ef82..e9de8a6b8a95ea 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureInfo.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureInfo.cs @@ -101,11 +101,6 @@ public partial class CultureInfo : IFormatProvider, ICloneable // The culture used in the user interface. This is mostly used to load correct localized resources. private static volatile CultureInfo? s_userDefaultUICulture; - // WARNING: We allow diagnostic tools to directly inspect these three members (s_InvariantCultureInfo, s_DefaultThreadCurrentUICulture and s_DefaultThreadCurrentCulture) - // See https://github.com/dotnet/corert/blob/master/Documentation/design-docs/diagnostics/diagnostics-tools-contract.md for more details. - // Please do not change the type, the name, or the semantic usage of this member without understanding the implication for tools. - // Get in touch with the diagnostics team if you have questions. - // The Invariant culture; private static readonly CultureInfo s_InvariantCultureInfo = new CultureInfo(CultureData.Invariant, isReadOnly: true); diff --git a/src/libraries/System.Private.CoreLib/src/System/IntPtr.cs b/src/libraries/System.Private.CoreLib/src/System/IntPtr.cs index 7ca4991bfba385..0375302cba5a73 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IntPtr.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IntPtr.cs @@ -34,10 +34,6 @@ public readonly struct IntPtr IMinMaxValue, ISignedNumber { - // WARNING: We allow diagnostic tools to directly inspect this member (_value). - // See https://github.com/dotnet/corert/blob/master/Documentation/design-docs/diagnostics/diagnostics-tools-contract.md for more details. - // Please do not change the type, the name, or the semantic usage of this member without understanding the implication for tools. - // Get in touch with the diagnostics team if you have questions. private readonly unsafe void* _value; // Do not rename (binary serialization) [Intrinsic] diff --git a/src/libraries/System.Private.CoreLib/src/System/Reflection/Module.cs b/src/libraries/System.Private.CoreLib/src/System/Reflection/Module.cs index 4db2512f9861ec..08b077c1dd92fa 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Reflection/Module.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Reflection/Module.cs @@ -24,7 +24,7 @@ protected Module() { } public virtual Guid ModuleVersionId => throw NotImplemented.ByDesign; public virtual string ScopeName => throw NotImplemented.ByDesign; public ModuleHandle ModuleHandle => GetModuleHandleImpl(); - protected virtual ModuleHandle GetModuleHandleImpl() => ModuleHandle.EmptyHandle; // Not an api but declared protected because of Reflection.Core/Corelib divide (when built by CoreRt) + protected virtual ModuleHandle GetModuleHandleImpl() => ModuleHandle.EmptyHandle; // Not an api but declared protected because of Reflection.Core/Corelib divide (when built by NativeAOT) public virtual void GetPEKind(out PortableExecutableKinds peKind, out ImageFileMachine machine) { throw NotImplemented.ByDesign; } public virtual bool IsResource() { throw NotImplemented.ByDesign; } diff --git a/src/libraries/System.Private.CoreLib/src/System/Resources/RuntimeResourceSet.cs b/src/libraries/System.Private.CoreLib/src/System/Resources/RuntimeResourceSet.cs index d275b013297cc4..5d442cb7692153 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Resources/RuntimeResourceSet.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Resources/RuntimeResourceSet.cs @@ -151,7 +151,7 @@ namespace System.Resources // resource files containing thousands of resources. // #if NATIVEAOT - public // On CoreRT, this must be public to prevent it from getting reflection blocked. + public // On NativeAOT, this must be public to prevent it from getting reflection blocked. #else internal #endif diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/Unsafe.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/Unsafe.cs index 4d9169389d5cea..2c17b9f4ca3d3c 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/Unsafe.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/Unsafe.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#pragma warning disable IDE0060 // implementations provided by the JIT +#pragma warning disable IDE0060 // implementations provided as intrinsics using System; using System.Diagnostics.CodeAnalysis; using System.Runtime.Versioning; @@ -9,7 +9,7 @@ // // The implementations of most the methods in this file are provided as intrinsics. // In CoreCLR, the body of the functions are replaced by the EE with unsafe code. See see getILIntrinsicImplementationForUnsafe for details. -// In CoreRT, see Internal.IL.Stubs.UnsafeIntrinsics for details. +// In AOT compilers, see Internal.IL.Stubs.UnsafeIntrinsics for details. // namespace System.Runtime.CompilerServices @@ -24,7 +24,7 @@ public static unsafe partial class Unsafe /// [Intrinsic] // CoreCLR:METHOD__UNSAFE__AS_POINTER - // CG2:AsPointer + // AOT:AsPointer // Mono:AsPointer [NonVersionable] [CLSCompliant(false)] @@ -43,7 +43,7 @@ public static unsafe partial class Unsafe /// [Intrinsic] // CoreCLR:METHOD__UNSAFE__SIZEOF - // CG2:SizeOf + // AOT:SizeOf // Mono:SizeOf [NonVersionable] [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -63,7 +63,7 @@ public static int SizeOf() /// [Intrinsic] // CoreCLR:METHOD__UNSAFE__OBJECT_AS - // CG2:As + // AOT:As // Mono:As [NonVersionable] [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -81,7 +81,7 @@ public static T As(object? o) where T : class? /// [Intrinsic] // CoreCLR:METHOD__UNSAFE__BYREF_AS - // CG2:As + // AOT:As // Mono:As [NonVersionable] [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -98,7 +98,7 @@ public static ref TTo As(ref TFrom source) /// [Intrinsic] // CoreCLR:METHOD__UNSAFE__BYREF_ADD - // CG2:Add + // AOT:Add // Mono:Add [NonVersionable] [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -124,7 +124,7 @@ public static ref T Add(ref T source, int elementOffset) /// [Intrinsic] // CoreCLR:METHOD__UNSAFE__BYREF_INTPTR_ADD - // CG2:Add + // AOT:Add // Mono:Add [NonVersionable] [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -150,7 +150,7 @@ public static ref T Add(ref T source, IntPtr elementOffset) /// [Intrinsic] // CoreCLR:METHOD__UNSAFE__PTR_ADD - // CG2:Add + // AOT:Add // Mono:Add [NonVersionable] [CLSCompliant(false)] @@ -203,7 +203,7 @@ public static ref T Add(ref T source, nuint elementOffset) /// [Intrinsic] // CoreCLR:METHOD__UNSAFE__BYREF_ADD_BYTE_OFFSET_UINTPTR - // CG2:AddByteOffset + // AOT:AddByteOffset // Mono:AddByteOffset [NonVersionable] [CLSCompliant(false)] @@ -228,7 +228,7 @@ public static ref T AddByteOffset(ref T source, nuint byteOffset) /// [Intrinsic] // CoreCLR:METHOD__UNSAFE__BYREF_ARE_SAME - // CG2:AreSame + // AOT:AreSame // Mono:AreSame [NonVersionable] [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -367,7 +367,7 @@ public static void CopyBlockUnaligned(ref byte destination, ref byte source, uin /// [Intrinsic] // CoreCLR:CoreCLR:METHOD__UNSAFE__BYREF_IS_ADDRESS_GREATER_THAN - // CG2:IsAddressGreaterThan + // AOT:IsAddressGreaterThan // Mono:IsAddressGreaterThan [NonVersionable] [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -390,7 +390,7 @@ public static bool IsAddressGreaterThan([AllowNull] ref T left, [AllowNull] r /// [Intrinsic] // CoreCLR:METHOD__UNSAFE__BYREF_IS_ADDRESS_LESS_THAN - // CG2:IsAddressLessThan + // AOT:IsAddressLessThan // Mono:IsAddressLessThan [NonVersionable] [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -469,7 +469,7 @@ public static void InitBlockUnaligned(void* startAddress, byte value, uint byteC /// [Intrinsic] // CoreCLR:METHOD__UNSAFE__BYREF_INIT_BLOCK_UNALIGNED - // CG2:InitBlockUnaligned + // AOT:InitBlockUnaligned // Mono:InitBlockUnaligned [NonVersionable] [CLSCompliant(false)] @@ -494,7 +494,7 @@ public static void InitBlockUnaligned(ref byte startAddress, byte value, uint by /// [Intrinsic] // CoreCLR:METHOD__UNSAFE__PTR_READ_UNALIGNED - // CG2:ReadUnaligned + // AOT:ReadUnaligned // Mono:ReadUnaligned [NonVersionable] [CLSCompliant(false)] @@ -519,7 +519,7 @@ public static T ReadUnaligned(void* source) /// [Intrinsic] // CoreCLR:METHOD__UNSAFE__BYREF_READ_UNALIGNED - // CG2:ReadUnaligned + // AOT:ReadUnaligned // Mono:ReadUnaligned [NonVersionable] [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -543,7 +543,7 @@ public static T ReadUnaligned(ref byte source) /// [Intrinsic] // CoreCLR:METHOD__UNSAFE__PTR_WRITE_UNALIGNED - // CG2:WriteUnaligned + // AOT:WriteUnaligned // Mono:WriteUnaligned [NonVersionable] [CLSCompliant(false)] @@ -569,7 +569,7 @@ public static void WriteUnaligned(void* destination, T value) /// [Intrinsic] // CoreCLR:METHOD__UNSAFE__BYREF_WRITE_UNALIGNED - // CG2:WriteUnaligned + // AOT:WriteUnaligned // Mono:WriteUnaligned [NonVersionable] [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -594,7 +594,7 @@ public static void WriteUnaligned(ref byte destination, T value) /// [Intrinsic] // CoreCLR:METHOD__UNSAFE__BYREF_ADD_BYTE_OFFSET_INTPTR - // CG2:AddByteOffset + // AOT:AddByteOffset // Mono:AddByteOffset [NonVersionable] [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -613,7 +613,7 @@ public static ref T AddByteOffset(ref T source, IntPtr byteOffset) /// Reads a value of type from the given location. /// //[Intrinsic] - // CG2:Read + // AOT:Read [NonVersionable] [CLSCompliant(false)] [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -630,7 +630,7 @@ public static T Read(void* source) /// Writes a value of type to the given location. /// //[Intrinsic] - // CG2:Write + // AOT:Write [NonVersionable] [CLSCompliant(false)] [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -649,7 +649,7 @@ public static void Write(void* destination, T value) /// [Intrinsic] // CoreCLR:METHOD__UNSAFE__AS_REF_POINTER - // CG2:AsRef + // AOT:AsRef // Mono:AsRef [NonVersionable] [CLSCompliant(false)] @@ -667,7 +667,7 @@ public static ref T AsRef(void* source) /// [Intrinsic] // CoreCLR:METHOD__UNSAFE__AS_REF_IN - // CG2:AsRef + // AOT:AsRef // Mono:AsRef [NonVersionable] [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -684,7 +684,7 @@ public static ref T AsRef(in T source) /// [Intrinsic] // CoreCLR:METHOD__UNSAFE__BYREF_BYTE_OFFSET - // CG2:ByteOffset + // AOT:ByteOffset // Mono:ByteOffset [NonVersionable] [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -703,7 +703,7 @@ public static IntPtr ByteOffset([AllowNull] ref T origin, [AllowNull] ref T t /// [Intrinsic] // CoreCLR:METHOD__UNSAFE__BYREF_NULLREF - // CG2:NullRef + // AOT:NullRef [NonVersionable] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static ref T NullRef() @@ -723,7 +723,7 @@ public static ref T NullRef() /// [Intrinsic] // CoreCLR:METHOD__UNSAFE__BYREF_IS_NULL - // CG2: IsNullRef + // AOT: IsNullRef [NonVersionable] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool IsNullRef(ref T source) @@ -742,7 +742,7 @@ public static bool IsNullRef(ref T source) /// [Intrinsic] // CoreCLR:METHOD__UNSAFE__SKIPINIT - // CG2:SkipInit + // AOT:SkipInit // Mono:SkipInit [NonVersionable] [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/SafeHandle.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/SafeHandle.cs index 9f9dc7ae2870bd..aa4534afcb11a1 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/SafeHandle.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/SafeHandle.cs @@ -64,7 +64,7 @@ protected SafeHandle(IntPtr invalidHandleValue, bool ownsHandle) _fullyInitialized = true; } -#if !NATIVEAOT // CoreRT doesn't correctly support CriticalFinalizerObject +#if !NATIVEAOT // NativeAOT doesn't correctly support CriticalFinalizerObject ~SafeHandle() { if (_fullyInitialized) diff --git a/src/libraries/System.Reflection/tests/MemberInfoTests.cs b/src/libraries/System.Reflection/tests/MemberInfoTests.cs index a6cee62dfb0887..24840125e51e43 100644 --- a/src/libraries/System.Reflection/tests/MemberInfoTests.cs +++ b/src/libraries/System.Reflection/tests/MemberInfoTests.cs @@ -363,7 +363,7 @@ public static void HasSameMetadataDefinitionAs_GenericTypeParameters() [Fact] public static void HasSameMetadataDefinitionAs_Twins() { - // This situation is particularly treacherous for CoreRT as the .NET Native toolchain can and does assign + // This situation is particularly treacherous for NativeAOT as the toolchain can and does assign // the same native metadata tokens to identically structured members in unrelated types. Type twin1 = typeof(Twin1); Type twin2 = typeof(Twin2); diff --git a/src/libraries/System.Runtime/tests/System/GCTests.cs b/src/libraries/System.Runtime/tests/System/GCTests.cs index d4e6b5e09f7c2a..4faaa1d94e6ea4 100644 --- a/src/libraries/System.Runtime/tests/System/GCTests.cs +++ b/src/libraries/System.Runtime/tests/System/GCTests.cs @@ -449,9 +449,8 @@ public class GCExtendedTests /// /// NoGC regions will be automatically exited if more than the requested budget /// is allocated while still in the region. In order to avoid this, the budget is set - /// to be higher than what the test should be allocating. When running on CoreCLR/DesktopCLR, - /// these tests generally do not allocate because they are implemented as fcalls into the runtime - /// itself, but the CoreRT runtime is written in mostly managed code and tends to allocate more. + /// to be higher than what the test should be allocating to compensate for allocations + /// made internally by the runtime. /// /// This budget should be high enough to avoid exiting no-gc regions when doing normal unit /// tests, regardless of the runtime. @@ -637,8 +636,7 @@ public static void TryStartNoGCRegion_SettingLatencyMode_ThrowsInvalidOperationE RemoteExecutor.Invoke(() => { // The budget for this test is 4mb, because the act of throwing an exception with a message - // contained in a resource file has to potential to allocate a lot on CoreRT. In particular, when compiling - // in multi-file mode, this will trigger a resource lookup in System.Private.CoreLib. + // contained in a System.Private.CoreLib resource file has to potential to allocate a lot. // // In addition to this, the Assert.Throws xunit combinator tends to also allocate a lot. Assert.True(GC.TryStartNoGCRegion(4000 * 1024, true)); diff --git a/src/libraries/System.Threading.ThreadPool/tests/ThreadPoolTests.cs b/src/libraries/System.Threading.ThreadPool/tests/ThreadPoolTests.cs index 2510a74f9d3f5f..9c6b06e32278ea 100644 --- a/src/libraries/System.Threading.ThreadPool/tests/ThreadPoolTests.cs +++ b/src/libraries/System.Threading.ThreadPool/tests/ThreadPoolTests.cs @@ -827,7 +827,6 @@ public static void SettingMinWorkerThreadsWillCreateThreadsUpToMinimum() }).Dispose(); } - // See https://github.com/dotnet/corert/pull/6822 [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] public static void ThreadPoolCanProcessManyWorkItemsInParallelWithoutDeadlocking() { diff --git a/src/mono/System.Private.CoreLib/src/System/Threading/Overlapped.cs b/src/mono/System.Private.CoreLib/src/System/Threading/Overlapped.cs index 56709ae168a184..602c2c27bcaeac 100644 --- a/src/mono/System.Private.CoreLib/src/System/Threading/Overlapped.cs +++ b/src/mono/System.Private.CoreLib/src/System/Threading/Overlapped.cs @@ -84,8 +84,7 @@ internal sealed unsafe class OverlappedData } } - //CORERT: NativeOverlapped* pNativeOverlapped = (NativeOverlapped*)Interop.MemAlloc((UIntPtr)(sizeof(NativeOverlapped) + sizeof(GCHandle))); - NativeOverlapped* pNativeOverlapped = (NativeOverlapped*)Marshal.AllocHGlobal((IntPtr)(sizeof(NativeOverlapped) + sizeof(GCHandle))); + NativeOverlapped* pNativeOverlapped = (NativeOverlapped*)NativeMemory.Alloc((nuint)(sizeof(NativeOverlapped) + sizeof(GCHandle))); *(GCHandle*)(pNativeOverlapped + 1) = default; _pNativeOverlapped = pNativeOverlapped; @@ -138,8 +137,7 @@ private void FreeNativeOverlapped() if (handle.IsAllocated) handle.Free(); - Marshal.FreeHGlobal((IntPtr)_pNativeOverlapped); - //CORERT: Interop.MemFree((IntPtr)_pNativeOverlapped); + NativeMemory.Free(_pNativeOverlapped); _pNativeOverlapped = null; } } diff --git a/src/tests/baseservices/threading/regressions/2164/foreground-shutdown.cs b/src/tests/baseservices/threading/regressions/2164/foreground-shutdown.cs index bba3f1151d02d7..3e1670dae7a6a3 100644 --- a/src/tests/baseservices/threading/regressions/2164/foreground-shutdown.cs +++ b/src/tests/baseservices/threading/regressions/2164/foreground-shutdown.cs @@ -10,11 +10,6 @@ * Issue description: Running foreground threads do not prevent runtime shutdown on return from main - -Change description: - For CoreCLR: introduce BOOL waitForOtherThreads parameter - to Assembly::ExecuteMainMethod and exit conditionally; - For CoreRT aka NativeAOT: implement missing logic */ public class Test_foreground_shutdown diff --git a/src/tests/nativeaot/SmokeTests/SharedLibrary/SharedLibrary.cpp b/src/tests/nativeaot/SmokeTests/SharedLibrary/SharedLibrary.cpp index b519ecd3de460b..331011165d54cd 100644 --- a/src/tests/nativeaot/SmokeTests/SharedLibrary/SharedLibrary.cpp +++ b/src/tests/nativeaot/SmokeTests/SharedLibrary/SharedLibrary.cpp @@ -71,7 +71,7 @@ int main(int argc, char* argv[]) if (checkSimpleExceptionHandling() != 100) return 5; - // CoreRT is not designed to be unloadable, so this won't actually unload the library properly. Verify that attempt + // NativeAOT is not designed to be unloadable, so this won't actually unload the library properly. Verify that attempt // to unload the library does not to crash at least. #ifdef TARGET_WINDOWS FreeLibrary(handle); diff --git a/src/tests/nativeaot/SmokeTests/UnitTests/BasicThreading.cs b/src/tests/nativeaot/SmokeTests/UnitTests/BasicThreading.cs index 7405e2a9655ebf..57964b6dead0a7 100644 --- a/src/tests/nativeaot/SmokeTests/UnitTests/BasicThreading.cs +++ b/src/tests/nativeaot/SmokeTests/UnitTests/BasicThreading.cs @@ -263,7 +263,7 @@ private static void TestStartMethod() s_startedThreads.Add(t4); // Start an unstarted resurrected thread. - // CoreCLR: ThreadStateException, CoreRT: no exception. + // CoreCLR: ThreadStateException, NativeAOT: no exception. Thread unstartedResurrected = Resurrector.CreateUnstartedResurrected(); unstartedResurrected.Start(); s_startedThreads.Add(unstartedResurrected); diff --git a/src/tests/readytorun/crossgen2/Program.cs b/src/tests/readytorun/crossgen2/Program.cs index b0c011e5b94a83..0af11e890ed390 100644 --- a/src/tests/readytorun/crossgen2/Program.cs +++ b/src/tests/readytorun/crossgen2/Program.cs @@ -43,7 +43,7 @@ private static bool NewString() private static bool WriteLine() { - Console.WriteLine("Hello CoreRT R2R running on CoreCLR!"); + Console.WriteLine("Hello R2R running on CoreCLR!"); return true; } diff --git a/src/tests/readytorun/tests/generics.cs b/src/tests/readytorun/tests/generics.cs index fe1b5e7d588df4..c005b33ba218d7 100644 --- a/src/tests/readytorun/tests/generics.cs +++ b/src/tests/readytorun/tests/generics.cs @@ -1147,7 +1147,7 @@ public static void Run() Verify("DerivedClass2.GVMethod3", gvm3.Invoke(new DerivedClass2(), new[] { "", "" })); Verify("DerivedClass2.GVMethod4", gvm4.Invoke(new DerivedClass2(), new[] { "", "" })); - // BaseClass.Method1 has the same slot as BaseClass.Method3 on CoreRT, because vtable entries + // BaseClass.Method1 has the same slot as BaseClass.Method3 on NativeAOT, because vtable entries // get populated on demand (the first type won't get a Method3 entry, and the latter won't get a Method1 entry) new BaseClass().Method1(1); m1 = typeof(BaseClass).GetMethod("Method1");