diff options
author | Daniel Wirtz <dcode@dcode.io> | 2020-09-02 03:28:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-02 03:28:47 +0200 |
commit | 949bf4916c6dcd9409888a677739c4c844bb9eda (patch) | |
tree | c6b633ba215f4e3e7e4412fc56a19f34760f9984 /src/wasm-interpreter.h | |
parent | 85234cb540c2b2863dfea6c20496dcb451df8889 (diff) | |
download | binaryen-949bf4916c6dcd9409888a677739c4c844bb9eda.tar.gz binaryen-949bf4916c6dcd9409888a677739c4c844bb9eda.tar.bz2 binaryen-949bf4916c6dcd9409888a677739c4c844bb9eda.zip |
Harden exnref literals (#3092)
* Make `Literal::type` immutable to guarantee that we do not lose track of `Literal::exn` by changing the literal's type
* Add an assert to guarantee that we don't create `exnref` literals without an `ExceptionPackage` (for now)
* Enforce rvalue reference when creating an `exnref` Literal from a `std::unique_ptr<ExceptionPackage>`, avoiding a redundant copy by means of requiring `std::move`
Diffstat (limited to 'src/wasm-interpreter.h')
-rw-r--r-- | src/wasm-interpreter.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h index e3674416a..3eab81cc5 100644 --- a/src/wasm-interpreter.h +++ b/src/wasm-interpreter.h @@ -1273,7 +1273,7 @@ public: for (auto item : arguments) { exn->values.push_back(item); } - throwException(Literal(std::move(exn))); + throwException(Literal::makeExnref(std::move(exn))); WASM_UNREACHABLE("throw"); } Flow visitRethrow(Rethrow* curr) { |