-
Notifications
You must be signed in to change notification settings - Fork 0
Description
The idea would be, after generating the final binary, the exception analyzer can provide a list of functions that, when an exception is thrown, will always result in termination. So for example, consider main calls A() -> B() -> C(). There are not try/catch blocks in main for when A is called, and A does not have a try catch block. B and C can throw. If the exception unwinder sees its in C or B, is there a way to tell it that there is no use in proceeding, ensuring that we terminate very fast.
Those functions were not declared as "strongly" noexcept in the source code, but the function itself is de-facto noexcept given what I stated above. Noexcept includes main or functions passed to std::thread. If such functions are spotted, mark them as noexcept (0x1) in the exception index. When performing the re-ordering of the functions, ensure that the noexcept functions are merged into a single section to ensure that only one exception index entry is required for all noexcept functions. This should greatly reduce the exception index if enough functions are found with this property, which helps to reduce the cost of using a binary search to find the entry in the table, and likely will cause the lookup of the noexcept functions to be and immediate near point estimation.
This is a bit of a flow of consciousness but I wanted to ensure that I got this down before I forgot. Thanks to Mark for giving me the idea of this optimization.