[LLVMdev] RFC: Native Windows C++ exception handling
Reid Kleckner
rnk at google.com
Tue Jan 27 13:55:28 PST 2015
On Tue, Jan 27, 2015 at 12:58 PM, Kaylor, Andrew <andrew.kaylor at intel.com>
wrote:
> Thanks, Reid. These are good points.
>
>
>
> So I guess that does take us back to something more like my original
> proposal.
>
>
>
> I like your suggestion of having some kind of “eh.actions” intrinsic to
> represent the outlining rather than the extension to landingpad that I had
> proposed. I was just working on something like that in conjunction with my
> second alternative idea.
>
Great!
> What I’d really like is to have the “eh.actions” intrinsic take a shape
> that makes it really easy to construct the .xdata table directly from these
> calls. As I think I mentioned in my original post, I think I have any idea
> for how to reconstruct functionally correct eh states (at least for
> synchronous EH purposes) from the invoke and landingpad instructions. I
> would like to continue, as in my original proposal, limiting the unwind
> representations to those that are unique to a given landing pad. I think
> with enough documentation I can make that seem sensible.
>
My thinking is that the "eh.actions" list can be transformed into a compact
xdata table later, after we've done machine basic block layout.
I think the algorithm will be something like
1. Input: already laid out MachineFunction
2. Call EHStreamer::computeCallSiteTable to populate a LandingPadInfo
vector sorted by ascending PC values
4. Iterate the LandingPadInfos, comparing the action list of each landing
pad with the previous landing pad, assuming an empty action list at
function start and end.
5. Model the action list as a stack, and compute the common suffix of the
landing pad action lists
6. Each new action pushed represents a new EH state number
7. Pushing a cleanup action adds a state table entry that transitions from
the current EH state to the previous with a cleanup handler
8. Pushing a catch action adds a new unwind table entry with an open range
from the current EH state to an unknown EH state. The state after catching
is... ???
9. Popping a catch action closes an open unwind table range
So, I think the action list is at least not totally crazy. =)
I’ll start working on a revised proposal. Let me know if you have any more
> solid ideas.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150127/4809fa20/attachment.html>
More information about the llvm-dev
mailing list