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 number of instructions in constant expression #377

Merged
merged 2 commits into from
Jun 26, 2020

Conversation

gumb0
Copy link
Collaborator

@gumb0 gumb0 commented Jun 8, 2020

Based on #372
Based on #397

According to validation spec, result of constant expression has type

  • [t] for global initializer
  • [i32] for offset initializers

This implies that constant expression can have only single *.const or global.get instruction.

Spec tests check that with expected error "type mismatch": https://github.com/WebAssembly/spec/blob/60facfbb74cbb9f818258bbb07d02c581352e592/test/core/global.wast#L281-L289

@gumb0 gumb0 force-pushed the validate-constexpr-count branch 3 times, most recently from e71632e to 54615db Compare June 8, 2020 11:06
@codecov
Copy link

codecov bot commented Jun 8, 2020

Codecov Report

Merging #377 into master will increase coverage by 0.00%.
The diff coverage is 97.47%.

@@           Coverage Diff           @@
##           master     #377   +/-   ##
=======================================
  Coverage   99.16%   99.16%           
=======================================
  Files          43       43           
  Lines       13027    13048   +21     
=======================================
+ Hits        12918    12939   +21     
  Misses        109      109           

@gumb0 gumb0 marked this pull request as ready for review June 8, 2020 11:22
lib/fizzy/parser.cpp Outdated Show resolved Hide resolved
test/unittests/validation_test.cpp Outdated Show resolved Hide resolved
lib/fizzy/parser.cpp Outdated Show resolved Hide resolved
@gumb0 gumb0 force-pushed the validate-constexpr-count branch from 54615db to 2fbdac5 Compare June 8, 2020 15:24
@gumb0 gumb0 force-pushed the validate-constexpr-count branch from 2fbdac5 to 6df94a8 Compare June 26, 2020 16:35
@gumb0 gumb0 force-pushed the validate-constexpr-count branch from 6df94a8 to c189718 Compare June 26, 2020 16:43
@gumb0 gumb0 requested review from chfast and axic June 26, 2020 16:45
@axic axic merged commit 1bfdc55 into master Jun 26, 2020
@axic axic deleted the validate-constexpr-count branch June 26, 2020 17:07
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