-
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
Behavior for try-delegate targeting catch-less try? #164
Comments
The semantics you propose are in line with the formalism in #143, so with that interpretation it should be fine for I suppose it will be good to describe a catchless try as one that rethrows any exception occurring in its try block instead of it being "effectively a regular block". As a "regular block" it can't be the target of try-delegate but that seems complicated, because in a one-pass validation run we don't know how to distinguish between a catchless and catchfull try until we read |
What @ioannad said. This is really just a case of delegating to a try that does not handle the current exception. Btw, is it allowed to delegate to another try-delegate? |
@rossberg, yes, delegate can target any try block (so any try label). Btw I noticed the proposal overview says
Given that catchless trys are valid, perhaps it would be simpler conceptually if we talk about the
What do you think, @aheejin? Btw, if we do look at it like that, what is the reason for the restriction on |
For catchless And yes, as @ioannad said, |
See WebAssembly/exception-handling#164 for a discussion of the intended behavior of this case. Simplifies try note handling by using the existing mechanism and just installing a no-handler rethrow pad. Differential Revision: https://phabricator.services.mozilla.com/D118789
Sorry I think what I said above was confusing. The destination doesn't change depending on whether Examples in these comments reflect my understanding correctly: |
Sorry for flip-flopping, but I started to think that it might be more consistent to make try-delegate targetting catchless try a validation failure. As I described in #146 (comment), the current rule is as follows: try $label0
try
delegate $label0 ;; delegates to catch ($label0)
catch ($label0)
try
delegate $label0 ;; validation failure because we cannot delegate upwards
end Note that we consider the second try-delegate a validation failure, not delegating to the enclosing Also, |
But this is unrelated. In a try with no catches, the second case cannot even occur, by construction, since this is a case that can only arise within a catch. So there is nothing to rule out. Similarly, there cannot be, by construction, a rethrow targetting a "catchless try", because that would have to occur within a catch clause hat doesn't exist in the first place. So again, there is nothing new to be ruled out. |
I agree with @rossberg .
I believe @aheejin is talking about this case: try
rethrow 0
end which everyone seems to agree is a validation failure. This is not a special case and follows from the I also agree that delegating to a |
OK, I'll update the explainer reflecting those lines. |
- Removes the sentence that catchless `try` is the same as a regular `block`, because it can be targetted by `delegate`. - Improves a few sentences - Adds examples for catchless try Closes WebAssembly#164.
- Removes the sentence that catchless `try` is the same as a regular `block`, because it can be targetted by `delegate`. - Improves a few sentences - Adds examples for catchless try Closes WebAssembly#164.
See WebAssembly/exception-handling#164 for a discussion of the intended behavior of this case. Simplifies try note handling by using the existing mechanism and just installing a no-handler rethrow pad. Differential Revision: https://phabricator.services.mozilla.com/D118789
Something I overlooked when reviewing #157 was what the behavior of
try-delegate
should be when it targets a catchlesstry
block. For example:I think I didn't see discussion of this particular case anywhere, sorry if I missed it. A semantics that might make sense is that this will just delegate to the next enclosing catch block (effectively rethrows from
try $l
). Any thoughts on how this should be specified?The text was updated successfully, but these errors were encountered: