Commit 9073f655 authored by Julian Seward's avatar Julian Seward
Browse files

Bug 1727698 - Ion: centralise definition of spill slot size. r=lth.

The `Architecture-*.h` file on each platform ought to define the spill slot
size -- it should not be hidden down in the move emitter like it is now.  This
patch does that, defining it as `max(sizeof(Registers::RegisterContent),
sizeof(FloatRegisters::RegisterContent))`.  For maximum safety and detection
of misunderstandings, it also statically asserts the expected value for each
architecture.

Differential Revision: https://phabricator.services.mozilla.com/D125960
parent 2b22b9a8
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -329,6 +329,10 @@ class FloatRegisters {
  static const SetType AllocatableMask = AllMask & ~NonAllocatableMask;
};

static const uint32_t SpillSlotSize =
    std::max(sizeof(Registers::RegisterContent),
             sizeof(FloatRegisters::RegisterContent));

template <typename T>
class TypedRegisterSet;

+2 −1
Original line number Diff line number Diff line
@@ -24,7 +24,8 @@ MoveEmitterARM::MoveEmitterARM(MacroAssembler& masm)
void MoveEmitterARM::emit(const MoveResolver& moves) {
  if (moves.numCycles()) {
    // Reserve stack for cycle resolution
    masm.reserveStack(moves.numCycles() * sizeof(double));
    static_assert(SpillSlotSize == 8);
    masm.reserveStack(moves.numCycles() * SpillSlotSize);
    pushedAtCycle_ = masm.framePushed();
  }

+4 −0
Original line number Diff line number Diff line
@@ -547,6 +547,10 @@ class FloatRegisters {
  }
};

static const uint32_t SpillSlotSize =
    std::max(sizeof(Registers::RegisterContent),
             sizeof(FloatRegisters::RegisterContent));

static const uint32_t ShadowStackSpace = 0;

// When our only strategy for far jumps is to encode the offset directly, and
+2 −1
Original line number Diff line number Diff line
@@ -22,7 +22,8 @@ MemOperand MoveEmitterARM64::toMemOperand(const MoveOperand& operand) const {

void MoveEmitterARM64::emit(const MoveResolver& moves) {
  if (moves.numCycles()) {
    masm.reserveStack(Simd128DataSize);
    static_assert(SpillSlotSize == 16);
    masm.reserveStack(SpillSlotSize);
    pushedAtCycle_ = masm.framePushed();
  }

+4 −0
Original line number Diff line number Diff line
@@ -272,6 +272,10 @@ class FloatRegistersMIPSShared {
#endif
};

static const uint32_t SpillSlotSize =
    std::max(sizeof(Registers::RegisterContent),
             sizeof(FloatRegistersMIPSShared::RegisterContent));

template <typename T>
class TypedRegisterSet;

Loading