[vm] More fixes for ARM64 MSVC.

TEST=--no-clang
Change-Id: I9e449ce5270adcf6254602c59a625ca9af3f1082
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331219
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
This commit is contained in:
Ryan Macnak 2023-10-24 15:04:36 +00:00 committed by Commit Queue
parent f4f557345c
commit 378b9fcda4
4 changed files with 18 additions and 15 deletions

View file

@ -1753,7 +1753,7 @@ class Assembler : public AssemblerBase {
ASSERT(value != result);
compiler::Label done;
sbfx(result, value, kSmiTagSize,
Utils::Minimum(static_cast<int>(32), compiler::target::kSmiBits));
Utils::Minimum(static_cast<intptr_t>(32), compiler::target::kSmiBits));
BranchIfSmi(value, &done);
LoadFieldFromOffset(result, value, compiler::target::Mint::value_offset(),
compiler::kFourBytes);

View file

@ -263,15 +263,15 @@ namespace target {
#if defined(TARGET_ARCH_IS_32_BIT)
typedef int32_t word;
typedef uint32_t uword;
static constexpr int kWordSizeLog2 = 2;
static constexpr intptr_t kWordSizeLog2 = 2;
#elif defined(TARGET_ARCH_IS_64_BIT)
typedef int64_t word;
typedef uint64_t uword;
static constexpr int kWordSizeLog2 = 3;
static constexpr intptr_t kWordSizeLog2 = 3;
#else
#error "Unsupported architecture"
#endif
static constexpr int kWordSize = 1 << kWordSizeLog2;
static constexpr intptr_t kWordSize = 1 << kWordSizeLog2;
static_assert(kWordSize == sizeof(word), "kWordSize should match sizeof(word)");
// Our compiler code currently assumes this, so formally check it.
#if !defined(FFI_UNIT_TESTS)
@ -280,11 +280,11 @@ static_assert(dart::kWordSize >= kWordSize,
#endif
#if defined(DART_COMPRESSED_POINTERS)
static constexpr int kCompressedWordSize = kInt32Size;
static constexpr int kCompressedWordSizeLog2 = kInt32SizeLog2;
static constexpr intptr_t kCompressedWordSize = kInt32Size;
static constexpr intptr_t kCompressedWordSizeLog2 = kInt32SizeLog2;
#else
static constexpr int kCompressedWordSize = kWordSize;
static constexpr int kCompressedWordSizeLog2 = kWordSizeLog2;
static constexpr intptr_t kCompressedWordSize = kWordSize;
static constexpr intptr_t kCompressedWordSizeLog2 = kWordSizeLog2;
#endif
static constexpr word kBitsPerWordLog2 = kWordSizeLog2 + kBitsPerByteLog2;
@ -298,9 +298,9 @@ constexpr uword kUwordMax = static_cast<word>(-1);
// The number of bits in the _magnitude_ of a Smi, not counting the sign bit.
#if !defined(DART_COMPRESSED_POINTERS)
constexpr int kSmiBits = kBitsPerWord - 2;
constexpr intptr_t kSmiBits = kBitsPerWord - 2;
#else
constexpr int kSmiBits = 30;
constexpr intptr_t kSmiBits = 30;
#endif
constexpr word kSmiMax = (static_cast<uword>(1) << kSmiBits) - 1;
constexpr word kSmiMin = -(static_cast<uword>(1) << kSmiBits);
@ -341,7 +341,7 @@ constexpr intptr_t kDoubleSpillFactor = sizeof(double) / kWordSize;
// Returns the FP-relative index where [variable] can be found (assumes
// [variable] is not captured), in bytes.
inline int FrameOffsetInBytesForVariable(const LocalVariable* variable) {
inline intptr_t FrameOffsetInBytesForVariable(const LocalVariable* variable) {
return frame_layout.FrameSlotForVariable(variable) * kWordSize;
}

View file

@ -1538,7 +1538,8 @@ intptr_t AssemblyImageWriter::WriteTargetWord(word value) {
ASSERT(Utils::BitLength(value) <= compiler::target::kBitsPerWord);
// Padding is helpful for comparing the .S with --disassemble.
assembly_stream_->Printf("%s 0x%.*" Px "\n", kWordDirective,
2 * compiler::target::kWordSize, value);
static_cast<int>(2 * compiler::target::kWordSize),
value);
return compiler::target::kWordSize;
}

View file

@ -324,7 +324,7 @@ class Reader : public ValueObject {
ASSERT((size_ >= 1) && (offset_ >= 0) && (offset_ <= size_ - 1));
const uint8_t* buffer = raw_buffer_;
uint8_t byte0 = buffer[offset_];
uword byte0 = buffer[offset_];
if ((byte0 & 0x80) == 0) {
// 0...
offset_++;
@ -332,13 +332,15 @@ class Reader : public ValueObject {
} else if ((byte0 & 0xc0) == 0x80) {
// 10...
ASSERT((size_ >= 2) && (offset_ >= 0) && (offset_ <= size_ - 2));
uint32_t value = ((byte0 & ~0x80) << 8) | (buffer[offset_ + 1]);
uint32_t value =
((byte0 & ~static_cast<uword>(0x80)) << 8) | (buffer[offset_ + 1]);
offset_ += 2;
return value;
} else {
// 11...
ASSERT((size_ >= 4) && (offset_ >= 0) && (offset_ <= size_ - 4));
uint32_t value = ((byte0 & ~0xc0) << 24) | (buffer[offset_ + 1] << 16) |
uint32_t value = ((byte0 & ~static_cast<uword>(0xc0)) << 24) |
(buffer[offset_ + 1] << 16) |
(buffer[offset_ + 2] << 8) | (buffer[offset_ + 3] << 0);
offset_ += 4;
return value;