Skip to content

Commit a882fbf

Browse files
committed
Alternative approach to fixing the EH issue that may fix OSX as well. If it does... I'll likely do this logic for all architectures
1 parent ff8a695 commit a882fbf

File tree

5 files changed

+41
-10
lines changed

5 files changed

+41
-10
lines changed

src/coreclr/runtime/arm/WriteBarriers.S

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,10 @@ GLOBAL_LABEL RhpCheckedAssignRefAVLocation
179179
LEAF_END RhpCheckedAssignRef\EXPORT_REG_NAME, _TEXT
180180
.endm
181181

182+
LEAF_ENTRY RhpWriteBarriers, _TEXT
183+
bx lr
184+
LEAF_END RhpWriteBarriers, _TEXT
185+
182186
// One day we might have write barriers for all the possible argument registers but for now we have
183187
// just one write barrier that assumes the input register is RSI.
184188
DEFINE_CHECKED_WRITE_BARRIER r1, r1
@@ -302,3 +306,7 @@ LOCAL_LABEL(RhpByRefAssignRef_NotInHeap):
302306
add r1, #4
303307
bx lr
304308
LEAF_END RhpByRefAssignRef, _TEXT
309+
310+
LEAF_ENTRY RhpWriteBarriers_End, _TEXT
311+
bx lr
312+
LEAF_END RhpWriteBarriers_End, _TEXT

src/coreclr/runtime/arm64/WriteBarriers.S

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,10 @@
179179
// Exit label
180180
.endm
181181

182+
LEAF_ENTRY RhpWriteBarriers, _TEXT
183+
ret
184+
LEAF_END RhpWriteBarriers, _TEXT
185+
182186
// void JIT_ByRefWriteBarrier
183187
// On entry:
184188
// x13 : the source address (points to object reference to write)
@@ -397,3 +401,8 @@ LOCAL_LABEL(NoBarrierXchg):
397401
.arch_extension nolse
398402
#endif
399403
#endif // FEATURE_NATIVEAOT
404+
405+
LEAF_ENTRY RhpWriteBarriers_End, _TEXT
406+
ret
407+
LEAF_END RhpWriteBarriers_End, _TEXT
408+

src/coreclr/runtime/arm64/WriteBarriers.asm

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,10 @@ INVALIDGCVALUE EQU 0xCCCCCCCD
189189
;; Exit label
190190
MEND
191191

192+
LEAF_ENTRY RhpWriteBarriers
193+
ret
194+
LEAF_END RhpWriteBarriers
195+
192196
;; void JIT_ByRefWriteBarrier
193197
;; On entry:
194198
;; x13 : the source address (points to object reference to write)
@@ -391,4 +395,8 @@ NoBarrierXchg
391395
LEAF_END RhpCheckedXchg
392396
#endif // FEATURE_NATIVEAOT
393397

398+
LEAF_ENTRY RhpWriteBarriers_End
399+
ret
400+
LEAF_END RhpWriteBarriers_End
401+
394402
end
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
// TODO: Implement
4+
#include "AsmMacros_Shared.h"
5+

src/coreclr/vm/excep.cpp

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5895,9 +5895,14 @@ BOOL IsIPinVirtualStub(PCODE f_IP)
58955895
#endif // FEATURE_VIRTUAL_STUB_DISPATCH
58965896
}
58975897

