Commit d8b6e14c authored by Thibaud Michaud's avatar Thibaud Michaud Committed by Commit Bot

[wasm][interpreter] Fix multi-value try blocks

Fix target stack height of multi-value try blocks.

R=clemensb@chromium.org

Bug: chromium:1187896
Change-Id: I698b06141e65f7b545a695c035b862af31dd8875
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2772236Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73504}
parent 2ce5acf6
......@@ -589,6 +589,17 @@ TEST(Regress1180457) {
CHECK_EQ(kResult0, r.CallInterpreter());
}
TEST(Regress1187896) {
TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh);
WasmRunner<uint32_t> r(TestExecutionTier::kInterpreter);
byte try_sig = r.builder().AddSignature(sigs.v_i());
constexpr uint32_t kResult = 23;
BUILD(r, kExprI32Const, 0, kExprTry, try_sig, kExprDrop, kExprCatchAll,
kExprNop, kExprEnd, kExprI32Const, kResult);
CHECK_EQ(kResult, r.CallInterpreter());
}
} // namespace test_run_wasm_exceptions
} // namespace wasm
} // namespace internal
......
......@@ -894,8 +894,9 @@ class SideTable : public ZoneObject {
}
TRACE("control @%u: Try, arity %d->%d\n", i.pc_offset(),
imm.in_arity(), imm.out_arity());
CLabel* end_label = CLabel::New(&control_transfer_zone, stack_height,
imm.out_arity());
CLabel* end_label =
CLabel::New(&control_transfer_zone, stack_height - imm.in_arity(),
imm.out_arity());
CLabel* catch_label =
CLabel::New(&control_transfer_zone, stack_height, 0);
control_stack.emplace_back(i.pc(), end_label, catch_label,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment