https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71744

--- Comment #18 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Gleb Natapov from comment #16)
> Can you suggest an alternative to libgcc patch? Use other TLS model?
> Allocate per thread storage dynamically somehow?

If we want to use TLS (which I hope we don't), then e.g. a single __thread
pointer with some registered destructor that would free it on process exit
could do the job, and on the first exception it would try to allocate memory
for the cache and other stuff and use that (otherwise, if memory allocation
fails, just take a lock and be non-scalable).

Another alternative, perhaps much better, if Torvald is going to improve
rwlocks sufficiently, would be to use rwlock to guard writes to the cache etc.
too, and perhaps somewhat enlarge the cache (either statically, or allow
extending it through allocation).
I'd expect that usually these apps that use exceptions too much only care about
a couple of shared libraries, so writes to the cache ought to be rare.

Reply via email to