1
0
Fork 0
mirror of https://github.com/VSadov/Satori.git synced 2025-06-08 03:27:04 +09:00

lock tweak

This commit is contained in:
vsadov 2022-06-18 19:15:50 -07:00
parent 8cd5724a3a
commit 5317b471db
2 changed files with 22 additions and 1 deletions

View file

@ -297,6 +297,27 @@ void VolatileStoreWithoutBarrier(T* pt, T val)
#endif
}
//
// Memory ordering barrier that waits for loads in progress to complete.
// Any effects of loads or stores that appear after, in program order, will "happen after" relative to this.
// Other operations such as computation or instruction prefetch are not affected.
//
// Architectural mapping:
// arm64 : dmb ishld
// arm : dmb ish
// x86/64 : compiler fence
inline
void VolatileLoadBarrier()
{
#if defined(HOST_ARM64) && defined(__GNUC__)
asm volatile ("dmb ishld" : : : "memory");
#elif defined(HOST_ARM64) && defined(_MSC_VER)
__dmb(_ARM64_BARRIER_ISHLD);
#else
VOLATILE_MEMORY_BARRIER();
#endif
}
//
// Volatile<T> implements accesses with our volatile semantics over a variable of type T.
// Wherever you would have used a "volatile Foo" or, equivalently, "Foo volatile", use Volatile<Foo>

View file

@ -79,7 +79,7 @@ public:
}
#if !defined(TARGET_AMD64)
MemoryBarrier();
VolatileLoadBarrier();
#endif
}