提交 f83e992c 编写于 作者: B Behdad Esfahbod

Mark CrapPool thread_local

Not sure if I like to keep it. For now, aim for correctness.
上级 5d801298
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
#ifndef HB_NO_VISIBILITY #ifndef HB_NO_VISIBILITY
const void * const _hb_NullPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {}; const void * const _hb_NullPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {};
void * _hb_CrapPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {}; thread_local void * _hb_CrapPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {};
#endif #endif
void cbdt_callback (const uint8_t* data, unsigned int length, void cbdt_callback (const uint8_t* data, unsigned int length,
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#ifndef HB_NO_VISIBILITY #ifndef HB_NO_VISIBILITY
const void * const _hb_NullPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {}; const void * const _hb_NullPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {};
void * _hb_CrapPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {}; thread_local void * _hb_CrapPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {};
#endif #endif
template <typename Type, int Bytes> struct LEInt; template <typename Type, int Bytes> struct LEInt;
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
#ifndef HB_NO_VISIBILITY #ifndef HB_NO_VISIBILITY
const void * const _hb_NullPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {}; const void * const _hb_NullPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {};
void * _hb_CrapPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {}; thread_local void * _hb_CrapPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {};
#endif #endif
......
...@@ -90,6 +90,14 @@ extern "C" void hb_free_impl(void *ptr); ...@@ -90,6 +90,14 @@ extern "C" void hb_free_impl(void *ptr);
HB_UNUSED typedef int HB_PASTE(static_assertion_failed_at_line_, __LINE__) [(e) ? 1 : -1] HB_UNUSED typedef int HB_PASTE(static_assertion_failed_at_line_, __LINE__) [(e) ? 1 : -1]
#endif // static_assert #endif // static_assert
#ifdef __GNUC__
#if (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8))
#define thread_local __thread
#endif
#else
#define thread_local
#endif
#endif // __cplusplus < 201103L #endif // __cplusplus < 201103L
#if (defined(__GNUC__) || defined(__clang__)) && defined(__OPTIMIZE__) #if (defined(__GNUC__) || defined(__clang__)) && defined(__OPTIMIZE__)
...@@ -570,12 +578,16 @@ static_assert (Namespace::Type::min_size + 1 <= sizeof (_Null##Type), "Null pool ...@@ -570,12 +578,16 @@ static_assert (Namespace::Type::min_size + 1 <= sizeof (_Null##Type), "Null pool
/* Global writable pool. Enlarge as necessary. */ /* Global writable pool. Enlarge as necessary. */
/* To be fully correct, CrapPool must be thread_local. However, we do not rely on CrapPool
* for correct operation. It only exist to catch and divert program logic bugs instead of
* causing bad memory access. So, races there are not actually introducing incorrectness
* in the code. So maybe disable? Has ~12kb binary size overhead to have it. */
#ifdef HB_NO_VISIBILITY #ifdef HB_NO_VISIBILITY
static static
#else #else
extern HB_INTERNAL extern HB_INTERNAL
#endif #endif
void * _hb_CrapPool[HB_NULL_POOL_SIZE / sizeof (void *)] thread_local void * _hb_CrapPool[HB_NULL_POOL_SIZE / sizeof (void *)]
#ifdef HB_NO_VISIBILITY #ifdef HB_NO_VISIBILITY
= {} = {}
#endif #endif
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
#if !defined(HB_NO_VISIBILITY) && !defined(HB_SUBSET_BUILTIN) #if !defined(HB_NO_VISIBILITY) && !defined(HB_SUBSET_BUILTIN)
const void * const _hb_NullPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {}; const void * const _hb_NullPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {};
void * _hb_CrapPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {}; thread_local void * _hb_CrapPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {};
#endif #endif
......
...@@ -39,7 +39,7 @@ using namespace OT; ...@@ -39,7 +39,7 @@ using namespace OT;
#ifndef HB_NO_VISIBILITY #ifndef HB_NO_VISIBILITY
const void * const _hb_NullPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {}; const void * const _hb_NullPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {};
void * _hb_CrapPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {}; thread_local void * _hb_CrapPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {};
#endif #endif
int int
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册