diff options
author | Thomas Neumann <tneumann@users.sourceforge.net> | 2022-12-09 18:23:44 +0100 |
---|---|---|
committer | Thomas Neumann <tneumann@users.sourceforge.net> | 2022-12-17 00:48:25 +0100 |
commit | 6e56633daae79f514b0e71f4d9849bcd8d9ce71f (patch) | |
tree | ca386c29cd4093b38d5b84ac429157550b2edc50 /gcc/analyzer | |
parent | 1c118c9970600117700cc12284587e0238de6bbe (diff) | |
download | gcc-6e56633daae79f514b0e71f4d9849bcd8d9ce71f.zip gcc-6e56633daae79f514b0e71f4d9849bcd8d9ce71f.tar.gz gcc-6e56633daae79f514b0e71f4d9849bcd8d9ce71f.tar.bz2 |
initialize fde objects lazily
When registering an unwind frame with __register_frame_info_bases
we currently initialize that fde object eagerly. This has the
advantage that it is immutable afterwards and we can safely
access it from multiple threads, but it has the disadvantage
that we pay the initialization cost even if the application
never throws an exception.
This commit changes the logic to initialize the objects lazily.
The objects themselves are inserted into the b-tree when
registering the frame, but the sorted fde_vector is
not constructed yet. Only on the first time that an
exception tries to pass through the registered code the
object is initialized. We notice that with a double checking,
first doing a relaxed load of the sorted bit and then re-checking
under a mutex when the object was not initialized yet.
Note that the check must implicitly be safe concering a concurrent
frame deregistration, as trying the deregister a frame that is
on the unwinding path of a concurrent exception is inherently racy.
libgcc/ChangeLog:
* unwind-dw2-fde.c: Initialize fde object lazily when
the first exception tries to pass through.
Diffstat (limited to 'gcc/analyzer')
0 files changed, 0 insertions, 0 deletions