[vm, compiler] Account for pair locations in MoveArgumentInstr on riscv32.

TEST=dart-fuzz
Bug: https://github.com/dart-lang/sdk/issues/55181
Change-Id: I075f0b341858b8fcf408378dea1473bab07a87ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357214
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Ryan Macnak
2024-03-13 22:32:11 +00:00
committed by Commit Queue
parent fb210554eb
commit 52f7908b27
+22 -11
View File
@@ -463,19 +463,22 @@ void MoveArgumentInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
ASSERT(compiler->is_optimizing());
const Location value = compiler->RebaseIfImprovesAddressing(locs()->in(0));
const intptr_t offset =
location().stack_index() * compiler::target::kWordSize;
if (value.IsRegister()) {
__ StoreToOffset(value.reg(), SP, offset);
__ StoreToOffset(value.reg(), SP,
location().stack_index() * compiler::target::kWordSize);
#if XLEN == 32
} else if (value.IsPairLocation()) {
__ StoreToOffset(value.AsPairLocation()->At(1).reg(), SP,
offset + compiler::target::kWordSize);
__ StoreToOffset(value.AsPairLocation()->At(0).reg(), SP, offset);
location().AsPairLocation()->At(1).stack_index() *
compiler::target::kWordSize);
__ StoreToOffset(value.AsPairLocation()->At(0).reg(), SP,
location().AsPairLocation()->At(0).stack_index() *
compiler::target::kWordSize);
#endif
} else if (value.IsConstant()) {
if (representation() == kUnboxedDouble) {
ASSERT(value.constant_instruction()->HasZeroRepresentation());
intptr_t offset = location().stack_index() * compiler::target::kWordSize;
#if XLEN == 32
__ StoreToOffset(ZR, SP, offset + compiler::target::kWordSize);
__ StoreToOffset(ZR, SP, offset);
@@ -485,10 +488,15 @@ void MoveArgumentInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
} else if (representation() == kUnboxedInt64) {
ASSERT(value.constant_instruction()->HasZeroRepresentation());
#if XLEN == 32
__ StoreToOffset(ZR, SP, offset + compiler::target::kWordSize);
__ StoreToOffset(ZR, SP, offset);
__ StoreToOffset(ZR, SP,
location().AsPairLocation()->At(1).stack_index() *
compiler::target::kWordSize);
__ StoreToOffset(ZR, SP,
location().AsPairLocation()->At(0).stack_index() *
compiler::target::kWordSize);
#else
__ StoreToOffset(ZR, SP, offset);
__ StoreToOffset(ZR, SP,
location().stack_index() * compiler::target::kWordSize);
#endif
} else {
ASSERT(representation() == kTagged);
@@ -502,14 +510,17 @@ void MoveArgumentInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
reg = TMP;
__ LoadObject(TMP, constant);
}
__ StoreToOffset(reg, SP, offset);
__ StoreToOffset(reg, SP,
location().stack_index() * compiler::target::kWordSize);
}
} else if (value.IsFpuRegister()) {
__ StoreDToOffset(value.fpu_reg(), SP, offset);
__ StoreDToOffset(value.fpu_reg(), SP,
location().stack_index() * compiler::target::kWordSize);
} else if (value.IsStackSlot()) {
const intptr_t value_offset = value.ToStackSlotOffset();
__ LoadFromOffset(TMP, value.base_reg(), value_offset);
__ StoreToOffset(TMP, SP, offset);
__ StoreToOffset(TMP, SP,
location().stack_index() * compiler::target::kWordSize);
} else {
UNREACHABLE();
}