[fpc-devel] OO rewrite - technical questions
mschnell at lumino.de
Mon Jul 26 11:22:32 CEST 2010
On 07/24/2010 06:52 PM, Nikolai Zhubr wrote:
> IMHO the question is not how to avoid using FS trick altogether (which
> is of course possible, right), but on the contrary, how to reliably
> employ it in order to avoid wasting some more usefull registers and
> excessive OS calls.
It's only possible to dedicate another register to that purpose.
With X86/32 it does not seem to make much sense, as this arch has so few
registers and dedicating one would slow down all programs - and the
Win32 FS-"trick" documented in the unofficial aper mentioned above and
used in Delphi (and supposedly gnuC and M$ C) is believed to work fine
(AFAIK, in Linux GS is different with different threads and directly
points to the TLS, but I'm not sure, yet).
With X86/64 and other archs (such as ARM) that provide many general
purpose registers, I suppose it's a usual way to dedicate one of them as
a Thread Local Storage area pointer.
Maybe Win64 uses some "Selector" mechanism (similar as ) so that there
are no different Selector-Register values in different threads.
More information about the fpc-devel