-
Notifications
You must be signed in to change notification settings - Fork 36
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
Add 'end' at the end of 'catch' as well #73
Comments
end
at the end of `catch as well
Personally I think of the |
As I wrote in the example above, for
Even if two rethrows are in the same I'm ok with not adding an additional |
Ok, I see. I think the example actually suggests that the |
Oh right... then adding |
I don't understand. I thought that with the current design, rethrow doesn't have any immediate anymore, and that you can simply use a regular branch? |
Can we continue discussion in #74, because the title of this issue is misleading? |
The data count section has a count that must match the number of data segments. If the data count section isn't present, then `memory.init` and `data.drop` cannot be used. Fixes issue WebAssembly#73.
#52 discussed how should folded format for
try
andcatch
would look like, and we settled onBut in real instructions, currently this sequence is
I'm wondering, can we add
end
at the end of catch as well, to match the text format, like this?This would increase the code size slightly, so I'm not pushing hard for this, but just would like to hear people's opinions. I'm not proposing to promote
catch
to a full block that can take a signature. It will not take a signature, but it will be counted as a block boundary when we compute relative depth forbr
,br_if
(and other branch instructions that will be added in future), andrethrow
.Backstory:
It's not currently in the spec, and I'm planning to add this to the spec text soon, but anyway the plan is to add a 'depth' argument to the
rethrow
instruction so that it can rethrow not only to the innermost enclosingcatch
but also to any outercatch
es. This was first suggested in #29 (comment). Without this code generation for exception becomes very difficult, because we can't structure control flow for EH as in with branches with depth arguments.So the advantage of adding
end
at the end ofcatch
is, we can makerethrow
's new 'depth' argument consistent. I'd like to computerethrow
's depth argument in the same way as we compute branch's depth argument, but in the current spec, it can't be done. When computing depths,For branches,
block
/loop
/try
: stack depth +1end_block
/end_loop
/end_try
: stack depth -1For rethrows,
block
/loop
/try
: stack depth +1end_block
/end_loop
/catch
: stack depth -1 (notend_try
!)To avoid this problem, the current LLVM toolchain implementation maintains separate EH stack for
rethrow
depth calculation, in the way that EH stack depth is only incremented withtry
and decremented withcatch
and does not count otherblock
s orloop
s. We can do it this way, but if the code size increase for addingend
at the end ofcatch
is negligible, it would make the way of computing depth argument for branches and rethrows the same, which is more consistent.@mstarzinger and I discussed how to compute
rethrow
's depth argument over email chain a little, and I'm also not sure if we settled on a conclusion.The text was updated successfully, but these errors were encountered: