[fpc-pascal] CRelocateThreadVar called from fpc_pushexceptaddr/fpc_popaddrstack
Seth Grover
sethdgrover at gmail.com
Thu Sep 9 20:38:38 CEST 2010
The documentation
(http://www.freepascal.org/docs-html/prog/progse46.html) indicates
that "RelocateThreadVar is called each time when a thread is started,
and once for the main thread."
Is it not called much more frequently than this? I was doing some
profiling with valgrind and noticed that every call to
fpc_pushexceptaddr/fpc_popaddrstack resulted in a call to
CRelocateThreadVar. From stepping through in gdb, it appears that
*every* time a threadvar is accessed (in this case, the exception
stack). It doesn't run through all of the code of CRelocateThreadVar
because of the non-nill result of pthread_getspecific, but it is
called.
It seems that every time a threadvar is accessed, we're checking to
make sure threadvars have been initialized/allocated for this
particular thread. Is that correct? If not, can someone explain the
reasoning behind this to me?
I can certainly see why exceptions are to be avoided in
performance-critical code. :).
Thanks,
Seth
--
This email is fiction. Any resemblance to actual events
or persons living or dead is purely coincidental.
Seth Grover
sethdgrover[at]gmail[dot]com
More information about the fpc-pascal
mailing list