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 @@
-
+
RunResolvePackageDependenciesImportRuntimeIlcPackageTargetSetupProperties
-
+
-
-
+
+
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