Commit 980037ce authored by Andreas Haas's avatar Andreas Haas Committed by Commit Bot

[wasm][liftoff][arm] Avoid double allocation of register is AtomicOp64

In AtomicOp64 ClearRegister is called twice to clear the registers r8
and r9. Thereby new registers may get allocated. We forgot to add the
newly allocated registers to pinned after the first call to
ClearRegister, which caused the same registers to be allocated again in
the second ClearRegister, and thereby caused the bug.

R=clemensb@chromium.org

Change-Id: I0d069aea4c9438fe30c30c22406b4075ddf3e95c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2170088
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67445}
parent af09a9b0
......@@ -705,6 +705,8 @@ inline void AtomicOp64(LiftoffAssembler* lasm, Register dst_addr,
dst_addr, offset_reg, value_low, value_high, dst_low, dst_high);
__ ClearRegister(dst_low, {&dst_addr, &offset_reg, &value_low, &value_high},
pinned);
pinned = pinned |
LiftoffRegList::ForRegs(dst_addr, offset_reg, value_low, value_high);
__ ClearRegister(dst_high, {&dst_addr, &offset_reg, &value_low, &value_high},
pinned);
pinned = pinned |
......
// Copyright 2020 the V8 project authors. All rights reserved.
// // Use of this source code is governed by a BSD-style license that can be
// // found in the LICENSE file.
// Flags: --wasm-staging
load('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
builder.addMemory(16, 32, false, true);
const sig = builder.addType(makeSig(
[kWasmI32, kWasmI32, kWasmI32, kWasmI32, kWasmI32, kWasmI32, kWasmI32],
[]));
builder.addFunction(undefined, sig).addBodyWithEnd([
// signature: v_iiiiifidi
// body:
kExprI32Const, 0x00, // i32.const
kExprI64Const, 0x00, // i64.const
kAtomicPrefix, kExprI64AtomicStore, 0x00, 0x00, // i64.atomic.store64
kExprEnd, // end @9
]);
builder.addExport('main', 0);
assertDoesNotThrow(() => builder.instantiate());
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