From 565d19ae2f60c4b14c5aa13ed308ceef379df7db Mon Sep 17 00:00:00 2001 From: Kunal Pathak Date: Wed, 15 Jun 2022 20:51:35 -0700 Subject: [PATCH 1/7] Use Fast compareexchange, acquire/release --- src/coreclr/utilcode/util.cpp | 2 + src/coreclr/vm/codeman.cpp | 4 ++ src/coreclr/vm/syncblk.h | 8 ++++ src/coreclr/vm/syncblk.inl | 17 +++++++++ src/coreclr/vm/util.hpp | 72 +++++++++++++++++++++++++++++++++++ 5 files changed, 103 insertions(+) diff --git a/src/coreclr/utilcode/util.cpp b/src/coreclr/utilcode/util.cpp index 58423a704e970a..b1d928d604eb3e 100644 --- a/src/coreclr/utilcode/util.cpp +++ b/src/coreclr/utilcode/util.cpp @@ -25,6 +25,8 @@ UINT32 g_nClrInstanceId = 0; #endif //!DACCESS_COMPILE +bool g_atomic_present = false; + //***************************************************************************** // Convert a string of hex digits into a hex value of the specified # of bytes. //***************************************************************************** diff --git a/src/coreclr/vm/codeman.cpp b/src/coreclr/vm/codeman.cpp index 37502f21ef1d3b..49a62e063d9b2c 100644 --- a/src/coreclr/vm/codeman.cpp +++ b/src/coreclr/vm/codeman.cpp @@ -1575,6 +1575,10 @@ void EEJitManager::SetCpuInfo() } #endif // HOST_64BIT + if (CPUCompileFlags.IsSet(InstructionSet_Atomics)) + { + g_atomic_present = true; + } if (GetDataCacheZeroIDReg() == 4) { // DCZID_EL0<4> (DZP) indicates whether use of DC ZVA instructions is permitted (0) or prohibited (1). diff --git a/src/coreclr/vm/syncblk.h b/src/coreclr/vm/syncblk.h index 8e83a29cbd4f6f..526b410e8c68e8 100644 --- a/src/coreclr/vm/syncblk.h +++ b/src/coreclr/vm/syncblk.h @@ -382,13 +382,21 @@ class AwareLock LockState CompareExchange(LockState toState, LockState fromState) { LIMITED_METHOD_CONTRACT; +#if defined(TARGET_ARM64) + return (UINT32)FastInterlockedCompareExchange((LONG *)&m_state, (LONG)toState, (LONG)fromState); +#else return (UINT32)InterlockedCompareExchange((LONG *)&m_state, (LONG)toState, (LONG)fromState); +#endif } LockState CompareExchangeAcquire(LockState toState, LockState fromState) { LIMITED_METHOD_CONTRACT; +#if defined(TARGET_ARM64) + return (UINT32)FastInterlockedCompareExchangeAcquire((LONG *)&m_state, (LONG)toState, (LONG)fromState); +#else return (UINT32)InterlockedCompareExchangeAcquire((LONG *)&m_state, (LONG)toState, (LONG)fromState); +#endif } public: diff --git a/src/coreclr/vm/syncblk.inl b/src/coreclr/vm/syncblk.inl index 6b6f5da8cef543..9f372184b39e6e 100644 --- a/src/coreclr/vm/syncblk.inl +++ b/src/coreclr/vm/syncblk.inl @@ -602,7 +602,11 @@ FORCEINLINE AwareLock::EnterHelperResult ObjHeader::EnterObjMonitorHelper(Thread } LONG newValue = oldValue | tid; +#if defined(TARGET_ARM64) + if (FastInterlockedCompareExchangeAcquire((LONG*)&m_SyncBlockValue, newValue, oldValue) == oldValue) +#else if (InterlockedCompareExchangeAcquire((LONG*)&m_SyncBlockValue, newValue, oldValue) == oldValue) +#endif { return AwareLock::EnterHelperResult_Entered; } @@ -650,7 +654,11 @@ FORCEINLINE AwareLock::EnterHelperResult ObjHeader::EnterObjMonitorHelper(Thread return AwareLock::EnterHelperResult_UseSlowPath; } +#if defined(TARGET_ARM64) + if (FastInterlockedCompareExchangeAcquire((LONG*)&m_SyncBlockValue, newValue, oldValue) == oldValue) +#else if (InterlockedCompareExchangeAcquire((LONG*)&m_SyncBlockValue, newValue, oldValue) == oldValue) +#endif { return AwareLock::EnterHelperResult_Entered; } @@ -723,7 +731,12 @@ FORCEINLINE AwareLock::LeaveHelperAction ObjHeader::LeaveObjMonitorHelper(Thread { // We are leaving the lock DWORD newValue = (syncBlockValue & (~SBLK_MASK_LOCK_THREADID)); + +#if defined(TARGET_ARM64) + if (FastInterlockedCompareExchangeRelease((LONG*)&m_SyncBlockValue, newValue, syncBlockValue) != (LONG)syncBlockValue) +#else if (InterlockedCompareExchangeRelease((LONG*)&m_SyncBlockValue, newValue, syncBlockValue) != (LONG)syncBlockValue) +#endif { return AwareLock::LeaveHelperAction_Yield; } @@ -732,7 +745,11 @@ FORCEINLINE AwareLock::LeaveHelperAction ObjHeader::LeaveObjMonitorHelper(Thread { // recursion and ThinLock DWORD newValue = syncBlockValue - SBLK_LOCK_RECLEVEL_INC; +#if defined(TARGET_ARM64) + if (FastInterlockedCompareExchangeRelease((LONG*)&m_SyncBlockValue, newValue, syncBlockValue) != (LONG)syncBlockValue) +#else if (InterlockedCompareExchangeRelease((LONG*)&m_SyncBlockValue, newValue, syncBlockValue) != (LONG)syncBlockValue) +#endif { return AwareLock::LeaveHelperAction_Yield; } diff --git a/src/coreclr/vm/util.hpp b/src/coreclr/vm/util.hpp index f5dc51daf7ee9e..78ae8d8f3afee9 100644 --- a/src/coreclr/vm/util.hpp +++ b/src/coreclr/vm/util.hpp @@ -25,6 +25,8 @@ #define MAX_CACHE_LINE_SIZE 64 #endif +extern bool g_atomic_present; + #ifndef TARGET_UNIX // Copied from malloc.h: don't want to bring in the whole header file. void * __cdecl _alloca(size_t); @@ -72,6 +74,76 @@ BOOL inline FitsInU4(unsigned __int64 val) } +#if defined(TARGET_ARM64) + +FORCEINLINE LONG FastInterlockedCompareExchange( + LONG volatile *Destination, + LONG Exchange, + LONG Comperand) +{ + printf("g_atomic_present (FastInterlockedCompareExchange)= %d\n", g_atomic_present); + if (g_atomic_present) + { + return (LONG) __casal32((unsigned __int32*) Destination, (unsigned __int32)Comperand, (unsigned __int32)Exchange); + } + else + { + return InterlockedCompareExchange(Destination, Exchange, Comperand); + } +} + +FORCEINLINE LONGLONG FastInterlockedCompareExchange64( + IN OUT LONGLONG volatile *Destination, + IN LONGLONG Exchange, + IN LONGLONG Comperand) +{ + printf("g_atomic_present (FastInterlockedCompareExchange64)= %d\n", g_atomic_present); + if (g_atomic_present) + { + return (LONGLONG) __casal64((unsigned __int64*) Destination, (unsigned __int64)Comperand, (unsigned __int64)Exchange); + } + else + { + return InterlockedCompareExchange64(Destination, Exchange, Comperand); + } +} + +FORCEINLINE LONG FastInterlockedCompareExchangeAcquire( + IN OUT LONG volatile *Destination, + IN LONG Exchange, + IN LONG Comperand +) +{ + printf("g_atomic_present (FastInterlockedCompareExchangeAcquire)= %d\n", g_atomic_present); + if (g_atomic_present) + { + return (LONG) __casa32((unsigned __int32*) Destination, (unsigned __int32)Comperand, (unsigned __int32)Exchange); + } + else + { + return InterlockedCompareExchangeAcquire(Destination, Exchange, Comperand); + } +} + +FORCEINLINE LONG FastInterlockedCompareExchangeRelease( + IN OUT LONG volatile *Destination, + IN LONG Exchange, + IN LONG Comperand +) +{ + printf("g_atomic_present (FastInterlockedCompareExchangeRelease)= %d\n", g_atomic_present); + if (g_atomic_present) + { + return (LONG) __casl32((unsigned __int32*) Destination, (unsigned __int32)Comperand, (unsigned __int32)Exchange); + } + else + { + return InterlockedCompareExchangeRelease(Destination, Exchange, Comperand); + } +} + +#endif // TARGET_ARM64 + //************************************************************************ // CQuickHeap From cd6be8bd12ff7bf0b7c25b170eaf0b59ff18e0d5 Mon Sep 17 00:00:00 2001 From: Kunal Pathak Date: Thu, 16 Jun 2022 14:52:05 -0700 Subject: [PATCH 2/7] working windows version --- src/coreclr/vm/util.hpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/coreclr/vm/util.hpp b/src/coreclr/vm/util.hpp index 78ae8d8f3afee9..ddeb36c6f9b6f5 100644 --- a/src/coreclr/vm/util.hpp +++ b/src/coreclr/vm/util.hpp @@ -73,8 +73,15 @@ BOOL inline FitsInU4(unsigned __int64 val) return val == (unsigned __int64)(unsigned __int32)val; } +#if defined(DACCESS_COMPILE) +#define FastInterlockedCompareExchange InterlockedCompareExchange +#define FastInterlockedCompareExchange64 InterlockedCompareExchange64 +#define FastInterlockedCompareExchangeAcquire InterlockedCompareExchangeAcquire +#define FastInterlockedCompareExchangeRelease InterlockedCompareExchangeRelease -#if defined(TARGET_ARM64) +#else + +#if defined(TARGET_WINDOWS) && defined(TARGET_ARM64) FORCEINLINE LONG FastInterlockedCompareExchange( LONG volatile *Destination, @@ -142,7 +149,9 @@ FORCEINLINE LONG FastInterlockedCompareExchangeRelease( } } -#endif // TARGET_ARM64 +#endif // defined(TARGET_WINDOWS) && defined(TARGET_ARM64) + +#endif //defined(DACCESS_COMPILE) //************************************************************************ From 518cf861f8e1dce097dbcaecca372ad855a47420 Mon Sep 17 00:00:00 2001 From: Kunal Pathak Date: Fri, 17 Jun 2022 10:48:46 -0700 Subject: [PATCH 3/7] remove printf --- src/coreclr/vm/util.hpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/coreclr/vm/util.hpp b/src/coreclr/vm/util.hpp index ddeb36c6f9b6f5..88b947b6c7d0db 100644 --- a/src/coreclr/vm/util.hpp +++ b/src/coreclr/vm/util.hpp @@ -78,7 +78,6 @@ BOOL inline FitsInU4(unsigned __int64 val) #define FastInterlockedCompareExchange64 InterlockedCompareExchange64 #define FastInterlockedCompareExchangeAcquire InterlockedCompareExchangeAcquire #define FastInterlockedCompareExchangeRelease InterlockedCompareExchangeRelease - #else #if defined(TARGET_WINDOWS) && defined(TARGET_ARM64) @@ -88,7 +87,6 @@ FORCEINLINE LONG FastInterlockedCompareExchange( LONG Exchange, LONG Comperand) { - printf("g_atomic_present (FastInterlockedCompareExchange)= %d\n", g_atomic_present); if (g_atomic_present) { return (LONG) __casal32((unsigned __int32*) Destination, (unsigned __int32)Comperand, (unsigned __int32)Exchange); @@ -104,7 +102,6 @@ FORCEINLINE LONGLONG FastInterlockedCompareExchange64( IN LONGLONG Exchange, IN LONGLONG Comperand) { - printf("g_atomic_present (FastInterlockedCompareExchange64)= %d\n", g_atomic_present); if (g_atomic_present) { return (LONGLONG) __casal64((unsigned __int64*) Destination, (unsigned __int64)Comperand, (unsigned __int64)Exchange); @@ -121,7 +118,6 @@ FORCEINLINE LONG FastInterlockedCompareExchangeAcquire( IN LONG Comperand ) { - printf("g_atomic_present (FastInterlockedCompareExchangeAcquire)= %d\n", g_atomic_present); if (g_atomic_present) { return (LONG) __casa32((unsigned __int32*) Destination, (unsigned __int32)Comperand, (unsigned __int32)Exchange); @@ -138,7 +134,6 @@ FORCEINLINE LONG FastInterlockedCompareExchangeRelease( IN LONG Comperand ) { - printf("g_atomic_present (FastInterlockedCompareExchangeRelease)= %d\n", g_atomic_present); if (g_atomic_present) { return (LONG) __casl32((unsigned __int32*) Destination, (unsigned __int32)Comperand, (unsigned __int32)Exchange); From f6ba4e337b1feebf0f798d81b3790a1f6e0f1377 Mon Sep 17 00:00:00 2001 From: Kunal Pathak Date: Fri, 17 Jun 2022 11:40:15 -0700 Subject: [PATCH 4/7] some more #ifdef --- src/coreclr/utilcode/util.cpp | 7 ++++++- src/coreclr/vm/util.hpp | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/coreclr/utilcode/util.cpp b/src/coreclr/utilcode/util.cpp index b1d928d604eb3e..f5412b3387c7e1 100644 --- a/src/coreclr/utilcode/util.cpp +++ b/src/coreclr/utilcode/util.cpp @@ -23,9 +23,14 @@ #ifndef DACCESS_COMPILE UINT32 g_nClrInstanceId = 0; -#endif //!DACCESS_COMPILE +#if defined(TARGET_WINDOWS) && defined(TARGET_ARM64) bool g_atomic_present = false; +#endif + +#endif //!DACCESS_COMPILE + + //***************************************************************************** // Convert a string of hex digits into a hex value of the specified # of bytes. diff --git a/src/coreclr/vm/util.hpp b/src/coreclr/vm/util.hpp index 88b947b6c7d0db..255e772fa00eca 100644 --- a/src/coreclr/vm/util.hpp +++ b/src/coreclr/vm/util.hpp @@ -25,7 +25,11 @@ #define MAX_CACHE_LINE_SIZE 64 #endif +#ifndef DACCESS_COMPILE +#if defined(TARGET_WINDOWS) && defined(TARGET_ARM64) extern bool g_atomic_present; +#endif +#endif #ifndef TARGET_UNIX // Copied from malloc.h: don't want to bring in the whole header file. From a24be98265e324c94e8d09480ede72d4b0b83cbc Mon Sep 17 00:00:00 2001 From: Kunal Pathak Date: Fri, 17 Jun 2022 13:41:17 -0700 Subject: [PATCH 5/7] fix some #ifdef --- src/coreclr/utilcode/util.cpp | 6 +++--- src/coreclr/vm/codeman.cpp | 5 +---- src/coreclr/vm/syncblk.h | 4 ++-- src/coreclr/vm/syncblk.inl | 8 ++++---- src/coreclr/vm/util.hpp | 12 +++++++----- 5 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/coreclr/utilcode/util.cpp b/src/coreclr/utilcode/util.cpp index f5412b3387c7e1..20a25dc4492073 100644 --- a/src/coreclr/utilcode/util.cpp +++ b/src/coreclr/utilcode/util.cpp @@ -25,13 +25,13 @@ UINT32 g_nClrInstanceId = 0; #if defined(TARGET_WINDOWS) && defined(TARGET_ARM64) -bool g_atomic_present = false; +// Flag to check if atomics feature is available on +// the machine +bool g_arm64_atomics_present = false; #endif #endif //!DACCESS_COMPILE - - //***************************************************************************** // Convert a string of hex digits into a hex value of the specified # of bytes. //***************************************************************************** diff --git a/src/coreclr/vm/codeman.cpp b/src/coreclr/vm/codeman.cpp index 49a62e063d9b2c..2710d8c5c9ca25 100644 --- a/src/coreclr/vm/codeman.cpp +++ b/src/coreclr/vm/codeman.cpp @@ -1566,6 +1566,7 @@ void EEJitManager::SetCpuInfo() if (IsProcessorFeaturePresent(PF_ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE)) { CPUCompileFlags.Set(InstructionSet_Atomics); + g_arm64_atomics_present = true; } // PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE (43) @@ -1575,10 +1576,6 @@ void EEJitManager::SetCpuInfo() } #endif // HOST_64BIT - if (CPUCompileFlags.IsSet(InstructionSet_Atomics)) - { - g_atomic_present = true; - } if (GetDataCacheZeroIDReg() == 4) { // DCZID_EL0<4> (DZP) indicates whether use of DC ZVA instructions is permitted (0) or prohibited (1). diff --git a/src/coreclr/vm/syncblk.h b/src/coreclr/vm/syncblk.h index 526b410e8c68e8..da480700daa7cb 100644 --- a/src/coreclr/vm/syncblk.h +++ b/src/coreclr/vm/syncblk.h @@ -382,7 +382,7 @@ class AwareLock LockState CompareExchange(LockState toState, LockState fromState) { LIMITED_METHOD_CONTRACT; -#if defined(TARGET_ARM64) +#if defined(TARGET_WINDOWS) && defined(TARGET_ARM64) return (UINT32)FastInterlockedCompareExchange((LONG *)&m_state, (LONG)toState, (LONG)fromState); #else return (UINT32)InterlockedCompareExchange((LONG *)&m_state, (LONG)toState, (LONG)fromState); @@ -392,7 +392,7 @@ class AwareLock LockState CompareExchangeAcquire(LockState toState, LockState fromState) { LIMITED_METHOD_CONTRACT; -#if defined(TARGET_ARM64) +#if defined(TARGET_WINDOWS) && defined(TARGET_ARM64) return (UINT32)FastInterlockedCompareExchangeAcquire((LONG *)&m_state, (LONG)toState, (LONG)fromState); #else return (UINT32)InterlockedCompareExchangeAcquire((LONG *)&m_state, (LONG)toState, (LONG)fromState); diff --git a/src/coreclr/vm/syncblk.inl b/src/coreclr/vm/syncblk.inl index 9f372184b39e6e..05753058577227 100644 --- a/src/coreclr/vm/syncblk.inl +++ b/src/coreclr/vm/syncblk.inl @@ -602,7 +602,7 @@ FORCEINLINE AwareLock::EnterHelperResult ObjHeader::EnterObjMonitorHelper(Thread } LONG newValue = oldValue | tid; -#if defined(TARGET_ARM64) +#if defined(TARGET_WINDOWS) && defined(TARGET_ARM64) if (FastInterlockedCompareExchangeAcquire((LONG*)&m_SyncBlockValue, newValue, oldValue) == oldValue) #else if (InterlockedCompareExchangeAcquire((LONG*)&m_SyncBlockValue, newValue, oldValue) == oldValue) @@ -654,7 +654,7 @@ FORCEINLINE AwareLock::EnterHelperResult ObjHeader::EnterObjMonitorHelper(Thread return AwareLock::EnterHelperResult_UseSlowPath; } -#if defined(TARGET_ARM64) +#if defined(TARGET_WINDOWS) && defined(TARGET_ARM64) if (FastInterlockedCompareExchangeAcquire((LONG*)&m_SyncBlockValue, newValue, oldValue) == oldValue) #else if (InterlockedCompareExchangeAcquire((LONG*)&m_SyncBlockValue, newValue, oldValue) == oldValue) @@ -732,7 +732,7 @@ FORCEINLINE AwareLock::LeaveHelperAction ObjHeader::LeaveObjMonitorHelper(Thread // We are leaving the lock DWORD newValue = (syncBlockValue & (~SBLK_MASK_LOCK_THREADID)); -#if defined(TARGET_ARM64) +#if defined(TARGET_WINDOWS) && defined(TARGET_ARM64) if (FastInterlockedCompareExchangeRelease((LONG*)&m_SyncBlockValue, newValue, syncBlockValue) != (LONG)syncBlockValue) #else if (InterlockedCompareExchangeRelease((LONG*)&m_SyncBlockValue, newValue, syncBlockValue) != (LONG)syncBlockValue) @@ -745,7 +745,7 @@ FORCEINLINE AwareLock::LeaveHelperAction ObjHeader::LeaveObjMonitorHelper(Thread { // recursion and ThinLock DWORD newValue = syncBlockValue - SBLK_LOCK_RECLEVEL_INC; -#if defined(TARGET_ARM64) +#if defined(TARGET_WINDOWS) && defined(TARGET_ARM64) if (FastInterlockedCompareExchangeRelease((LONG*)&m_SyncBlockValue, newValue, syncBlockValue) != (LONG)syncBlockValue) #else if (InterlockedCompareExchangeRelease((LONG*)&m_SyncBlockValue, newValue, syncBlockValue) != (LONG)syncBlockValue) diff --git a/src/coreclr/vm/util.hpp b/src/coreclr/vm/util.hpp index 255e772fa00eca..968d671836a926 100644 --- a/src/coreclr/vm/util.hpp +++ b/src/coreclr/vm/util.hpp @@ -27,7 +27,9 @@ #ifndef DACCESS_COMPILE #if defined(TARGET_WINDOWS) && defined(TARGET_ARM64) -extern bool g_atomic_present; +// Flag to check if atomics feature is available on +// the machine +extern bool g_arm64_atomics_present; #endif #endif @@ -91,7 +93,7 @@ FORCEINLINE LONG FastInterlockedCompareExchange( LONG Exchange, LONG Comperand) { - if (g_atomic_present) + if (g_arm64_atomics_present) { return (LONG) __casal32((unsigned __int32*) Destination, (unsigned __int32)Comperand, (unsigned __int32)Exchange); } @@ -106,7 +108,7 @@ FORCEINLINE LONGLONG FastInterlockedCompareExchange64( IN LONGLONG Exchange, IN LONGLONG Comperand) { - if (g_atomic_present) + if (g_arm64_atomics_present) { return (LONGLONG) __casal64((unsigned __int64*) Destination, (unsigned __int64)Comperand, (unsigned __int64)Exchange); } @@ -122,7 +124,7 @@ FORCEINLINE LONG FastInterlockedCompareExchangeAcquire( IN LONG Comperand ) { - if (g_atomic_present) + if (g_arm64_atomics_present) { return (LONG) __casa32((unsigned __int32*) Destination, (unsigned __int32)Comperand, (unsigned __int32)Exchange); } @@ -138,7 +140,7 @@ FORCEINLINE LONG FastInterlockedCompareExchangeRelease( IN LONG Comperand ) { - if (g_atomic_present) + if (g_arm64_atomics_present) { return (LONG) __casl32((unsigned __int32*) Destination, (unsigned __int32)Comperand, (unsigned __int32)Exchange); } From 3ae4cdecafd016457a657b6bbcc22d3b8f398953 Mon Sep 17 00:00:00 2001 From: Kunal Pathak Date: Fri, 17 Jun 2022 14:14:54 -0700 Subject: [PATCH 6/7] optimize EnterObjMonitorHelperSpin --- src/coreclr/vm/syncblk.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/coreclr/vm/syncblk.cpp b/src/coreclr/vm/syncblk.cpp index 4665c62e23a1a0..5b0a5ed6647c7c 100644 --- a/src/coreclr/vm/syncblk.cpp +++ b/src/coreclr/vm/syncblk.cpp @@ -1652,7 +1652,11 @@ AwareLock::EnterHelperResult ObjHeader::EnterObjMonitorHelperSpin(Thread* pCurTh } LONG newValue = oldValue | tid; +#if defined(TARGET_WINDOWS) && defined(TARGET_ARM64) + if (FastInterlockedCompareExchangeAcquire((LONG*)&m_SyncBlockValue, newValue, oldValue) == oldValue) +#else if (InterlockedCompareExchangeAcquire((LONG*)&m_SyncBlockValue, newValue, oldValue) == oldValue) +#endif { return AwareLock::EnterHelperResult_Entered; } From 447f9fad4f59c8c7c6b23cf100ec03ed693ffa1a Mon Sep 17 00:00:00 2001 From: Kunal Pathak Date: Fri, 17 Jun 2022 14:22:35 -0700 Subject: [PATCH 7/7] Remove FastInterlockedCompareExchange64 for now --- src/coreclr/vm/util.hpp | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/coreclr/vm/util.hpp b/src/coreclr/vm/util.hpp index 968d671836a926..3004cbcfcf2e9d 100644 --- a/src/coreclr/vm/util.hpp +++ b/src/coreclr/vm/util.hpp @@ -81,7 +81,6 @@ BOOL inline FitsInU4(unsigned __int64 val) #if defined(DACCESS_COMPILE) #define FastInterlockedCompareExchange InterlockedCompareExchange -#define FastInterlockedCompareExchange64 InterlockedCompareExchange64 #define FastInterlockedCompareExchangeAcquire InterlockedCompareExchangeAcquire #define FastInterlockedCompareExchangeRelease InterlockedCompareExchangeRelease #else @@ -103,21 +102,6 @@ FORCEINLINE LONG FastInterlockedCompareExchange( } } -FORCEINLINE LONGLONG FastInterlockedCompareExchange64( - IN OUT LONGLONG volatile *Destination, - IN LONGLONG Exchange, - IN LONGLONG Comperand) -{ - if (g_arm64_atomics_present) - { - return (LONGLONG) __casal64((unsigned __int64*) Destination, (unsigned __int64)Comperand, (unsigned __int64)Exchange); - } - else - { - return InterlockedCompareExchange64(Destination, Exchange, Comperand); - } -} - FORCEINLINE LONG FastInterlockedCompareExchangeAcquire( IN OUT LONG volatile *Destination, IN LONG Exchange,