Commit 358f4454 authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[liftoff] Fix stack layout on 32-bit architectures.

This improves the stack layout of {WasmCompiledFrame} frames built by
Liftoff so that the first spill slot immediately follows the frame
marker. We will rely on this in the future when we expect the first
spill slot to always hold a {WasmInstanceObject} reference.

R=clemensh@chromium.org

Change-Id: I2babe8a813af23f3b5bc139a2b0b334072625f7b
Reviewed-on: https://chromium-review.googlesource.com/1006615Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52543}
parent be1a2316
......@@ -20,9 +20,9 @@ namespace wasm {
namespace liftoff {
// ebp-8 holds the stack marker, ebp-16 is the instance parameter, first stack
// slot is located at ebp-24.
constexpr int32_t kConstantStackSpace = 16;
// ebp-4 holds the stack marker, ebp-8 is the instance parameter, first stack
// slot is located at ebp-16.
constexpr int32_t kConstantStackSpace = 8;
constexpr int32_t kFirstStackSlotOffset =
kConstantStackSpace + LiftoffAssembler::kStackSlotSize;
......@@ -37,7 +37,7 @@ inline Operand GetHalfStackSlot(uint32_t half_index) {
}
// TODO(clemensh): Make this a constexpr variable once Operand is constexpr.
inline Operand GetInstanceOperand() { return Operand(ebp, -16); }
inline Operand GetInstanceOperand() { return Operand(ebp, -8); }
static constexpr LiftoffRegList kByteRegs =
LiftoffRegList::FromBits<Register::ListOf<eax, ecx, edx, ebx>()>();
......
......@@ -15,9 +15,9 @@ namespace wasm {
namespace liftoff {
// fp-8 holds the stack marker, fp-16 is the instance parameter, first stack
// slot is located at fp-24.
constexpr int32_t kConstantStackSpace = 16;
// fp-4 holds the stack marker, fp-8 is the instance parameter, first stack
// slot is located at fp-16.
constexpr int32_t kConstantStackSpace = 8;
constexpr int32_t kFirstStackSlotOffset =
kConstantStackSpace + LiftoffAssembler::kStackSlotSize;
......@@ -31,7 +31,7 @@ inline MemOperand GetHalfStackSlot(uint32_t half_index) {
return MemOperand(fp, -kFirstStackSlotOffset - offset);
}
inline MemOperand GetInstanceOperand() { return MemOperand(fp, -16); }
inline MemOperand GetInstanceOperand() { return MemOperand(fp, -8); }
// Use this register to store the address of the last argument pushed on the
// stack for a call to C. This register must be callee saved according to the c
......
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