[fpc-devel] FPProfiler

Karoly Balogh (Charlie/SGR) charlie at scenergy.dfmk.hu
Mon Feb 19 12:01:07 CET 2018


On Mon, 19 Feb 2018, Sven Barth via fpc-devel wrote:

> It's not the same scenario as heaptrc is entirely working in the RTL
> without any compiler extension (aside from the -gh parameter). Profiling
> code however would require extensions to the compiler whereby it would
> also need to handle exceptions correctly and such things.

Yes, but it's still worth thinking about how to generalize the current GNU
Profiler support we have, which is messy at places, and of course entirely
depends on GNU Profiler. But it's still mostly about generating a call to
_mcount in various ways, taking the stackframe of various platform ABI
into account. In theory a call to _mcount could be replaced with a
compilerproc, which you could then override in the RTL, allowing a way to
add support for various profilers.

I'm sure it would allow moving out some of the complexity from the
compiler to the RTL, and make things more flexible in the end.

(And GNU profiler's _mcount itself also depends on GCC/GLibc
implementation details per platform.)


More information about the fpc-devel mailing list