[sanitize] Yet another hack to "fix" barrier issue

pull/4480/head
Behdad Esfahbod 1 year ago
parent fd5eb10d3b
commit b16f180044
  1. 4
      src/hb-atomic.hh
  2. 5
      src/hb-sanitize.hh

@ -118,12 +118,12 @@ _hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N)
*/
#ifndef _hb_compiler_memory_r_barrier
#if defined(__ATOMIC_ACQUIRE) // gcc-like
#define _hb_compiler_memory_r_barrier() asm volatile("": : :"memory")
static inline void _hb_compiler_memory_r_barrier () { asm volatile("": : :"memory"); }
#elif !defined(_MSC_VER)
#include <atomic>
#define _hb_compiler_memory_r_barrier() std::atomic_signal_fence (std::memory_order_acquire)
#else
#define _hb_compiler_memory_r_barrier() do {} while (0)
static inline void _hb_compiler_memory_r_barrier () {}
#endif
#endif

@ -381,11 +381,14 @@ struct hb_sanitize_context_t :
return result;
}
#define check_struct(This) \
check_struct_ (This) * 1 & (_hb_compiler_memory_r_barrier (), 1)
template <typename Type>
#ifndef HB_OPTIMIZE_SIZE
HB_ALWAYS_INLINE
#endif
bool check_struct (const Type *obj) const
bool check_struct_ (const Type *obj) const
{
if (sizeof (uintptr_t) == sizeof (uint32_t))
return likely (this->check_range_fast (obj, obj->min_size));

Loading…
Cancel
Save