Disabling threads on apple's hardware when optimizer is turned off (#692)

* Disabling threads on apple's hardware.

* Turns out that you can have your bread, your butter and you cake too!
This commit is contained in:
Daniel Lemire 2020-04-10 18:41:05 -04:00 committed by GitHub
parent 0fd159dadb
commit 4af7d6f108
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 0 deletions

View File

@ -81,6 +81,18 @@
#define SIMDJSON_THREADS_ENABLED
#endif
// workaround for large stack sizes under -O0.
// https://github.com/simdjson/simdjson/issues/691
#ifdef __APPLE__
#ifndef __OPTIMIZE__
// Apple systems have small stack sizes in secondary threads.
// Lack of compiler optimization may generate high stack usage.
// So we are disabling multithreaded support for safety.
#undef SIMDJSON_THREADS_ENABLED
#endif
#endif
#if defined(__clang__)
#define NO_SANITIZE_UNDEFINED __attribute__((no_sanitize("undefined")))
#elif defined(__GNUC__)