[sanitize] Add barrier()

This commit is contained in:
Behdad Esfahbod committed 2023-11-04 15:21:47 -06:00
1 parent b16f180044
commit cf49f3f2cb
2 files changed
+10 -4

No files matched your search

+2
View File
@@ -3716,6 +3716,7 @@ struct FeatureTableSubstitution
{
TRACE_SANITIZE (this);
return_trace (version.sanitize (c) &&
c->barrier () &&
likely (version.major == 1) &&
substitutions.sanitize (c, this));
}
@@ -3909,6 +3910,7 @@ struct FeatureVariations
{
TRACE_SANITIZE (this);
return_trace (version.sanitize (c) &&
c->barrier () &&
likely (version.major == 1) &&
varRecords.sanitize (c, this));
}
+8 -4
View File
@@ -134,7 +134,7 @@ struct hb_sanitize_context_t :
const char *get_name () { return "SANITIZE"; }
template <typename T, typename F>
bool may_dispatch (const T *obj HB_UNUSED, const F *format)
{ return format->sanitize (this); }
{ return format->sanitize (this) && barrier (); }
static return_t default_return_value () { return true; }
static return_t no_dispatch_return_value () { return false; }
bool stop_sublookup_iteration (const return_t r) const { return !r; }
@@ -381,14 +381,18 @@ struct hb_sanitize_context_t :
return result;
}
#define check_struct(This) \
check_struct_ (This) * 1 & (_hb_compiler_memory_r_barrier (), 1)
HB_ALWAYS_INLINE
bool barrier ()
{
_hb_compiler_memory_r_barrier ();
return true;
}
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));