RESOLVED FIXED Bug 135895
Make bmalloc::PerThread work without C++ thread local storage
https://bugs.webkit.org/show_bug.cgi?id=135895
Summary Make bmalloc::PerThread work without C++ thread local storage
Daniel Bates
Reported 2014-08-13 12:30:34 PDT
Following up on Geoffrey Garen's comment (bug #135848, comment 4), we should look to remove the hardcoded constant __PTK_FRAMEWORK_JAVASCRIPTCORE_KEY0, which imposes a maintenance burden as we need to keep its value synchronized with the value of a macro define by the same name in System/pthread_machdep.h. This constant was hardcoded because the iOS public SDK neither includes the header System/pthread_machdep.h nor supports the use of the thread local storage attribute __thread as of the time of writing. One alternative to hardcoding the constant __PTK_FRAMEWORK_JAVASCRIPTCORE_KEY0 is to add logic for toolchains that don't support C++ thread local storage to initialize a shared Pthread key exactly once (say, using std::call_once()). Then we would use a similar approach to the System/pthread_machdep.h logic in <http://trac.webkit.org/browser/trunk/Source/bmalloc/bmalloc/PerThread.h?rev=166956#L56> and explicitly save/retrieve the thread-specific data using this shared key and pthread_{get, set}specific().
Attachments
Patch (5.50 KB, patch)
2014-08-13 14:12 PDT, Daniel Bates
ggaren: review+
Daniel Bates
Comment 1 2014-08-13 14:12:24 PDT
Geoffrey Garen
Comment 2 2014-08-13 14:16:58 PDT
Comment on attachment 236553 [details] Patch r=me The #ifdefs are starting to get gross, but I don't have a better suggestion :/.
Daniel Bates
Comment 3 2014-08-13 22:00:49 PDT
Daniel Bates
Comment 4 2014-08-13 22:12:11 PDT
Committed build fix in <http://trac.webkit.org/changeset/172577>.
Note You need to log in before you can comment on or make changes to this bug.