[fpc-devel] The 15k bounty: Optimizing executable speed for Linux x86 / LLVM

Karoly Balogh (Charlie/SGR) charlie at scenergy.dfmk.hu
Thu Oct 25 17:38:13 CEST 2018


Hi,

On Thu, 25 Oct 2018, Michael Van Canneyt wrote:

> >>> - Make Exception handling, TLS etc use the infrastructure that
> >>>  libpthread is providing
> >>
> >> TLS is handled already by libpthread. I doubt you will gain much there.
> >>
> >
> > GCC has (depending on the platform) a faster implementation for "__thread"
> > variables. E.g. on x86 it uses the GS segment and the data is stored in ELF
> > sections. There were experiments in the past to support this in FPC as
> > well, so maybe we're on a good way there already.
>
> That is good news.  The contours of a TODO list are becoming visible :)
>
> But we may need also need a solution for other platforms, which means the
> current system should remain in place for those platforms where such a
> system is not present ?

FPC already has some code to support section threadvars via the GS segment
on i386 at least, but it doesn't seem to be enabled by default? (Couldn't
test it, but the tf_section_threadvars target flag, which enable this is
actually behind a define in i_linux.pas, which I couldn't find enabled
anywhere?). Also tf_section_threadvars flag has some code to support it
all over the compiler, including the x86 cg. I have some really vague
memories I actually enabled it in some experimental local version I had,
and it worked on first sight at least, but I could be completely off here.

I wonder why it was never enabled by default. Maybe to keep compatibility
to some older Linux version, which didn't support this yet?

IOW, it might be an one line change. Can I take some of the bounty now? :P

Charlie



More information about the fpc-devel mailing list