-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Emergency EH buffer is overspecified #151
Comments
I think the ABI should support a compilation mode in which an exception can always be thrown, translated to Maybe we can even use a tagged pointer to preserve some information about the exception that had to be translated (like its Once we have a non-terminating implementation, I wonder if we still need the emergency pool. |
It would be nice if there was some allowance for non-unique exceptions. If the runtime created a single |
I agree that this seems weirdly over-specified. The ABI document should only describe the high-level requirements of the interface, and I don't see why anything about the underlying allocation scheme needs to be part of that. If we can't come up with a high-level requirement that implementations can reasonably live up to (e.g. that we can throw at least one emergency exception on every thread, which would require us to eagerly reserve that space in every thread allocation, which we probably don't want to do), then we shouldn't say anything normative at all. In that case, we should just make a strong recommendation that implementations have some limited ability to throw exceptions even when allocation fails. |
It seems to be an open question whether this is actually ruled out. You can convincingly argue that distinct evaluations of one-operand With that said, I don't think implementations should try this without getting the committee's blessing first. |
Ah good point. I think we agree that an arbitrary
A few of us on the committee have already been tossing the idea around. Maybe it's time to formalize it. |
Sounds great.
Yeah, completely agreed there, absent some further permission from the standard. |
The description of the emergency buffer in 3.3.1 Exception Storage seems rather overspecified.
bad_alloc
from more than 16 at once, as OOM happens for them all at once.std::bad_alloc
(typically a single pointer) or any other standard exception (std::filesystem::filesystem_error
is six pointers for libstdc++, and that contains an error code, a string, and twofilesystem::path
objects!). The exception header is <= 15 pointers, but that still means you could allocate eightbad_alloc
exceptions using that 1kB. I don't see why the spec should be "optimized" for people throwing unreasonably large classes.__cxa_allocate_exception
only requests a smaller allocation. This allows the buffer to be used for far more than 16 * 4 * 1kB allocations.bad_alloc
exceptions (including their headers) to fit in the buffer before it fills up. Double that on 32-bit systems. On 16-bit systems reserving 64kB to be able to deal with two thousand exceptions in parallel is completely unnecessary!__cxa_exception
headers, and (typically) fewer cores and fewer threads, making the 64kB doubly wasteful.Recommendations:
The text was updated successfully, but these errors were encountered: