diff options
author | Ben Smith <binjimin@gmail.com> | 2017-11-11 13:36:34 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-11 13:36:34 -0800 |
commit | 500b617b1c8ea88a2cf46f60205071da9c7569bc (patch) | |
tree | 510459c898ac5bd4d68e25e5fd7b275e4e1f9683 /src/binary-reader-ir.cc | |
parent | 2b196f1ee90ef04c6434d0694945214d31550aa7 (diff) | |
download | wabt-500b617b1c8ea88a2cf46f60205071da9c7569bc.tar.gz wabt-500b617b1c8ea88a2cf46f60205071da9c7569bc.tar.bz2 wabt-500b617b1c8ea88a2cf46f60205071da9c7569bc.zip |
Update testsuite; call_indirect has new syntax (#667)
The `call_indirect` instruction now allows the type to be specified
inline or via the common "type use" syntax (or both):
```
call_indirect (type $t1) ...
call_indirect (param i32 f32) (result f64) ...
call_indirect (type $t2) (param i32) ...
```
This means that `CallIndirectExpr` changes from storing a `Var` (the
referenced func type) to a `FuncDeclaration`, which can store both a
type use and a function signature. Most of the changes here are fallout
from that change.
The other major change is that function signature resolution and error
checking now needs to iterate over a functions expr list looking for
`call_indirect` instructions. I'm not sure if this is a significant
overhead in parsing/validation yet, but there are plenty of ways to
optimize it if it ends up in profiles.
Diffstat (limited to 'src/binary-reader-ir.cc')
-rw-r--r-- | src/binary-reader-ir.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/binary-reader-ir.cc b/src/binary-reader-ir.cc index 5e4dd9f3..6ee7f9dc 100644 --- a/src/binary-reader-ir.cc +++ b/src/binary-reader-ir.cc @@ -595,8 +595,11 @@ Result BinaryReaderIR::OnCallExpr(Index func_index) { Result BinaryReaderIR::OnCallIndirectExpr(Index sig_index) { assert(sig_index < module_->func_types.size()); - return AppendExpr( - MakeUnique<CallIndirectExpr>(Var(sig_index, GetLocation()))); + auto expr = MakeUnique<CallIndirectExpr>(GetLocation()); + expr->decl.has_func_type = true; + expr->decl.type_var = Var(sig_index, GetLocation()); + expr->decl.sig = module_->func_types[sig_index]->sig; + return AppendExpr(std::move(expr)); } Result BinaryReaderIR::OnCompareExpr(Opcode opcode) { |