Skip to content
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

reference-types: add final test: br_table #1264

Merged
merged 2 commits into from
Dec 14, 2019
Merged

reference-types: add final test: br_table #1264

merged 2 commits into from
Dec 14, 2019

Conversation

sbc100
Copy link
Member

@sbc100 sbc100 commented Dec 12, 2019

This requires some slighly different validation rules for MVP vs
interface-types.

There is a test in unreachable-invalid.wast that was removed in the
reference-types repo:
type-br_table-label-num-vs-label-num-after-unreachable

This test depends on the old validation rules and still exists in the
master testsuite so we need to continue to support both sets of rules
for now.

This requires some slighly different validation rules for MVP vs
interface-types.

There is a test in unreachable-invalid.wast that was removed in the
reference-types repo:
  type-br_table-label-num-vs-label-num-after-unreachable

This test depends on the old validation rules and still exists in the
master testsuite so we need to continue to support both sets of rules
for now.
@tlively
Copy link
Member

tlively commented Dec 12, 2019

Can you link to the spec of the updated validation rules?

@sbc100
Copy link
Member Author

sbc100 commented Dec 12, 2019

The change that removed the test in question was:
WebAssembly/reference-types#43

The new validation algorithm is at:
https://github.com/WebAssembly/reference-types/blob/master/document/core/appendix/algorithm.rst

I think this change relates to how the new bottom type and how the unreachable value stack works, but I don't fully understand the change.

@sbc100
Copy link
Member Author

sbc100 commented Dec 12, 2019

Ah the arity check is specified here:
https://github.com/WebAssembly/reference-types/blame/master/document/core/appendix/algorithm.rst#L225

result |= Result::Error;
PrintError("br_table labels have inconsistent arity: expected %" PRIzd
" got %" PRIzd,
br_table_sig_->size(), label_sig.size());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused about where we check that the types are compatible beyond their arity. In the algorithm.rst doc, this is done by a call to pop_vals, but where is it done here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That already happens above in the call to CheckSignature .. that basically ensure that the value stack contains the values that match the label. That part doesn't change.

Copy link
Member

@lukewagner lukewagner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@sbc100 sbc100 merged commit b238f21 into master Dec 14, 2019
@sbc100 sbc100 deleted the add_tr_table_test branch December 14, 2019 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants