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

Validate arity of labels in br_table #368

Merged
merged 3 commits into from
Jun 4, 2020
Merged

Validate arity of labels in br_table #368

merged 3 commits into from
Jun 4, 2020

Conversation

gumb0
Copy link
Collaborator

@gumb0 gumb0 commented Jun 2, 2020

Required for #354.

There's a slight complication around loop's arity: turns out if there's loop in br_table labels, it's arity is considered always 0 (and then br_table is valid only if all labels have arity 0).
It's difficult to find clear confirmation of this in the spec, but spec tests cover it in this case https://github.com/WebAssembly/spec/blob/636b862b9c8a25ad65fb240fefd673e7f23bcdd0/test/core/br_table.wast#L1229-L1244

@codecov
Copy link

codecov bot commented Jun 3, 2020

Codecov Report

Merging #368 into master will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #368      +/-   ##
==========================================
+ Coverage   98.85%   98.86%   +0.01%     
==========================================
  Files          42       42              
  Lines       12184    12320     +136     
==========================================
+ Hits        12044    12180     +136     
  Misses        140      140              

@gumb0 gumb0 marked this pull request as ready for review June 3, 2020 10:25
@gumb0
Copy link
Collaborator Author

gumb0 commented Jun 3, 2020

I will squash test commits before merging.

@gumb0 gumb0 requested review from chfast and axic June 3, 2020 10:52

if (get_branch_arity(branch_frame) != default_branch_arity)
throw validation_error{"br_table labels have inconsistent block result types"};
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
throw validation_error{"br_table labels have inconsistent block result types"};
throw validation_error{"br_table labels have inconsistent types"};

... as wabt is reporting this...

@gumb0 gumb0 force-pushed the validate-br-table branch 2 times, most recently from e390f20 to 996a255 Compare June 3, 2020 12:25
@gumb0
Copy link
Collaborator Author

gumb0 commented Jun 3, 2020

Changed error message and squashed test commits.

@gumb0
Copy link
Collaborator Author

gumb0 commented Jun 4, 2020

Rebased.

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