diff options
author | Alon Zakai <azakai@google.com> | 2023-02-14 11:20:25 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-14 11:20:25 -0800 |
commit | 3a315fb8248be7a2a7b7e27ebfde634d05668bf3 (patch) | |
tree | 5628b42f655362d9f07e025fe0b52a0528cd3e9d /src | |
parent | 0fbfedabb9339995a7a8040414aafcc86004b973 (diff) | |
download | binaryen-3a315fb8248be7a2a7b7e27ebfde634d05668bf3.tar.gz binaryen-3a315fb8248be7a2a7b7e27ebfde634d05668bf3.tar.bz2 binaryen-3a315fb8248be7a2a7b7e27ebfde634d05668bf3.zip |
[Wasm GC] Fix array.new order of operand execution (#5487)
Diffstat (limited to 'src')
-rw-r--r-- | src/wasm-interpreter.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h index 43b001f35..6d25e4398 100644 --- a/src/wasm-interpreter.h +++ b/src/wasm-interpreter.h @@ -1595,6 +1595,13 @@ public: Flow visitArrayNew(ArrayNew* curr) { NOTE_ENTER("ArrayNew"); + Flow init; + if (!curr->isWithDefault()) { + init = self()->visit(curr->init); + if (init.breaking()) { + return init; + } + } auto size = self()->visit(curr->size); if (size.breaking()) { return size; @@ -1618,10 +1625,6 @@ public: data[i] = Literal::makeZero(element.type); } } else { - auto init = self()->visit(curr->init); - if (init.breaking()) { - return init; - } auto field = curr->type.getHeapType().getArray().element; auto value = truncateForPacking(init.getSingleValue(), field); for (Index i = 0; i < num; i++) { |