Bug 135848

Summary: [iOS] Make JavaScriptCore and bmalloc build with the public SDK
Product: WebKit Reporter: Daniel Bates <dbates>
Component: JavaScriptCoreAssignee: Daniel Bates <dbates>
Status: RESOLVED FIXED    
Severity: Normal CC: aestes, commit-queue, ddkilzer, dfarler, ggaren, joepeck
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: iPhone / iPad   
OS: Unspecified   
Bug Depends on: 135843    
Bug Blocks:    
Attachments:
Description Flags
Patch ggaren: review+

Description Daniel Bates 2014-08-12 12:43:39 PDT
Towards getting iOS WebKit built using the iOS public SDK, get the WTF, JavaScriptCore, and bmalloc projects building with the iOS public SDK.
Comment 1 Daniel Bates 2014-08-12 12:48:56 PDT
Created attachment 236459 [details]
Patch
Comment 2 WebKit Commit Bot 2014-08-12 12:51:36 PDT
Attachment 236459 [details] did not pass style-queue:


ERROR: Source/bmalloc/bmalloc/PerThread.h:36:  __PTK_FRAMEWORK_JAVASCRIPTCORE_KEY0 is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
Total errors found: 1 in 8 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Joseph Pecoraro 2014-08-12 13:05:18 PDT
Comment on attachment 236459 [details]
Patch

Remote Inspector changes look fine to me.
Comment 4 Geoffrey Garen 2014-08-12 13:57:26 PDT
Comment on attachment 236459 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=236459&action=review

r=me

> Source/bmalloc/bmalloc/PerThread.h:39
> +#elif BPLATFORM(IOS_SIMULATOR)
> +const pthread_key_t __PTK_FRAMEWORK_JAVASCRIPTCORE_KEY0 = 90;
> +INLINE int _pthread_setspecific_direct(pthread_key_t key, const void* value) { return pthread_setspecific(key, value); }
> +INLINE void* _pthread_getspecific_direct(pthread_key_t key) { return pthread_getspecific(key); }
> +extern "C" int pthread_key_init_np(int, void (*destructor)(void*));

Does the __thread code patch not work in the iOS simulator? If it does work, I think it would be slightly better, so we wouldn't have the brittleness of defining this constant for ourselves.
Comment 5 Mark Rowe (bdash) 2014-08-12 18:52:58 PDT
It's not necessary to check defined(__has_include) in Mac-only files.
Comment 6 Daniel Bates 2014-08-13 12:31:49 PDT
(In reply to comment #4)
> (From update of attachment 236459 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=236459&action=review
> 
> r=me
> 
> > Source/bmalloc/bmalloc/PerThread.h:39
> > +#elif BPLATFORM(IOS_SIMULATOR)
> > +const pthread_key_t __PTK_FRAMEWORK_JAVASCRIPTCORE_KEY0 = 90;
> > +INLINE int _pthread_setspecific_direct(pthread_key_t key, const void* value) { return pthread_setspecific(key, value); }
> > +INLINE void* _pthread_getspecific_direct(pthread_key_t key) { return pthread_getspecific(key); }
> > +extern "C" int pthread_key_init_np(int, void (*destructor)(void*));
> 
> Does the __thread code patch not work in the iOS simulator? If it does work, I think it would be slightly better, so we wouldn't have the brittleness of defining this constant for ourselves.

No, __thread isn't available when building for iOS Simulator. Filed bug #135895 to consider adding logic for toolchains that don't support C++ thread local storage. I'll add a FIXME comment that references bug #135895 for now.
Comment 7 Daniel Bates 2014-08-13 12:32:27 PDT
(In reply to comment #5)
> It's not necessary to check defined(__has_include) in Mac-only files.

Will remove the check for "defined(__has_include) " from the Mac-only files in this patch before landing.
Comment 8 Daniel Bates 2014-08-13 12:43:47 PDT
Committed r172532: <http://trac.webkit.org/changeset/172532>