mirror of
https://github.com/harfbuzz/harfbuzz.git
synced 2025-04-14 17:13:40 +00:00
[sanitize] Yet another hack to "fix" barrier issue
This commit is contained in:
parent
fd5eb10d3b
commit
b16f180044
2 changed files with 6 additions and 3 deletions
|
@ -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…
Add table
Reference in a new issue