[vm] Fix debug/arm64c build

On arm64 Address can assume certain load/store size depending on the
value (alignment) of the offset. This may cause assertion failure

  "runtime/vm/compiler/assembler/assembler_arm64.h: 2750: error: expected: a.log2sz_ == -1 || a.log2sz_ == size".

This change fixes build on arm64c in debug mode by using an unaligned
offset. This is a follow-up to https://dart-review.googlesource.com/c/sdk/+/259920.

TEST=Build on the vm-ffi-android-debug-arm64c bot.

Issue: https://github.com/dart-lang/sdk/issues/49719
Change-Id: I2fef8c8b397e85b9092244ae701a5f7b24b8f6eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260062
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Alexander Markov 2022-09-20 18:06:15 +00:00 committed by Commit Bot
parent c0b40136e5
commit 7f40a291ae

View file

@ -1139,8 +1139,7 @@ void StubCodeCompiler::GenerateAllocateRecordStub(Assembler* assembler) {
#endif
Label loop, done;
__ AddImmediate(field_reg, result_reg,
target::Record::field_offset(0) - kHeapObjectTag);
__ AddImmediate(field_reg, result_reg, target::Record::field_offset(0));
__ CompareRegisters(field_reg, new_top_reg);
__ BranchIf(UNSIGNED_GREATER_EQUAL, &done, Assembler::kNearJump);
@ -1148,7 +1147,7 @@ void StubCodeCompiler::GenerateAllocateRecordStub(Assembler* assembler) {
for (intptr_t offset = 0; offset < target::kObjectAlignment;
offset += target::kCompressedWordSize) {
__ StoreCompressedIntoObjectNoBarrier(
result_reg, Address(field_reg, offset), null_reg);
result_reg, FieldAddress(field_reg, offset), null_reg);
}
// Safe to only check every kObjectAlignment bytes instead of each word.
ASSERT(kAllocationRedZoneSize >= target::kObjectAlignment);