-
Notifications
You must be signed in to change notification settings - Fork 35
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
Should the instructions in an unwind
block return results?
#129
Comments
In order to support |
@RossTate, I am not sure how Now that I think about it, I am also unsure what should happen when |
A |
Sorry I wasn't clear, this is not what I meant with "a label inside" the catching try block, perhaps "a label between" is a better way to put it. To be concrete, I was thinking of something like the following example:
This is currently possible, I think, and the thrown exception from inside |
Thanks for the concrete example! To support unwinding clauses in various languages (like
Does that make sense? |
Ross, the semantics you describe make sense to me, but I'm not clear on the motivation behind them. You've mentioned that branching out of |
@RossTate is suggesting that we should be able to use As I said, LLVM compiles away |
@ioannad In your code example, I think the execution sequence should be,
|
@aheejin I am not sure where I should comment on this. I commented on the relevant part of your PR#137 but we could talk about this here instead if you think that's better. |
There are two aspects to As an example, take the following Java code (with instructions sequences
From a generator standpoint, the easiest thing would be to compile this to
This would be possible with the Without that, we instead generate the following:
Note that we still need to put To summarize, we need |
I hope we can keep issues to their original author's questions; so in this issue I'd like discuss semantics of To answer your question, I think in the current status of But as I said, I hope we can focus on the semantics of current |
I don't think we necessarily need a restriction on block types for try-unwind blocks. Compilers can possibly make use of the return type for optimizations; for example when |
So the original question was whether |
* [interpreter] Simplify zero-len and drop semantics * Update overview * [spec] Change drop semantics * [spec] Forgot to adjust prose for *.init ops * [spec] Adapt to early OOB checks * [spec] Fix OOB for table rules * [spec] Spec memory OOB * [spec] Extend store typing to elem and data instances * Apply suggestions from code review Co-Authored-By: Ryan Hunt <rhunt@eqrion.net> * Comments * [spec] Fix uses of table.set
In my draft formal spec for this (3rd) EH proposal, in the validation step for
try bt instr_1* unwind instr_2* end
, the unwind-instructionsinstr_2*
are required to have blocktype[]->[]
.I think this makes sense because
unwind
probably just concerns side effects (open/close a file, alter a mutable global, etc). And althoughinstr_2*
will only get executed while the stack is being unwound due to an exception throw,instr_2*
could contain abr
or areturn
, in which case such result values would be ignored.Should
instr_2*
be allowed to return values?The text was updated successfully, but these errors were encountered: