This is an archive of the discontinued LLVM Phabricator instance.

Segmented stack support ARM iOS
Needs ReviewPublic

Authored by vhbit on Apr 23 2014, 11:32 AM.

Details

Reviewers
t.p.northover
Summary

Patch enables support of segmented stacks on armv7 iOS.

Although it seems to work fine, it relies on a couple of assumptions made about iOS internals which could be wrong so input from Apple engineers is really important.

To be precise, it uses Apple-specific implementation of _pthread_{get,set}specific_direct taken from http://www.opensource.apple.com/source/Libc/Libc-825.40.1/pthreads/pthread_machdep.h and uses static key #149. While it is not in Apple-reserved range (0..119 as of libc 825.40.1), it still unclear if it is smaller than total count of reserved slots.

Diff Detail

Event Timeline

vhbit updated this revision to Diff 8779.Apr 23 2014, 11:32 AM
vhbit retitled this revision from to Segmented stack support ARM iOS.
vhbit updated this object.
vhbit edited the test plan for this revision. (Show Details)
vhbit set the repository for this revision to rL LLVM.
vhbit added a subscriber: Unknown Object (MLST).
t.p.northover edited edge metadata.May 8 2014, 2:22 AM

Hi Valerii,

To be precise, it uses Apple-specific implementation of _pthread_{get,set}specific_direct taken from http://www.opensource.apple.com/source/Libc/Libc-825.40.1/pthreads/pthread_machdep.h and uses static key #149. While it is not in Apple-reserved range (0..119 as of libc 825.40.1), it still unclear if it is smaller than total count of reserved slots.

We've checked with some people in here, and both the entire static range and the implementation of the pthread_getspecific functions themselves are reserved. User code shouldn't be relying on either. Since they're liable to change at any point, this would probably block any program that made those assumptions from the App Store.

I still personally think the only portable solution is a generic callback. If the performance impact of that is too great, we should be trying to come up with a solution that doesn't involve importing every platform under the sun's OS-specific code into FrameLowering (an already very sensitive area of the ARM target: I think most of the bugs I've personally introduced to LLVM have been there).

Cheers.

Tim.