Skip to content

[vm] FlowGraphCompiler::EmitMove does not support kUnboxedFloat from const source to stack #53900

Closed
@dcharkes

Description

@dcharkes

For const moves, it uses the constant instruction:

ASSERT(source.IsConstant());
if (destination.IsFpuRegister() || destination.IsDoubleStackSlot() ||
destination.IsStackSlot()) {
Register tmp = allocator->AllocateTemporary();
source.constant_instruction()->EmitMoveToLocation(this, destination, tmp,
source.pair_index());
allocator->ReleaseTemporary();
} else {
source.constant_instruction()->EmitMoveToLocation(
this, destination, kNoRegister, source.pair_index());
}

And this instruction doesn't support kUnboxedFloat, and silently does the wrong thing on some archs:

Silent failure on arm32, assuming kTagged:

} else {
ASSERT(destination.IsStackSlot());
ASSERT(tmp != kNoRegister);
const intptr_t dest_offset = destination.ToStackSlotOffset();
if (RepresentationUtils::IsUnboxedInteger(representation())) {
int64_t v;
const bool ok = compiler::HasIntegerValue(value_, &v);
RELEASE_ASSERT(ok);
__ LoadImmediate(
tmp, pair_index == 0 ? Utils::Low32Bits(v) : Utils::High32Bits(v));
} else {
__ LoadObject(tmp, value_);
}
__ StoreToOffset(tmp, destination.base_reg(), dest_offset);
}

Discovered on https://dart-review.googlesource.com/c/sdk/+/284300/59

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.vm-technical-debtThis label tries to capture all the technical debt that we have accumulated in the Dart VM

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions