Skip to content

Commit 910cb91

Browse files
jakobkummerowV8 LUCI CQ
authored andcommitted
[wasm][liftoff][arm64] Fix DropExceptionValueAtOffset
We cannot exit the iteration early, we must update all entries in the cache state. Fixed: 343748812 Change-Id: I8353acb7bd0edc4b979db92e44d24cb9028fd92b Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5596273 Reviewed-by: Clemens Backes <[email protected]> Commit-Queue: Clemens Backes <[email protected]> Auto-Submit: Jakob Kummerow <[email protected]> Commit-Queue: Jakob Kummerow <[email protected]> Cr-Commit-Position: refs/heads/main@{#94244}
1 parent 546192f commit 910cb91

File tree

3 files changed

+37
-5
lines changed

3 files changed

+37
-5
lines changed

src/wasm/baseline/liftoff-assembler.cc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -435,12 +435,13 @@ void LiftoffAssembler::DropExceptionValueAtOffset(int offset) {
435435
slot != end; ++slot) {
436436
*slot = *(slot + 1);
437437
stack_offset = NextSpillOffset(slot->kind(), stack_offset);
438-
// Padding could allow us to exit early.
439-
if (slot->offset() == stack_offset) break;
440-
if (slot->is_stack()) {
441-
MoveStackValue(stack_offset, slot->offset(), slot->kind());
438+
// Padding could cause some spill offsets to remain the same.
439+
if (slot->offset() != stack_offset) {
440+
if (slot->is_stack()) {
441+
MoveStackValue(stack_offset, slot->offset(), slot->kind());
442+
}
443+
slot->set_offset(stack_offset);
442444
}
443-
slot->set_offset(stack_offset);
444445
}
445446
cache_state_.stack_state.pop_back();
446447
}

test/mjsunit/mjsunit.status

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1773,6 +1773,7 @@
17731773
'regress/wasm/regress-341875188': [SKIP],
17741774
'regress/wasm/regress-344484969': [SKIP],
17751775
'regress/wasm/regress-341947685': [SKIP],
1776+
'regress/wasm/regress-343748812': [SKIP],
17761777
'regress/wasm/regress-crbug-1338980': [SKIP],
17771778
'regress/wasm/regress-crbug-1355070': [SKIP],
17781779
'regress/wasm/regress-crbug-1356718': [SKIP],
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright 2024 the V8 project authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
d8.file.execute('test/mjsunit/wasm/wasm-module-builder.js');
6+
7+
const builder = new WasmModuleBuilder();
8+
let $sig0 = builder.addType(kSig_v_v);
9+
let $sig7 = builder.addType(
10+
makeSig([], [ kWasmExternRef, kWasmS128, kWasmExternRef ]));
11+
let $func0 = builder.addImport('imports', 'func0', $sig0);
12+
builder.addFunction("main", $sig0).exportFunc()
13+
.addLocals(kWasmExternRef, 3)
14+
.addBody([
15+
kExprTry, $sig7,
16+
kExprCallFunction, $func0,
17+
kExprUnreachable,
18+
kExprCatchAll,
19+
kExprRefNull, kExternRefCode,
20+
...wasmS128Const([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
21+
kExprRefNull, kExternRefCode,
22+
kExprEnd,
23+
kExprDrop,
24+
kExprDrop,
25+
kExprDrop,
26+
]);
27+
28+
var instance = builder.instantiate({'imports': { 'func0': () => {} }});
29+
30+
assertThrows(instance.exports.main, WebAssembly.RuntimeError, /unreachable/);

0 commit comments

Comments
 (0)