diff options
author | Thomas Lively <7121787+tlively@users.noreply.github.com> | 2020-03-10 13:43:06 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-10 13:43:06 -0700 |
commit | 8f16059d3c29e285d4effed7f0c1f84c1f2f4d9d (patch) | |
tree | faaee424f0b2b77d199c385abe103ea6044cae4e /src/wasm/literal.cpp | |
parent | 49e31f2034d9532f29704be3039829aa201556a0 (diff) | |
download | binaryen-8f16059d3c29e285d4effed7f0c1f84c1f2f4d9d.tar.gz binaryen-8f16059d3c29e285d4effed7f0c1f84c1f2f4d9d.tar.bz2 binaryen-8f16059d3c29e285d4effed7f0c1f84c1f2f4d9d.zip |
Handle multivalue returns in the interpreter (#2684)
Updates the interpreter to properly flow vectors of values, including
at function boundaries. Adds a small spec test for multivalue return.
Diffstat (limited to 'src/wasm/literal.cpp')
-rw-r--r-- | src/wasm/literal.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/wasm/literal.cpp b/src/wasm/literal.cpp index d5333847d..1cf867cdd 100644 --- a/src/wasm/literal.cpp +++ b/src/wasm/literal.cpp @@ -271,10 +271,10 @@ std::ostream& operator<<(std::ostream& o, Literal literal) { o << "?"; break; case Type::i32: - o << literal.i32; + o << literal.geti32(); break; case Type::i64: - o << literal.i64; + o << literal.geti64(); break; case Type::f32: literal.printFloat(o, literal.getf32()); @@ -301,6 +301,21 @@ std::ostream& operator<<(std::ostream& o, Literal literal) { return o; } +std::ostream& operator<<(std::ostream& o, wasm::Literals literals) { + if (literals.size() == 1) { + return o << literals[0]; + } else { + o << '('; + if (literals.size() > 0) { + o << literals[0]; + } + for (size_t i = 1; i < literals.size(); ++i) { + o << ", " << literals[i]; + } + return o << ')'; + } +} + Literal Literal::countLeadingZeroes() const { if (type == Type::i32) { return Literal((int32_t)CountLeadingZeroes(i32)); |