public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgcc/56460] New: _Unwind_Find_FDE is O(n) in the number of frame infos, (and LLVM's JIT will generate many of them)
@ 2013-02-26 14:42 cr at progress dot com
  2013-02-26 14:43 ` [Bug libgcc/56460] " cr at progress dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: cr at progress dot com @ 2013-02-26 14:42 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56460

             Bug #: 56460
           Summary: _Unwind_Find_FDE is O(n) in the number of frame infos,
                    (and LLVM's JIT will generate many of them)
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgcc
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: cr@progress.com


Using LLVM with stack unwinding code calls __register_frame_info for every
function it JITs.  After generating a large number of functions, any occurrence
of throwing an exception (even in G++ compiled code) takes a very long time
(10's of milliseconds if 50,000 functions are generated) between  the throw and
catch, even if the catch is in the same function.  

Profiling and code inspection shows that the time is spent in _Unwind_Find_FDE
where it linearly walks the seen_objects linked list, looking for an object to
map the PC's on the stack up to.  Typically, there is at most one frame_info
registered per shared object, so typically a low number.  But if we want to
dynamically add a large number (as LLVM's JIT does; one per function), we could
maintain an ordered array of objects and perform a binary search of that array.

A proposed diff is attached.  We're seeing significant performance improvements
with this patch.


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-04-14 22:30 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-26 14:42 [Bug libgcc/56460] New: _Unwind_Find_FDE is O(n) in the number of frame infos, (and LLVM's JIT will generate many of them) cr at progress dot com
2013-02-26 14:43 ` [Bug libgcc/56460] " cr at progress dot com
2013-02-26 18:27 ` steven at gcc dot gnu.org
2013-02-26 22:57 ` steven at gcc dot gnu.org
2013-02-27 12:16 ` cr at progress dot com
2013-02-27 21:10 ` stevenb.gcc at gmail dot com
2013-02-27 21:15 ` steven at gcc dot gnu.org
2013-02-27 21:17 ` steven at gcc dot gnu.org
2015-04-14 22:30 ` daekharel at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).