Conversation
This implements the second half of WebAssembly/design#489. Desugaring br_if to if+break was fairly awkward; adding br_if to the kernel language was straightforward and avoided the awkwardness. This change happened to expose an aspect of `br_if`'s type checking which differed from my expectations, so I've taken the liberty of fixing that too. See the deleted assert_invalid in test/labels.wast and the added $br_if1 testcase. `br_if` either sends its value to the destination label or to its own result.
|
The prior type check appears to be because Your changes to the type checking appear to be consistent with With the change, is there still the duplication noted in #227 ? Perhaps it resolves that issue too. This might have some interaction with #215 Any opinion on WebAssembly/design#529 while your working in this area? |
|
I don't wish to connect this issue to #215 or #227. Accordingly, I've now removed that part of the change. This PR now just contains the operand order change. I would also like to keep this issue focused and avoid discussions of WebAssembly/design#529. |
|
@sunfishcode Are you saying you don't understand the type system issues and can not answer these questions? Does it change the existing behaviour as noted in #227 ? Does it change the 'arity' checking as noted in #215 ? Or are you asking for help, do you want other people to check this and give feedback? This does move the arguments around, and it would look better to me if the label were first, and the v8 encoding has the label depth first, it is an immediate, and having it last is also not consistent with |
|
I'm saying I don't want the part of this PR I'm primarily interested in to get lost in tangential discussions. |
|
This does change the behaviour of the issue noted in #227 For example this now passes: This seems a good thing to me, but there have been different opinions! |
|
Fwiw is seems to be neutral wrt #215 The following still gives an 'arity mismatch' error: |
|
So it does; I've now added the testcase. |
3729658 to
74cf378
Compare
ml-proto/host/parser.mly
Outdated
| | BR var expr_opt { fun c -> Br ($2 c label, $3 c) } | ||
| | BR_IF expr var expr_opt { fun c -> Br_if ($2 c, $3 c label, $4 c) } | ||
| | BR_IF expr var { fun c -> Br_if (None, $2 c, $3 c label) } | ||
| | BR_IF expr expr var { fun c -> Br_if (Some ($2 c), $3 c, $4 c label) } |
There was a problem hiding this comment.
That syntax is really odd. The argument should still go after the label, to be consistent with plain br (and calls). So I think this should be BR_IF var expr expr instead.
|
Looks good modulo the argument order. It's really unfortunate that the kernel now loses orthogonality and has to duplicate the break logic, but I have no better answer either (other than removing |
|
@rossberg-chromium Thanks! I added a patch to put the argument after the label. |
|
lgtm |
|
Thanks! |
Add SpiderMonkey implementation status
Fix index entry spellings and consistent tag for labeltype def.
This implements the second half of WebAssembly/design#489.
Desugaring br_if to if+break was fairly awkward; adding br_if to the kernel
language was straightforward and avoided the awkwardness.
This change happened to expose an aspect of
br_if's type checking whichdiffered from my expectations, so I've taken the liberty of fixing that
too. See the deleted assert_invalid in test/labels.wast and the added
$br_if1 testcase.
br_ifeither sends its value to the destination labelor to its own result.