concurrent hopscotch hashtable only needs a load-load barrier in lookup

and that is implied by the x86/x64's memory model ... avoiding the mfence instruction is a significant win

Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
Erik Boasson 2019-01-03 17:39:13 +01:00
parent 95f070d097
commit 771eed118b
4 changed files with 15 additions and 9 deletions

View file

@ -331,6 +331,11 @@ VDDS_INLINE int os_atomic_casvoidp (volatile os_atomic_voidp_t *x, void *exp, vo
VDDS_INLINE void os_atomic_fence (void) {
__sync_synchronize ();
}
VDDS_INLINE void os_atomic_fence_ldld (void) {
#if !(defined __i386__ || defined __x86_64__ || defined _M_IX86 || defined _M_X64)
__sync_synchronize ();
#endif
}
VDDS_INLINE void os_atomic_fence_acq (void) {
os_atomic_fence ();
}

View file

@ -231,6 +231,9 @@ VDDS_INLINE void os_atomic_fence (void) {
membar_exit ();
membar_enter ();
}
VDDS_INLINE void os_atomic_fence_ldld (void) {
membar_enter ();
}
VDDS_INLINE void os_atomic_fence_acq (void) {
membar_enter ();
}

View file

@ -416,6 +416,11 @@ OS_ATOMIC_API_INLINE void os_atomic_fence (void) {
InterlockedExchange (&tmp, 0);
#pragma warning (pop)
}
OS_ATOMIC_API_INLINE void os_atomic_fence_ldld (void) {
#if !(defined _M_IX86 || defined _M_X64)
os_atomic_fence ();
#endif
}
OS_ATOMIC_API_INLINE void os_atomic_fence_acq (void) {
os_atomic_fence ();
}