summaryrefslogtreecommitdiff
path: root/src/validator.cc
diff options
context:
space:
mode:
authorBen Smith <binji@chromium.org>2018-09-06 19:06:00 -0700
committerBen Smith <binjimin@gmail.com>2018-09-06 22:37:59 -0700
commit140224fb8692ed081c46a357052ccaaff81e71a2 (patch)
tree97d0177ac31ed7ef609ef41c8d24baa3ea0481e3 /src/validator.cc
parente0719fe0fe504c497d9fb7510fe68499c08179f4 (diff)
downloadwabt-140224fb8692ed081c46a357052ccaaff81e71a2.tar.gz
wabt-140224fb8692ed081c46a357052ccaaff81e71a2.tar.bz2
wabt-140224fb8692ed081c46a357052ccaaff81e71a2.zip
Fix some multi-value bugs; run spec tests
Running the multi-value spec tests found a few bugs: * DropKeep needs to copy the kept values backward when the regions overlap. * Type names need to be resolved to indexes in block declarations (e.g. `block (type $foo)`) * `if` without an `else` is valid, it just behaves as though the `else` is empty, which will pass the params through as results. * When validating function signatures, we need to also check block declaration signatures. * Split `ResolveFuncType` into two functions: `ResolveFuncTypeWithEmptySignature` and `ResolveImplicitlyDefinedFunctionType`. * When resolving implicitly defined function types, we only create an implicit function type when the type is not inlinable; i.e. only for block/loop/if with 0 or 1 result values and no params. * Change `update-spec-tests` to include the `multi-value` proposal repo from the testsuite.
Diffstat (limited to 'src/validator.cc')
-rw-r--r--src/validator.cc30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/validator.cc b/src/validator.cc
index a418e309..27bf2422 100644
--- a/src/validator.cc
+++ b/src/validator.cc
@@ -1398,11 +1398,41 @@ class Validator::CheckFuncSignatureExprVisitorDelegate
explicit CheckFuncSignatureExprVisitorDelegate(Validator* validator)
: validator_(validator) {}
+ Result BeginBlockExpr(BlockExpr* expr) override {
+ validator_->CheckBlockDeclaration(&expr->loc, Opcode::Block,
+ &expr->block.decl);
+ return Result::Ok;
+ }
+
Result OnCallIndirectExpr(CallIndirectExpr* expr) override {
validator_->CheckFuncSignature(&expr->loc, expr->decl);
return Result::Ok;
}
+ Result BeginIfExpr(IfExpr* expr) override {
+ validator_->CheckBlockDeclaration(&expr->loc, Opcode::If,
+ &expr->true_.decl);
+ return Result::Ok;
+ }
+
+ Result BeginIfExceptExpr(IfExceptExpr* expr) override {
+ validator_->CheckBlockDeclaration(&expr->loc, Opcode::IfExcept,
+ &expr->true_.decl);
+ return Result::Ok;
+ }
+
+ Result BeginLoopExpr(LoopExpr* expr) override {
+ validator_->CheckBlockDeclaration(&expr->loc, Opcode::Loop,
+ &expr->block.decl);
+ return Result::Ok;
+ }
+
+ Result BeginTryExpr(TryExpr* expr) override {
+ validator_->CheckBlockDeclaration(&expr->loc, Opcode::Try,
+ &expr->block.decl);
+ return Result::Ok;
+ }
+
private:
Validator* validator_;
};