From 34ea1351bdf2697d775e9145f59eb6df2741a084 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Michal=20Strehovsk=C3=BD?= Date: Thu, 28 Jul 2022 09:19:57 +0900 Subject: [PATCH] Add memory fences to ByRefAssignRef on Unix ARM64 (#72919) --- src/coreclr/nativeaot/Runtime/arm/WriteBarriers.S | 3 +++ src/coreclr/nativeaot/Runtime/arm64/WriteBarriers.S | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/coreclr/nativeaot/Runtime/arm/WriteBarriers.S b/src/coreclr/nativeaot/Runtime/arm/WriteBarriers.S index 478561f..1db0dbd 100644 --- a/src/coreclr/nativeaot/Runtime/arm/WriteBarriers.S +++ b/src/coreclr/nativeaot/Runtime/arm/WriteBarriers.S @@ -323,6 +323,9 @@ LEAF_END RhpCheckedXchg, _TEXT // r2, r3: trashed // LEAF_ENTRY RhpByRefAssignRef, _TEXT + // See comment in RhpAssignRef + dmb + ldr r2, [r1] str r2, [r0] diff --git a/src/coreclr/nativeaot/Runtime/arm64/WriteBarriers.S b/src/coreclr/nativeaot/Runtime/arm64/WriteBarriers.S index 0aaa025..b027376 100644 --- a/src/coreclr/nativeaot/Runtime/arm64/WriteBarriers.S +++ b/src/coreclr/nativeaot/Runtime/arm64/WriteBarriers.S @@ -361,13 +361,13 @@ LEAF_END RhpCheckedAssignRefArm64, _TEXT // x17 : trashed (ip1) if FEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP // LEAF_ENTRY RhpByRefAssignRefArm64, _TEXT - ldr x15, [x13] - str x15, [x14] + ldr x15, [x13] + stlr x15, [x14] INSERT_CHECKED_WRITE_BARRIER_CORE x14, x15, 12, X15 - add X13, x13, #8 - add x14, x14, #8 + add X13, x13, #8 + add x14, x14, #8 ret LEAF_END RhpByRefAssignRefArm64, _TEXT -- 2.7.4