[PATCH] Segmented stack support ARM iOS

Tim Northover t.p.northover at gmail.com
Thu May 8 07:23:08 PDT 2014


Hi Valerii,

>  Is there a chance that Apple will reserve or re-purpose one of existing
> slots for segmented stacks like for it did it for Sj/Lj exception handling
> (see __PTK_LIBC_DYLD_Unwind_SjLj_Key)? [...]
>
>  The only moving part in this case will be implementation of
> pthread_getspecific_direct.

Even one moving target makes the entire scheme infeasible for iOS: the
feature could only ever be used by developers willing & able to
compile and sign their own software.

>> I still personally think the only portable solution is a generic callback.
>> If the performance impact of that is too great
>
> It is, considering it is a prologue for every function call.

The overhead of a cached function call (& return) is surprisingly
small on fairly modern CPUs. In a quick test, inlining the ARM64
implementation of pthread_getspecific into a tight loop saved about 1
cycle per iteration.

But regardless, I personally think that if segmented stacks need that
kind of OS-dependent hackery to perform acceptably, they're probably a
misfeature in the first place. That might just be me though.

Cheers.

Tim.



More information about the llvm-commits mailing list