[fpc-devel] Exceptions on wiki
J. Gareth Moreton
gareth at moreton-family.com
Thu Aug 2 19:13:35 CEST 2018
The information in the Wiki about how exception frames are set up is
pretty nice. I didn't know that 'raise' creates an exception frame for the
procedure it appears in, but explains why it's often shipped off to another
local procedure. Very useful information!
True though, it's hard to generalise the performance impact of exception
handlers and try...finally blocks, although I think the simple rule of
thumb is that there is a performance hit no matter what you try.
Gareth aka. Kit
On Thu 02/08/18 06:54 , Sven Barth via fpc-devel
fpc-devel at lists.freepascal.org sent:
Kirinn schrieb am Mi., 1. Aug. 2018, 23:30:
Hi all,
Inspired by Gareth aka. Kit's infectious enthusiasm, and the recent long
discussion on exceptions on this list, I wrote up an article on
Exceptions on the FPC wiki. (Strangely enough we didn't have one before.)
http://wiki.freepascal.org/Exceptions [2]
I hope it'll be useful, and not entirely inaccurate! Particularly the
part about performance. If a programmer knows exactly what each
exception statement inserts in the code, that should help in deciding
when to worry about the performance, and when to embrace the convenience.
Please note that you can't generalize the performance impact as it depends
on the used exception handling mechanism. By default FPC uses
setjmp/longjmp which exhibit the behavior you described. On Win64 however
SEH is used which - in that platform - relies on metadata inside the binary
to mark the areas for a protected block (no matter whether it's for
"except" or "finally"). On Win32 with SEH enabled (which isn't the default
currently) it is again different. And should we decide to support DWARF
exception frames that would again be different.
Regards, Sven _______________________________________________
fpc-devel maillist - fpc-devel at lists.freepascal.org [3]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
[4]">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Links:
------
[1] mailto:kirinn at mooncore.eu
[2] http://wiki.freepascal.org/Exceptions
[3] mailto:fpc-devel at lists.freepascal.org
[4] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20180802/acec97b1/attachment.html>
More information about the fpc-devel
mailing list