[wasm][traphandler] Use C++11 thread_local keyword
V8 uses "thread_local" since several years now, so we can assume it to be available on all platforms. This avoids a cumbersome macro definition. R=ahaas@chromium.org Bug: v8:11755 Change-Id: I64826188a15a22238ffbcb3215a5b5d66470d573 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2885038 Reviewed-by: Andreas Haas <ahaas@chromium.org> Commit-Queue: Clemens Backes <clemensb@chromium.org> Cr-Commit-Position: refs/heads/master@{#74585}
This commit is contained in:
parent
9a3a73c193
commit
7243654958
@ -26,7 +26,7 @@ namespace trap_handler {
|
||||
// We declare this as int rather than bool as a workaround for a glibc bug, in
|
||||
// which the dynamic loader cannot handle executables whose TLS area is only
|
||||
// 1 byte in size; see https://sourceware.org/bugzilla/show_bug.cgi?id=14898.
|
||||
THREAD_LOCAL int g_thread_in_wasm_code;
|
||||
thread_local int g_thread_in_wasm_code;
|
||||
|
||||
static_assert(sizeof(g_thread_in_wasm_code) > 1,
|
||||
"sizeof(thread_local_var) must be > 1, see "
|
||||
|
@ -59,15 +59,6 @@ int V8_EXPORT_PRIVATE RegisterHandlerData(
|
||||
/// kInvalidIndex.
|
||||
void V8_EXPORT_PRIVATE ReleaseHandlerData(int index);
|
||||
|
||||
#if V8_OS_WIN
|
||||
#define THREAD_LOCAL __declspec(thread)
|
||||
#elif V8_OS_ANDROID
|
||||
// TODO(eholk): fix this before enabling for trap handlers for Android.
|
||||
#define THREAD_LOCAL
|
||||
#else
|
||||
#define THREAD_LOCAL __thread
|
||||
#endif
|
||||
|
||||
// Initially false, set to true if when trap handlers are enabled. Never goes
|
||||
// back to false then.
|
||||
extern bool g_is_trap_handler_enabled;
|
||||
@ -97,7 +88,7 @@ inline bool IsTrapHandlerEnabled() {
|
||||
return g_is_trap_handler_enabled;
|
||||
}
|
||||
|
||||
extern THREAD_LOCAL int g_thread_in_wasm_code;
|
||||
extern thread_local int g_thread_in_wasm_code;
|
||||
|
||||
// Return the address of the thread-local {g_thread_in_wasm_code} variable. This
|
||||
// pointer can be accessed and modified as long as the thread calling this
|
||||
|
Loading…
Reference in New Issue
Block a user