Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/coreclr/gc/gcimpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ class GCHeap : public IGCHeapInternal
//return TRUE if GC actually happens, otherwise FALSE
bool StressHeap(gc_alloc_context * acontext);

#ifndef FEATURE_NATIVEAOT // Redhawk forces relocation a different way
#ifndef FEATURE_NATIVEAOT // NativeAOT forces relocation a different way
#ifdef STRESS_HEAP
protected:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -444,9 +444,9 @@ public static Exception GetRuntimeException(ExceptionIDs id)

private enum HwExceptionCode : uint
{
STATUS_REDHAWK_NULL_REFERENCE = 0x00000000u,
STATUS_REDHAWK_UNMANAGED_HELPER_NULL_REFERENCE = 0x00000042u,
STATUS_REDHAWK_THREAD_ABORT = 0x00000043u,
STATUS_NATIVEAOT_NULL_REFERENCE = 0x00000000u,
STATUS_NATIVEAOT_UNMANAGED_HELPER_NULL_REFERENCE = 0x00000042u,
STATUS_NATIVEAOT_THREAD_ABORT = 0x00000043u,

STATUS_DATATYPE_MISALIGNMENT = 0x80000002u,
STATUS_ACCESS_VIOLATION = 0xC0000005u,
Expand Down Expand Up @@ -574,11 +574,11 @@ public static void RhThrowHwEx(uint exceptionCode, ref ExInfo exInfo)

switch (exceptionCode)
{
case (uint)HwExceptionCode.STATUS_REDHAWK_NULL_REFERENCE:
case (uint)HwExceptionCode.STATUS_NATIVEAOT_NULL_REFERENCE:
exceptionId = ExceptionIDs.NullReference;
break;

case (uint)HwExceptionCode.STATUS_REDHAWK_UNMANAGED_HELPER_NULL_REFERENCE:
case (uint)HwExceptionCode.STATUS_NATIVEAOT_UNMANAGED_HELPER_NULL_REFERENCE:
// The write barrier where the actual fault happened has been unwound already.
// The IP of this fault needs to be treated as return address, not as IP of
// faulting instruction.
Expand All @@ -587,7 +587,7 @@ public static void RhThrowHwEx(uint exceptionCode, ref ExInfo exInfo)
break;

#if NATIVEAOT
case (uint)HwExceptionCode.STATUS_REDHAWK_THREAD_ABORT:
case (uint)HwExceptionCode.STATUS_NATIVEAOT_THREAD_ABORT:
exceptionToThrow = InternalCalls.RhpGetThreadAbortException();
break;
#endif
Expand All @@ -597,7 +597,7 @@ public static void RhThrowHwEx(uint exceptionCode, ref ExInfo exInfo)
break;

// N.B. -- AVs that have a read/write address lower than 64k are already transformed to
// HwExceptionCode.REDHAWK_NULL_REFERENCE prior to calling this routine.
// HwExceptionCode.STATUS_NATIVEAOT_NULL_REFERENCE prior to calling this routine.
case (uint)HwExceptionCode.STATUS_ACCESS_VIOLATION:
exceptionId = ExceptionIDs.AccessViolation;
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static void Initialize()
// drop the first element
Head = Head.Next;

// notify redhawku.dll
// notify the runtime
InternalCalls.RhpInitializeGcStress();
#endif // FEATURE_GC_STRESS
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace System.Runtime.InteropServices
{
// Not used in Redhawk. Only here as C# compiler requires it
// Only here as C# compiler requires it
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
internal sealed class OutAttribute : Attribute
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -789,27 +789,12 @@ public static unsafe void StelemRef(object?[] array, nint index, object? obj)
// This is supported only on arrays
Debug.Assert(array is null || array.GetMethodTable()->IsArray, "first argument must be an array");

#if INPLACE_RUNTIME
// This will throw NullReferenceException if obj is null.
if ((nuint)index >= (uint)array.Length)
ThrowIndexOutOfRangeException(array);

Debug.Assert(index >= 0);
ref object? element = ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), index);
#else
if (array is null)
{
// TODO: If both array and obj are null, we're likely going to throw Redhawk's NullReferenceException.
// This should blame the caller.
throw obj.GetMethodTable()->GetClasslibException(ExceptionIDs.NullReference);
}
if ((uint)index >= (uint)array.Length)
{
throw array.GetMethodTable()->GetClasslibException(ExceptionIDs.IndexOutOfRange);
}
ref object rawData = ref Unsafe.As<byte, object>(ref Unsafe.As<RawArrayData>(array).Data);
ref object element = ref Unsafe.Add(ref rawData, index);
#endif

MethodTable* elementType = array.GetMethodTable()->RelatedParameterType;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using System.Runtime.InteropServices;

//
// Implements the single finalizer thread for a Redhawk instance. Essentially waits for an event to fire
// Implements the single finalizer thread for a NativeAOT instance. Essentially waits for an event to fire
// indicating finalization is necessary then drains the queue of pending finalizable objects, calling the
// finalize method for each one.
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.

// System.Type and System.RuntimeTypeHandle are defined here as the C# compiler requires them
// In the redhawk runtime these are not used. In the class library there is an implementation that support typeof

using System;
using System.Runtime.CompilerServices;
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/nativeaot/Runtime/AsmOffsetsVerify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include "gcenv.h"
#include "gcheaputilities.h"
#include "rhassert.h"
#include "RedhawkWarnings.h"
#include "slist.h"
#include "regdisplay.h"
#include "StackFrameIterator.h"
Expand Down
6 changes: 3 additions & 3 deletions src/coreclr/nativeaot/Runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ if (WIN32)
include_directories(windows)

list(APPEND COMMON_RUNTIME_SOURCES
windows/PalRedhawkCommon.cpp
windows/PalRedhawkMinWin.cpp
windows/PalCommon.cpp
windows/PalMinWin.cpp
${GC_DIR}/windows/gcenv.windows.cpp
)

Expand Down Expand Up @@ -155,7 +155,7 @@ else()
endif()

list(APPEND COMMON_RUNTIME_SOURCES
unix/PalRedhawkUnix.cpp
unix/PalUnix.cpp
unix/PalCreateDump.cpp
${GC_DIR}/unix/gcenv.unix.cpp
${GC_DIR}/unix/numasupport.cpp
Expand Down
5 changes: 2 additions & 3 deletions src/coreclr/nativeaot/Runtime/CachedInterfaceDispatchPal.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@
#include "CommonMacros.h"
#include "daccess.h"
#include "DebugMacrosExt.h"
#include "PalRedhawkCommon.h"
#include "PalRedhawk.h"
#include "PalLimitedContext.h"
#include "Pal.h"
#include "rhassert.h"
#include "slist.h"
#include "holder.h"
#include "Crst.h"
#include "RedhawkWarnings.h"
#include "TargetPtrs.h"
#include "MethodTable.h"
#include "Range.h"
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/nativeaot/Runtime/Crst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#include "common.h"
#include "CommonTypes.h"
#include "CommonMacros.h"
#include "PalRedhawkCommon.h"
#include "PalRedhawk.h"
#include "PalLimitedContext.h"
#include "Pal.h"
#include "holder.h"
#include "Crst.h"

Expand Down
6 changes: 3 additions & 3 deletions src/coreclr/nativeaot/Runtime/DebugHeader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#include "gcinterface.dac.h"
#include "rhassert.h"
#include "TargetPtrs.h"
#include "PalRedhawkCommon.h"
#include "PalRedhawk.h"
#include "PalLimitedContext.h"
#include "Pal.h"
#include "holder.h"
#include "RuntimeInstance.h"
#include "regdisplay.h"
Expand Down Expand Up @@ -80,7 +80,7 @@ struct DotNetRuntimeDebugHeader
// v1-v4 were never doc'ed but history is source control if you need it
// v5 - Thread now has an m_eeAllocContext field and the previous m_rgbAllocContextBuffer
// field is nested inside of it.
//
//
const uint16_t MajorVersion = 5;

// This counter can be incremented to indicate back-compatible changes
Expand Down
16 changes: 8 additions & 8 deletions src/coreclr/nativeaot/Runtime/EHHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#include "GcEnum.h"
#include "shash.h"
#include "TypeManager.h"
#include "PalRedhawkCommon.h"
#include "PalRedhawk.h"
#include "PalLimitedContext.h"
#include "Pal.h"
#include "holder.h"
#include "Crst.h"
#include "RuntimeInstance.h"
Expand Down Expand Up @@ -357,13 +357,13 @@ int32_t RhpHardwareExceptionHandler(uintptr_t faultCode, uintptr_t faultAddress,
if (pCodeManager != NULL)
{
// Make sure that the OS does not use our internal fault codes
ASSERT(faultCode != STATUS_REDHAWK_NULL_REFERENCE && faultCode != STATUS_REDHAWK_UNMANAGED_HELPER_NULL_REFERENCE);
ASSERT(faultCode != STATUS_NATIVEAOT_NULL_REFERENCE && faultCode != STATUS_NATIVEAOT_UNMANAGED_HELPER_NULL_REFERENCE);

if (faultCode == STATUS_ACCESS_VIOLATION)
{
if (faultAddress < NULL_AREA_SIZE)
{
faultCode = STATUS_REDHAWK_NULL_REFERENCE;
faultCode = STATUS_NATIVEAOT_NULL_REFERENCE;
}
}
else if (faultCode == STATUS_STACK_OVERFLOW)
Expand All @@ -387,7 +387,7 @@ int32_t RhpHardwareExceptionHandler(uintptr_t faultCode, uintptr_t faultAddress,
{
if (faultAddress < NULL_AREA_SIZE)
{
faultCode = STATUS_REDHAWK_UNMANAGED_HELPER_NULL_REFERENCE;
faultCode = STATUS_NATIVEAOT_UNMANAGED_HELPER_NULL_REFERENCE;
}

// we were AV-ing in a helper - unwind our way to our caller
Expand Down Expand Up @@ -490,13 +490,13 @@ LONG WINAPI RhpVectoredExceptionHandler(PEXCEPTION_POINTERS pExPtrs)
if (pCodeManager != NULL)
{
// Make sure that the OS does not use our internal fault codes
ASSERT(faultCode != STATUS_REDHAWK_NULL_REFERENCE && faultCode != STATUS_REDHAWK_UNMANAGED_HELPER_NULL_REFERENCE);
ASSERT(faultCode != STATUS_NATIVEAOT_NULL_REFERENCE && faultCode != STATUS_NATIVEAOT_UNMANAGED_HELPER_NULL_REFERENCE);

if (faultCode == STATUS_ACCESS_VIOLATION)
{
if (pExPtrs->ExceptionRecord->ExceptionInformation[1] < NULL_AREA_SIZE)
{
faultCode = STATUS_REDHAWK_NULL_REFERENCE;
faultCode = STATUS_NATIVEAOT_NULL_REFERENCE;
}
}
else if (faultCode == STATUS_STACK_OVERFLOW)
Expand Down Expand Up @@ -525,7 +525,7 @@ LONG WINAPI RhpVectoredExceptionHandler(PEXCEPTION_POINTERS pExPtrs)
{
if (pExPtrs->ExceptionRecord->ExceptionInformation[1] < NULL_AREA_SIZE)
{
faultCode = STATUS_REDHAWK_UNMANAGED_HELPER_NULL_REFERENCE;
faultCode = STATUS_NATIVEAOT_UNMANAGED_HELPER_NULL_REFERENCE;
}

// we were AV-ing in a helper - unwind our way to our caller
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/nativeaot/Runtime/GCHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "forward_declarations.h"
#include "RhConfig.h"

#include "PalRedhawkCommon.h"
#include "PalLimitedContext.h"
#include "slist.h"
#include "regdisplay.h"
#include "StackFrameIterator.h"
Expand Down
14 changes: 7 additions & 7 deletions src/coreclr/nativeaot/Runtime/GCMemoryHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include "common.h"
#include "gcenv.h"
#include "PalRedhawkCommon.h"
#include "PalLimitedContext.h"
#include "CommonMacros.inl"
#include "GCMemoryHelpers.inl"

Expand All @@ -30,14 +30,14 @@ FCIMPL2(void *, RhpGcSafeZeroMemory, void * mem, size_t size)
}
FCIMPLEND

#if defined(TARGET_X86) || defined(TARGET_AMD64)
//
#if defined(TARGET_X86) || defined(TARGET_AMD64)
//
// Memory writes are already ordered
//
#define GCHeapMemoryBarrier()
//
#define GCHeapMemoryBarrier()
#else
#define GCHeapMemoryBarrier() MemoryBarrier()
#endif
#define GCHeapMemoryBarrier() MemoryBarrier()
#endif

// Move memory, in a way that is compatible with a move onto the heap, but
// does not require the destination pointer to be on the heap.
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/nativeaot/Runtime/GcStressControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#include "CommonTypes.h"
#include "CommonMacros.h"
#include "daccess.h"
#include "PalRedhawkCommon.h"
#include "PalRedhawk.h"
#include "PalLimitedContext.h"
#include "Pal.h"
#include "rhassert.h"
#include "holder.h"
#include "Crst.h"
Expand Down
7 changes: 0 additions & 7 deletions src/coreclr/nativeaot/Runtime/HandleTableHelpers.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

//
// Helper functions that are p/invoked from redhawkm in order to expose handle table functionality to managed
// code. These p/invokes are special in that the handle table code requires we remain in co-operative mode
// (since these routines mutate the handle tables which are also accessed during garbage collections). The
// binder has special knowledge of these methods and doesn't generate the normal code to transition out of the
// runtime prior to the call.
//
#include "common.h"
#include "gcenv.h"
#include "objecthandle.h"
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/nativeaot/Runtime/MethodTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#include "rhassert.h"
#include "rhbinder.h"
#include "MethodTable.h"
#include "PalRedhawkCommon.h"
#include "PalRedhawk.h"
#include "PalLimitedContext.h"
#include "Pal.h"

#include "CommonMacros.inl"
#include "MethodTable.inl"
Expand Down
6 changes: 3 additions & 3 deletions src/coreclr/nativeaot/Runtime/MiscHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#include "CommonTypes.h"
#include "CommonMacros.h"
#include "daccess.h"
#include "PalRedhawkCommon.h"
#include "PalRedhawk.h"
#include "PalLimitedContext.h"
#include "Pal.h"
#include "rhassert.h"
#include "slist.h"
#include "holder.h"
Expand Down Expand Up @@ -76,7 +76,7 @@ EXTERN_C void QCALLTYPE RhFlushProcessWriteBuffers()
PalFlushProcessWriteBuffers();
}

// Get the list of currently loaded Redhawk modules (as OS HMODULE handles). The caller provides a reference
// Get the list of currently loaded NativeAOT modules (as OS HMODULE handles). The caller provides a reference
// to an array of pointer-sized elements and we return the total number of modules currently loaded (whether
// that is less than, equal to or greater than the number of elements in the array). If there are more modules
// loaded than the array will hold then the array is filled to capacity and the caller can tell further
Expand Down
5 changes: 2 additions & 3 deletions src/coreclr/nativeaot/Runtime/ObjectLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
#include "CommonMacros.h"
#include "daccess.h"
#include "rhassert.h"
#include "RedhawkWarnings.h"
#include "PalRedhawkCommon.h"
#include "PalRedhawk.h"
#include "PalLimitedContext.h"
#include "Pal.h"
#include "TargetPtrs.h"
#include "MethodTable.h"
#include "ObjectLayout.h"
Expand Down
3 changes: 1 addition & 2 deletions src/coreclr/nativeaot/Runtime/ObjectLayout.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
//

// Bits stolen from the sync block index that the GC/HandleTable knows about (currently these are at the same
// positions as the mainline runtime but we can change this below when it becomes apparent how Redhawk will
// handle sync blocks).
// positions as the mainline runtime).
#define BIT_SBLK_GC_RESERVE 0x20000000
#define BIT_SBLK_FINALIZER_RUN 0x40000000

Expand Down
Loading
Loading