[fpc-pascal] Freeing memory with exceptions

Sven Barth pascaldragon at googlemail.com
Wed May 24 14:08:16 CEST 2023


Benito van der Zander via fpc-pascal <fpc-pascal at lists.freepascal.org>
schrieb am Mi., 24. Mai 2023, 13:00:

> Hi,
>
> It is weird that your code calls setjmp? Are you using a non Windows
> platform?  Comparisons with Delphi should be done on Windows where the
> exception systems match. Apples to Apples please.
>
>
> It is FPC on Linux.
>
> And Delphi 4 on Linux (in WINE)
>

As Marco said, please compare using the same *target* platform otherwise
you're comparing apples with oranges due to different exception handling
mechanisms between Windows and Linux.


>
> Even if it wants to do the Linux nonsense, FPC could at least inline
> fpc_setjmp in fpc_pushexceptaddr to make it only one function call.
>

fpc_setjmp can not be unlined because a) it's an assembly function and b)
*relies* on being a separate function.

And fpc_pushexceptaddr not only accesses private state of the system unit,
it's also a larger function and thus inlining it would not provide any
benefit. Also combining them would not work, because they are for different
purposes.

The low level exception handling code is the way it is for reasons.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20230524/8ad65b57/attachment.htm>


More information about the fpc-pascal mailing list