5898+
#if defined(TARGET_ARM64) || defined(TARGET_ARM)
5899+
EXTERN_C void RhpWriteBarriers();
5900+
EXTERN_C void RhpWriteBarriers_End();
5901+
#endif
5902+
58985903
typedef uint8_t CODE_LOCATION;
58995904
EXTERN_C CODE_LOCATION RhpAssignRefAVLocation;
5900-
#if defined(HOST_X86)
5905+
#if defined(TARGET_X86)
59015906
EXTERN_C CODE_LOCATION RhpAssignRefEAXAVLocation;
59025907
EXTERN_C CODE_LOCATION RhpAssignRefECXAVLocation;
59035908
EXTERN_C CODE_LOCATION RhpAssignRefEBXAVLocation;
@@ -5906,7 +5911,7 @@ EXTERN_C CODE_LOCATION RhpAssignRefEDIAVLocation;
59065911
EXTERN_C CODE_LOCATION RhpAssignRefEBPAVLocation;
59075912
#endif
59085913
EXTERN_C CODE_LOCATION RhpCheckedAssignRefAVLocation;
5909-
#if defined(HOST_X86)
5914+
#if defined(TARGET_X86)
59105915
EXTERN_C CODE_LOCATION RhpCheckedAssignRefEAXAVLocation;
59115916
EXTERN_C CODE_LOCATION RhpCheckedAssignRefECXAVLocation;
59125917
EXTERN_C CODE_LOCATION RhpCheckedAssignRefEBXAVLocation;
@@ -5916,14 +5921,14 @@ EXTERN_C CODE_LOCATION RhpCheckedAssignRefEBPAVLocation;
59165921
#endif
59175922
EXTERN_C CODE_LOCATION RhpByRefAssignRefAVLocation1;
59185923

5919-
#if !defined(HOST_ARM64) && !defined(HOST_LOONGARCH64) && !defined(HOST_RISCV64)
5924+
#if !defined(TARGET_ARM64) && !defined(TARGET_LOONGARCH64) && !defined(TARGET_RISCV64)
59205925
EXTERN_C CODE_LOCATION RhpByRefAssignRefAVLocation2;
59215926
#endif
59225927

59235928
static uintptr_t writeBarrierAVLocations[] =
59245929
{
59255930
(uintptr_t)&RhpAssignRefAVLocation,
5926-
#if defined(HOST_X86)
5931+
#if defined(TARGET_X86)
59275932
(uintptr_t)&RhpAssignRefEAXAVLocation,
59285933
(uintptr_t)&RhpAssignRefECXAVLocation,
59295934
(uintptr_t)&RhpAssignRefEBXAVLocation,
@@ -5941,7 +5946,7 @@ static uintptr_t writeBarrierAVLocations[] =
59415946
(uintptr_t)&RhpCheckedAssignRefEBPAVLocation,
59425947
#endif
59435948
(uintptr_t)&RhpByRefAssignRefAVLocation1,
5944-
#if !defined(HOST_ARM64) && !defined(HOST_LOONGARCH64) && !defined(HOST_RISCV64)
5949+
#if !defined(TARGET_ARM64) && !defined(TARGET_LOONGARCH64) && !defined(TARGET_RISCV64)
59455950
(uintptr_t)&RhpByRefAssignRefAVLocation2,
59465951
#endif
59475952
};
@@ -5961,17 +5966,17 @@ bool IsIPInMarkedJitHelper(UINT_PTR uControlPc)
59615966
ASSERT(*(uint8_t*)writeBarrierAVLocations[i] != 0xE9); // jmp XXXXXXXX
59625967
#endif
59635968

5964-
#ifdef TARGET_ARM
5965-
if ((writeBarrierAVLocations[i] | THUMB_CODE) == (uControlPc | THUMB_CODE))
5966-
#else
59675969
if (writeBarrierAVLocations[i] == uControlPc)
5968-
#endif
59695970
return true;
59705971
}
59715972

59725973
#define CHECK_RANGE(name) \
59735974
if (GetEEFuncEntryPoint(name) <= uControlPc && uControlPc < GetEEFuncEntryPoint(name##_End)) return true;
59745975

5976+
#if defined(TARGET_ARM64) || defined(TARGET_ARM)
5977+
CHECK_RANGE(RhpWriteBarriers)
5978+
#endif
5979+
59755980
#ifndef TARGET_X86
59765981
CHECK_RANGE(JIT_WriteBarrier)
59775982
CHECK_RANGE(JIT_CheckedWriteBarrier)

0 commit comments

Comments
 (0)