diff --git a/pkg/native_compiler/lib/runtime/vm_offsets.g.dart b/pkg/native_compiler/lib/runtime/vm_offsets.g.dart index bb5533b034a..f9e5b31eb32 100644 --- a/pkg/native_compiler/lib/runtime/vm_offsets.g.dart +++ b/pkg/native_compiler/lib/runtime/vm_offsets.g.dart @@ -24,6 +24,7 @@ base class VMOffsets { int get Instructions_kNonBarePayloadAlignment => throw 'Unknown'; int get NativeEntry_kNumCallWrapperArguments => throw 'Unknown'; int get Page_kBytesPerCardLog2 => throw 'Unknown'; + int get Page_kPageMask => throw 'Unknown'; int get Record_kMaxElements => throw 'Unknown'; int get RecordShape_kFieldNamesIndexMask => throw 'Unknown'; int get RecordShape_kFieldNamesIndexShift => throw 'Unknown'; @@ -589,6 +590,8 @@ final class Arm64VMOffsets extends VMOffsets { @override int get Page_kBytesPerCardLog2 => 0x8; @override + int get Page_kPageMask => -0x80000; + @override int get Record_kMaxElements => 0xffff; @override int get RecordShape_kFieldNamesIndexMask => 0x3fffffffffff; @@ -1498,6 +1501,8 @@ final class Arm64ProductVMOffsets extends VMOffsets { @override int get Page_kBytesPerCardLog2 => 0x8; @override + int get Page_kPageMask => -0x80000; + @override int get Record_kMaxElements => 0xffff; @override int get RecordShape_kFieldNamesIndexMask => 0x3fffffffffff; diff --git a/runtime/vm/compiler/runtime_api.cc b/runtime/vm/compiler/runtime_api.cc index 3806fc40b69..6deafc14634 100644 --- a/runtime/vm/compiler/runtime_api.cc +++ b/runtime/vm/compiler/runtime_api.cc @@ -347,10 +347,6 @@ intptr_t RuntimeEntry::argument_count() const { namespace target { -const word kPageSize = dart::kPageSize; -const word kPageSizeInWords = dart::kPageSize / kWordSize; -const word kPageMask = dart::kPageMask; - static word TranslateOffsetInWordsToHost(word offset) { RELEASE_ASSERT((offset % kCompressedWordSize) == 0); return (offset / kCompressedWordSize) * dart::kCompressedWordSize; diff --git a/runtime/vm/compiler/runtime_api.h b/runtime/vm/compiler/runtime_api.h index 49e052088d8..fc9a4fdd19b 100644 --- a/runtime/vm/compiler/runtime_api.h +++ b/runtime/vm/compiler/runtime_api.h @@ -77,9 +77,6 @@ extern InvalidClass kUWordMax; extern InvalidClass kNewObjectAlignmentOffset; extern InvalidClass kOldObjectAlignmentOffset; extern InvalidClass kNewObjectBitPosition; -extern InvalidClass kPageSize; -extern InvalidClass kPageSizeInWords; -extern InvalidClass kPageMask; extern InvalidClass kObjectAlignment; extern InvalidClass kObjectAlignmentLog2; extern InvalidClass kObjectAlignmentMask; @@ -306,11 +303,6 @@ constexpr intptr_t kSmiBits = 30; constexpr word kSmiMax = (static_cast(1) << kSmiBits) - 1; constexpr word kSmiMin = -(static_cast(1) << kSmiBits); -// Information about heap pages. -extern const word kPageSize; -extern const word kPageSizeInWords; -extern const word kPageMask; - static constexpr intptr_t kObjectAlignment = ObjectAlignment::kObjectAlignment; // Note: if other flags are added, then change the check for required parameters @@ -1505,6 +1497,7 @@ class ClosureData : public AllStatic { class Page : public AllStatic { public: static const word kBytesPerCardLog2; + static const word kPageMask; static word card_table_offset(); static word original_top_offset(); diff --git a/runtime/vm/compiler/runtime_offsets_extracted.h b/runtime/vm/compiler/runtime_offsets_extracted.h index 2d9e317518a..d993f47cb8f 100644 --- a/runtime/vm/compiler/runtime_offsets_extracted.h +++ b/runtime/vm/compiler/runtime_offsets_extracted.h @@ -79,6 +79,7 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word NativeEntry_kNumCallWrapperArguments = 0x2; static constexpr dart::compiler::target::word Page_kBytesPerCardLog2 = 0x7; +static constexpr dart::compiler::target::word Page_kPageMask = -0x80000; static constexpr dart::compiler::target::word Record_kMaxElements = 0xffff; static constexpr dart::compiler::target::word RecordShape_kFieldNamesIndexMask = 0x3fff; @@ -799,6 +800,7 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word NativeEntry_kNumCallWrapperArguments = 0x2; static constexpr dart::compiler::target::word Page_kBytesPerCardLog2 = 0x8; +static constexpr dart::compiler::target::word Page_kPageMask = -0x80000; static constexpr dart::compiler::target::word Record_kMaxElements = 0xffff; static constexpr dart::compiler::target::word RecordShape_kFieldNamesIndexMask = 0x3fffffffffff; @@ -1523,6 +1525,7 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word NativeEntry_kNumCallWrapperArguments = 0x2; static constexpr dart::compiler::target::word Page_kBytesPerCardLog2 = 0x7; +static constexpr dart::compiler::target::word Page_kPageMask = -0x80000; static constexpr dart::compiler::target::word Record_kMaxElements = 0xffff; static constexpr dart::compiler::target::word RecordShape_kFieldNamesIndexMask = 0x3fff; @@ -2242,6 +2245,7 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word NativeEntry_kNumCallWrapperArguments = 0x2; static constexpr dart::compiler::target::word Page_kBytesPerCardLog2 = 0x8; +static constexpr dart::compiler::target::word Page_kPageMask = -0x80000; static constexpr dart::compiler::target::word Record_kMaxElements = 0xffff; static constexpr dart::compiler::target::word RecordShape_kFieldNamesIndexMask = 0x3fffffffffff; @@ -2969,6 +2973,7 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word NativeEntry_kNumCallWrapperArguments = 0x2; static constexpr dart::compiler::target::word Page_kBytesPerCardLog2 = 0x7; +static constexpr dart::compiler::target::word Page_kPageMask = -0x80000; static constexpr dart::compiler::target::word Record_kMaxElements = 0xffff; static constexpr dart::compiler::target::word RecordShape_kFieldNamesIndexMask = 0x3fff; @@ -3692,6 +3697,7 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word NativeEntry_kNumCallWrapperArguments = 0x2; static constexpr dart::compiler::target::word Page_kBytesPerCardLog2 = 0x7; +static constexpr dart::compiler::target::word Page_kPageMask = -0x80000; static constexpr dart::compiler::target::word Record_kMaxElements = 0xffff; static constexpr dart::compiler::target::word RecordShape_kFieldNamesIndexMask = 0x3fff; @@ -4416,6 +4422,7 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word NativeEntry_kNumCallWrapperArguments = 0x2; static constexpr dart::compiler::target::word Page_kBytesPerCardLog2 = 0x7; +static constexpr dart::compiler::target::word Page_kPageMask = -0x80000; static constexpr dart::compiler::target::word Record_kMaxElements = 0xffff; static constexpr dart::compiler::target::word RecordShape_kFieldNamesIndexMask = 0x3fff; @@ -5137,6 +5144,7 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word NativeEntry_kNumCallWrapperArguments = 0x2; static constexpr dart::compiler::target::word Page_kBytesPerCardLog2 = 0x8; +static constexpr dart::compiler::target::word Page_kPageMask = -0x80000; static constexpr dart::compiler::target::word Record_kMaxElements = 0xffff; static constexpr dart::compiler::target::word RecordShape_kFieldNamesIndexMask = 0x3fffffffffff; @@ -5859,6 +5867,7 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word NativeEntry_kNumCallWrapperArguments = 0x2; static constexpr dart::compiler::target::word Page_kBytesPerCardLog2 = 0x7; +static constexpr dart::compiler::target::word Page_kPageMask = -0x80000; static constexpr dart::compiler::target::word Record_kMaxElements = 0xffff; static constexpr dart::compiler::target::word RecordShape_kFieldNamesIndexMask = 0x3fff; @@ -6571,6 +6580,7 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word NativeEntry_kNumCallWrapperArguments = 0x2; static constexpr dart::compiler::target::word Page_kBytesPerCardLog2 = 0x8; +static constexpr dart::compiler::target::word Page_kPageMask = -0x80000; static constexpr dart::compiler::target::word Record_kMaxElements = 0xffff; static constexpr dart::compiler::target::word RecordShape_kFieldNamesIndexMask = 0x3fffffffffff; @@ -7287,6 +7297,7 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word NativeEntry_kNumCallWrapperArguments = 0x2; static constexpr dart::compiler::target::word Page_kBytesPerCardLog2 = 0x7; +static constexpr dart::compiler::target::word Page_kPageMask = -0x80000; static constexpr dart::compiler::target::word Record_kMaxElements = 0xffff; static constexpr dart::compiler::target::word RecordShape_kFieldNamesIndexMask = 0x3fff; @@ -7998,6 +8009,7 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word NativeEntry_kNumCallWrapperArguments = 0x2; static constexpr dart::compiler::target::word Page_kBytesPerCardLog2 = 0x8; +static constexpr dart::compiler::target::word Page_kPageMask = -0x80000; static constexpr dart::compiler::target::word Record_kMaxElements = 0xffff; static constexpr dart::compiler::target::word RecordShape_kFieldNamesIndexMask = 0x3fffffffffff; @@ -8717,6 +8729,7 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word NativeEntry_kNumCallWrapperArguments = 0x2; static constexpr dart::compiler::target::word Page_kBytesPerCardLog2 = 0x7; +static constexpr dart::compiler::target::word Page_kPageMask = -0x80000; static constexpr dart::compiler::target::word Record_kMaxElements = 0xffff; static constexpr dart::compiler::target::word RecordShape_kFieldNamesIndexMask = 0x3fff; @@ -9432,6 +9445,7 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word NativeEntry_kNumCallWrapperArguments = 0x2; static constexpr dart::compiler::target::word Page_kBytesPerCardLog2 = 0x7; +static constexpr dart::compiler::target::word Page_kPageMask = -0x80000; static constexpr dart::compiler::target::word Record_kMaxElements = 0xffff; static constexpr dart::compiler::target::word RecordShape_kFieldNamesIndexMask = 0x3fff; @@ -10148,6 +10162,7 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word NativeEntry_kNumCallWrapperArguments = 0x2; static constexpr dart::compiler::target::word Page_kBytesPerCardLog2 = 0x7; +static constexpr dart::compiler::target::word Page_kPageMask = -0x80000; static constexpr dart::compiler::target::word Record_kMaxElements = 0xffff; static constexpr dart::compiler::target::word RecordShape_kFieldNamesIndexMask = 0x3fff; @@ -10861,6 +10876,7 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word NativeEntry_kNumCallWrapperArguments = 0x2; static constexpr dart::compiler::target::word Page_kBytesPerCardLog2 = 0x8; +static constexpr dart::compiler::target::word Page_kPageMask = -0x80000; static constexpr dart::compiler::target::word Record_kMaxElements = 0xffff; static constexpr dart::compiler::target::word RecordShape_kFieldNamesIndexMask = 0x3fffffffffff; @@ -11583,6 +11599,7 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word AOT_NativeEntry_kNumCallWrapperArguments = 0x2; static constexpr dart::compiler::target::word AOT_Page_kBytesPerCardLog2 = 0x7; +static constexpr dart::compiler::target::word AOT_Page_kPageMask = -0x80000; static constexpr dart::compiler::target::word AOT_Record_kMaxElements = 0xffff; static constexpr dart::compiler::target::word AOT_RecordShape_kFieldNamesIndexMask = 0x3fff; @@ -12383,6 +12400,7 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word AOT_NativeEntry_kNumCallWrapperArguments = 0x2; static constexpr dart::compiler::target::word AOT_Page_kBytesPerCardLog2 = 0x8; +static constexpr dart::compiler::target::word AOT_Page_kPageMask = -0x80000; static constexpr dart::compiler::target::word AOT_Record_kMaxElements = 0xffff; static constexpr dart::compiler::target::word AOT_RecordShape_kFieldNamesIndexMask = 0x3fffffffffff; @@ -13190,6 +13208,7 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word AOT_NativeEntry_kNumCallWrapperArguments = 0x2; static constexpr dart::compiler::target::word AOT_Page_kBytesPerCardLog2 = 0x8; +static constexpr dart::compiler::target::word AOT_Page_kPageMask = -0x80000; static constexpr dart::compiler::target::word AOT_Record_kMaxElements = 0xffff; static constexpr dart::compiler::target::word AOT_RecordShape_kFieldNamesIndexMask = 0x3fffffffffff; @@ -13993,6 +14012,7 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word AOT_NativeEntry_kNumCallWrapperArguments = 0x2; static constexpr dart::compiler::target::word AOT_Page_kBytesPerCardLog2 = 0x7; +static constexpr dart::compiler::target::word AOT_Page_kPageMask = -0x80000; static constexpr dart::compiler::target::word AOT_Record_kMaxElements = 0xffff; static constexpr dart::compiler::target::word AOT_RecordShape_kFieldNamesIndexMask = 0x3fff; @@ -14796,6 +14816,7 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word AOT_NativeEntry_kNumCallWrapperArguments = 0x2; static constexpr dart::compiler::target::word AOT_Page_kBytesPerCardLog2 = 0x7; +static constexpr dart::compiler::target::word AOT_Page_kPageMask = -0x80000; static constexpr dart::compiler::target::word AOT_Record_kMaxElements = 0xffff; static constexpr dart::compiler::target::word AOT_RecordShape_kFieldNamesIndexMask = 0x3fff; @@ -15601,6 +15622,7 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word AOT_NativeEntry_kNumCallWrapperArguments = 0x2; static constexpr dart::compiler::target::word AOT_Page_kBytesPerCardLog2 = 0x7; +static constexpr dart::compiler::target::word AOT_Page_kPageMask = -0x80000; static constexpr dart::compiler::target::word AOT_Record_kMaxElements = 0xffff; static constexpr dart::compiler::target::word AOT_RecordShape_kFieldNamesIndexMask = 0x3fff; @@ -16402,6 +16424,7 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word AOT_NativeEntry_kNumCallWrapperArguments = 0x2; static constexpr dart::compiler::target::word AOT_Page_kBytesPerCardLog2 = 0x8; +static constexpr dart::compiler::target::word AOT_Page_kPageMask = -0x80000; static constexpr dart::compiler::target::word AOT_Record_kMaxElements = 0xffff; static constexpr dart::compiler::target::word AOT_RecordShape_kFieldNamesIndexMask = 0x3fffffffffff; @@ -17201,6 +17224,7 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word AOT_NativeEntry_kNumCallWrapperArguments = 0x2; static constexpr dart::compiler::target::word AOT_Page_kBytesPerCardLog2 = 0x7; +static constexpr dart::compiler::target::word AOT_Page_kPageMask = -0x80000; static constexpr dart::compiler::target::word AOT_Record_kMaxElements = 0xffff; static constexpr dart::compiler::target::word AOT_RecordShape_kFieldNamesIndexMask = 0x3fff; @@ -17992,6 +18016,7 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word AOT_NativeEntry_kNumCallWrapperArguments = 0x2; static constexpr dart::compiler::target::word AOT_Page_kBytesPerCardLog2 = 0x8; +static constexpr dart::compiler::target::word AOT_Page_kPageMask = -0x80000; static constexpr dart::compiler::target::word AOT_Record_kMaxElements = 0xffff; static constexpr dart::compiler::target::word AOT_RecordShape_kFieldNamesIndexMask = 0x3fffffffffff; @@ -18790,6 +18815,7 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word AOT_NativeEntry_kNumCallWrapperArguments = 0x2; static constexpr dart::compiler::target::word AOT_Page_kBytesPerCardLog2 = 0x8; +static constexpr dart::compiler::target::word AOT_Page_kPageMask = -0x80000; static constexpr dart::compiler::target::word AOT_Record_kMaxElements = 0xffff; static constexpr dart::compiler::target::word AOT_RecordShape_kFieldNamesIndexMask = 0x3fffffffffff; @@ -19584,6 +19610,7 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word AOT_NativeEntry_kNumCallWrapperArguments = 0x2; static constexpr dart::compiler::target::word AOT_Page_kBytesPerCardLog2 = 0x7; +static constexpr dart::compiler::target::word AOT_Page_kPageMask = -0x80000; static constexpr dart::compiler::target::word AOT_Record_kMaxElements = 0xffff; static constexpr dart::compiler::target::word AOT_RecordShape_kFieldNamesIndexMask = 0x3fff; @@ -20378,6 +20405,7 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word AOT_NativeEntry_kNumCallWrapperArguments = 0x2; static constexpr dart::compiler::target::word AOT_Page_kBytesPerCardLog2 = 0x7; +static constexpr dart::compiler::target::word AOT_Page_kPageMask = -0x80000; static constexpr dart::compiler::target::word AOT_Record_kMaxElements = 0xffff; static constexpr dart::compiler::target::word AOT_RecordShape_kFieldNamesIndexMask = 0x3fff; @@ -21174,6 +21202,7 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word AOT_NativeEntry_kNumCallWrapperArguments = 0x2; static constexpr dart::compiler::target::word AOT_Page_kBytesPerCardLog2 = 0x7; +static constexpr dart::compiler::target::word AOT_Page_kPageMask = -0x80000; static constexpr dart::compiler::target::word AOT_Record_kMaxElements = 0xffff; static constexpr dart::compiler::target::word AOT_RecordShape_kFieldNamesIndexMask = 0x3fff; @@ -21966,6 +21995,7 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word AOT_NativeEntry_kNumCallWrapperArguments = 0x2; static constexpr dart::compiler::target::word AOT_Page_kBytesPerCardLog2 = 0x8; +static constexpr dart::compiler::target::word AOT_Page_kPageMask = -0x80000; static constexpr dart::compiler::target::word AOT_Record_kMaxElements = 0xffff; static constexpr dart::compiler::target::word AOT_RecordShape_kFieldNamesIndexMask = 0x3fffffffffff; diff --git a/runtime/vm/compiler/runtime_offsets_list.h b/runtime/vm/compiler/runtime_offsets_list.h index 1205294bbb2..d01254c7f9b 100644 --- a/runtime/vm/compiler/runtime_offsets_list.h +++ b/runtime/vm/compiler/runtime_offsets_list.h @@ -86,6 +86,7 @@ CONSTANT(Instructions, kNonBarePayloadAlignment) \ CONSTANT(NativeEntry, kNumCallWrapperArguments) \ CONSTANT(Page, kBytesPerCardLog2) \ + CONSTANT(Page, kPageMask) \ CONSTANT(Record, kMaxElements) \ CONSTANT(RecordShape, kFieldNamesIndexMask) \ CONSTANT(RecordShape, kFieldNamesIndexShift) \ diff --git a/runtime/vm/compiler/stub_code_compiler.cc b/runtime/vm/compiler/stub_code_compiler.cc index 5c18f8ddf0a..a688cca270f 100644 --- a/runtime/vm/compiler/stub_code_compiler.cc +++ b/runtime/vm/compiler/stub_code_compiler.cc @@ -2153,7 +2153,7 @@ void StubCodeCompiler::GenerateSuspendStub( } // Write barrier. - __ AndImmediate(kTemp, kSuspendState, target::kPageMask); + __ AndImmediate(kTemp, kSuspendState, target::Page::kPageMask); __ LoadFromOffset(kTemp, kTemp, target::Page::original_top_offset()); __ CompareRegisters(kSuspendState, kTemp); __ BranchIf(UNSIGNED_LESS, &remember_object); diff --git a/runtime/vm/compiler/stub_code_compiler_arm.cc b/runtime/vm/compiler/stub_code_compiler_arm.cc index 6d0a7e38e51..42f6f4dc9a5 100644 --- a/runtime/vm/compiler/stub_code_compiler_arm.cc +++ b/runtime/vm/compiler/stub_code_compiler_arm.cc @@ -41,7 +41,7 @@ void StubCodeCompiler::EnsureIsNewOrRemembered() { // the remembered set and/or deferred marking worklist. This test assumes a // Page's TLAB use is always ascending. Label done; - __ AndImmediate(TMP, R0, target::kPageMask); + __ AndImmediate(TMP, R0, target::Page::kPageMask); __ LoadFromOffset(TMP, TMP, target::Page::original_top_offset()); __ CompareRegisters(R0, TMP); __ BranchIf(UNSIGNED_GREATER_EQUAL, &done); @@ -1883,14 +1883,14 @@ static void GenerateWriteBarrierStubHelper(Assembler* assembler, bool cards) { // Get card table. __ Bind(&remember_card); - __ AndImmediate(TMP, R1, target::kPageMask); // Page. + __ AndImmediate(TMP, R1, target::Page::kPageMask); // Page. __ ldr(TMP, Address(TMP, target::Page::card_table_offset())); // Card table. // Atomically dirty the card. __ PushList((1 << R0) | (1 << R1) | (1 << R2)); - __ AndImmediate(TMP, R1, target::kPageMask); // Page. - __ sub(R9, R9, Operand(TMP)); // Offset in page. + __ AndImmediate(TMP, R1, target::Page::kPageMask); // Page. + __ sub(R9, R9, Operand(TMP)); // Offset in page. __ Lsr(R9, R9, Operand(target::Page::kBytesPerCardLog2)); // Card index. __ AndImmediate(R1, R9, target::kBitsPerWord - 1); // Lsl is not mod 32. __ LoadImmediate(R0, 1); // Bit offset. diff --git a/runtime/vm/compiler/stub_code_compiler_arm64.cc b/runtime/vm/compiler/stub_code_compiler_arm64.cc index 204aaf96da0..dd90c2320a2 100644 --- a/runtime/vm/compiler/stub_code_compiler_arm64.cc +++ b/runtime/vm/compiler/stub_code_compiler_arm64.cc @@ -44,7 +44,7 @@ void StubCodeCompiler::EnsureIsNewOrRemembered() { // the remembered set and/or deferred marking worklist. This test assumes a // Page's TLAB use is always ascending. Label done; - __ AndImmediate(TMP, R0, target::kPageMask); + __ AndImmediate(TMP, R0, target::Page::kPageMask); __ LoadFromOffset(TMP, TMP, target::Page::original_top_offset()); __ CompareRegisters(R0, TMP); __ BranchIf(UNSIGNED_GREATER_EQUAL, &done); @@ -2294,7 +2294,7 @@ static void GenerateWriteBarrierStubHelper(Assembler* assembler, bool cards) { // Get card table. __ Bind(&remember_card); - __ AndImmediate(TMP, R1, target::kPageMask); // Page. + __ AndImmediate(TMP, R1, target::Page::kPageMask); // Page. __ ldr(TMP2, Address(TMP, target::Page::card_table_offset())); // Card table. diff --git a/runtime/vm/compiler/stub_code_compiler_ia32.cc b/runtime/vm/compiler/stub_code_compiler_ia32.cc index 6881d4f2546..8c8880dc0c4 100644 --- a/runtime/vm/compiler/stub_code_compiler_ia32.cc +++ b/runtime/vm/compiler/stub_code_compiler_ia32.cc @@ -39,7 +39,7 @@ void StubCodeCompiler::EnsureIsNewOrRemembered() { // the remembered set and/or deferred marking worklist. This test assumes a // Page's TLAB use is always ascending. Label done; - __ AndImmediate(ECX, EAX, target::kPageMask); + __ AndImmediate(ECX, EAX, target::Page::kPageMask); __ LoadFromOffset(ECX, ECX, target::Page::original_top_offset()); __ CompareRegisters(EAX, ECX); __ BranchIf(UNSIGNED_GREATER_EQUAL, &done); @@ -1701,8 +1701,8 @@ static void GenerateWriteBarrierStubHelper(Assembler* assembler, bool cards) { if (cards) { // Get card table. __ Bind(&remember_card); - __ movl(EAX, EDX); // Object. - __ andl(EAX, Immediate(target::kPageMask)); // Page. + __ movl(EAX, EDX); // Object. + __ andl(EAX, Immediate(target::Page::kPageMask)); // Page. // Atomically dirty the card. __ pushl(EBX); diff --git a/runtime/vm/compiler/stub_code_compiler_riscv.cc b/runtime/vm/compiler/stub_code_compiler_riscv.cc index 43bc78e7947..c7d42ca03c1 100644 --- a/runtime/vm/compiler/stub_code_compiler_riscv.cc +++ b/runtime/vm/compiler/stub_code_compiler_riscv.cc @@ -40,7 +40,7 @@ void StubCodeCompiler::EnsureIsNewOrRemembered() { // the remembered set and/or deferred marking worklist. This test assumes a // Page's TLAB use is always ascending. Label done; - __ AndImmediate(TMP, A0, target::kPageMask); + __ AndImmediate(TMP, A0, target::Page::kPageMask); __ LoadFromOffset(TMP, TMP, target::Page::original_top_offset()); __ CompareRegisters(A0, TMP); __ BranchIf(UNSIGNED_GREATER_EQUAL, &done); @@ -1935,7 +1935,7 @@ static void GenerateWriteBarrierStubHelper(Assembler* assembler, bool cards) { if (cards) { // Get card table. __ Bind(&remember_card); - __ AndImmediate(TMP, A0, target::kPageMask); // Page. + __ AndImmediate(TMP, A0, target::Page::kPageMask); // Page. __ lx(TMP2, Address(TMP, target::Page::card_table_offset())); // Card table. diff --git a/runtime/vm/compiler/stub_code_compiler_x64.cc b/runtime/vm/compiler/stub_code_compiler_x64.cc index a92d3291add..0d6e14cfc21 100644 --- a/runtime/vm/compiler/stub_code_compiler_x64.cc +++ b/runtime/vm/compiler/stub_code_compiler_x64.cc @@ -48,7 +48,7 @@ void StubCodeCompiler::EnsureIsNewOrRemembered() { // the remembered set and/or deferred marking worklist. This test assumes a // Page's TLAB use is always ascending. Label done; - __ AndImmediate(TMP, RAX, target::kPageMask); + __ AndImmediate(TMP, RAX, target::Page::kPageMask); __ LoadFromOffset(TMP, TMP, target::Page::original_top_offset()); __ CompareRegisters(RAX, TMP); __ BranchIf(UNSIGNED_GREATER_EQUAL, &done); @@ -2260,8 +2260,8 @@ static void GenerateWriteBarrierStubHelper(Assembler* assembler, bool cards) { if (cards) { // Get card table. __ Bind(&remember_card); - __ movq(TMP, RDX); // Object. - __ andq(TMP, Immediate(target::kPageMask)); // Page. + __ movq(TMP, RDX); // Object. + __ andq(TMP, Immediate(target::Page::kPageMask)); // Page. // Atomically dirty the card. __ pushq(RAX); diff --git a/runtime/vm/heap/compactor.cc b/runtime/vm/heap/compactor.cc index 89400538dfd..2ce65423f51 100644 --- a/runtime/vm/heap/compactor.cc +++ b/runtime/vm/heap/compactor.cc @@ -37,7 +37,7 @@ class ForwardingBlock { } uword Lookup(uword old_addr) const { - uword block_offset = old_addr & ~kBlockMask; + uword block_offset = old_addr & ~Page::kBlockMask; intptr_t first_unit_position = block_offset >> kObjectAlignmentLog2; ASSERT(first_unit_position < kBitsPerWord); uword preceding_live_bitmask = @@ -58,7 +58,7 @@ class ForwardingBlock { if (size_in_units >= kBitsPerWord) { size_in_units = kBitsPerWord - 1; } - uword block_offset = old_addr & ~kBlockMask; + uword block_offset = old_addr & ~Page::kBlockMask; intptr_t first_unit_position = block_offset >> kObjectAlignmentLog2; ASSERT(first_unit_position < kBitsPerWord); live_bitvector_ |= ((static_cast(1) << size_in_units) - 1) @@ -66,7 +66,7 @@ class ForwardingBlock { } bool IsLive(uword old_addr) const { - uword block_offset = old_addr & ~kBlockMask; + uword block_offset = old_addr & ~Page::kBlockMask; intptr_t first_unit_position = block_offset >> kObjectAlignmentLog2; ASSERT(first_unit_position < kBitsPerWord); return (live_bitvector_ & (static_cast(1) << first_unit_position)) != @@ -79,7 +79,7 @@ class ForwardingBlock { private: uword new_address_; uword live_bitvector_; - COMPILE_ASSERT(kBitVectorWordsPerBlock == 1); + COMPILE_ASSERT(Page::kBitVectorWordsPerBlock == 1); DISALLOW_COPY_AND_ASSIGN(ForwardingBlock); }; @@ -87,7 +87,7 @@ class ForwardingBlock { class ForwardingPage { public: void Clear() { - for (intptr_t i = 0; i < kBlocksPerPage; i++) { + for (intptr_t i = 0; i < Page::kBlocksPerPage; i++) { blocks_[i].Clear(); } } @@ -95,15 +95,15 @@ class ForwardingPage { uword Lookup(uword old_addr) { return BlockFor(old_addr)->Lookup(old_addr); } ForwardingBlock* BlockFor(uword old_addr) { - intptr_t page_offset = old_addr & ~kPageMask; - intptr_t block_number = page_offset / kBlockSize; + intptr_t page_offset = old_addr & ~Page::kPageMask; + intptr_t block_number = page_offset / Page::kBlockSize; ASSERT(block_number >= 0); - ASSERT(block_number <= kBlocksPerPage); + ASSERT(block_number <= Page::kBlocksPerPage); return &blocks_[block_number]; } private: - ForwardingBlock blocks_[kBlocksPerPage]; + ForwardingBlock blocks_[Page::kBlocksPerPage]; DISALLOW_ALLOCATION(); DISALLOW_IMPLICIT_CONSTRUCTORS(ForwardingPage); @@ -506,8 +506,8 @@ void CompactorTask::SlidePage(Page* page) { // object that starts in that block. uword CompactorTask::PlanBlock(uword first_object, ForwardingPage* forwarding_page) { - uword block_start = first_object & kBlockMask; - uword block_end = block_start + kBlockSize; + uword block_start = first_object & Page::kBlockMask; + uword block_end = block_start + Page::kBlockSize; ForwardingBlock* forwarding_block = forwarding_page->BlockFor(first_object); // 1. Compute bitvector of surviving allocation units in the block. @@ -536,8 +536,8 @@ uword CompactorTask::PlanBlock(uword first_object, uword CompactorTask::SlideBlock(uword first_object, ForwardingPage* forwarding_page) { - uword block_start = first_object & kBlockMask; - uword block_end = block_start + kBlockSize; + uword block_start = first_object & Page::kBlockMask; + uword block_end = block_start + Page::kBlockSize; ForwardingBlock* forwarding_block = forwarding_page->BlockFor(first_object); uword old_addr = first_object; @@ -592,7 +592,7 @@ uword CompactorTask::SlideBlock(uword first_object, void CompactorTask::PlanMoveToContiguousSize(intptr_t size) { // Move the free cursor to ensure 'size' bytes of contiguous space. - ASSERT(size <= kPageSize); + ASSERT(size <= Page::kPageSize); // Check if the current free page has enough space. intptr_t free_remaining = free_end_ - free_current_; diff --git a/runtime/vm/heap/incremental_compactor.cc b/runtime/vm/heap/incremental_compactor.cc index 621ca9b39c7..bc472ffd489 100644 --- a/runtime/vm/heap/incremental_compactor.cc +++ b/runtime/vm/heap/incremental_compactor.cc @@ -176,7 +176,7 @@ class PrologueTask : public SafepointTask { bool GCIncrementalCompactor::SelectEvacuationCandidates(PageSpace* old_space) { // Only evacuate pages that are at least half empty. - constexpr intptr_t kEvacuationThreshold = kPageSize / 2; + constexpr intptr_t kEvacuationThreshold = Page::kPageSize / 2; // Evacuate no more than this amount of objects. This puts a bound on the // stop-the-world evacuate step that is similar to the existing longest diff --git a/runtime/vm/heap/page.h b/runtime/vm/heap/page.h index db9cf06ec33..da14cf374df 100644 --- a/runtime/vm/heap/page.h +++ b/runtime/vm/heap/page.h @@ -20,21 +20,6 @@ class ObjectPointerVisitor; class Thread; class UnwindingRecords; -// Pages are allocated with kPageSize alignment so that the Page of any object -// can be computed by masking the object with kPageMask. This does not apply to -// image pages, whose address is chosen by the system loader rather than the -// Dart VM. -static constexpr intptr_t kPageSize = 512 * KB; -static constexpr intptr_t kPageSizeInWords = kPageSize / kWordSize; -static constexpr intptr_t kPageMask = ~(kPageSize - 1); - -// See ForwardingBlock and CountingBlock. -static constexpr intptr_t kBitVectorWordsPerBlock = 1; -static constexpr intptr_t kBlockSize = - kObjectAlignment * kBitsPerWord * kBitVectorWordsPerBlock; -static constexpr intptr_t kBlockMask = ~(kBlockSize - 1); -static constexpr intptr_t kBlocksPerPage = kPageSize / kBlockSize; - // Simplify initialization in allocation stubs by ensuring it is safe // to overshoot the object end by up to kAllocationRedZoneSize. (Just as the // stack red zone allows one to overshoot the stack pointer.) @@ -60,6 +45,21 @@ static constexpr intptr_t kAllocationRedZoneSize = kObjectAlignment; // +----------------------+ <- memory_->end() class Page { public: + // Pages are allocated with kPageSize alignment so that the Page of any + // object can be computed by masking the object with kPageMask. + // This does not apply to image pages, whose address is chosen by the system + // loader rather than the Dart VM. + static constexpr intptr_t kPageSize = 512 * KB; + static constexpr intptr_t kPageSizeInWords = kPageSize / kWordSize; + static constexpr intptr_t kPageMask = ~(kPageSize - 1); + + // See ForwardingBlock and CountingBlock. + static constexpr intptr_t kBitVectorWordsPerBlock = 1; + static constexpr intptr_t kBlockSize = + kObjectAlignment * kBitsPerWord * kBitVectorWordsPerBlock; + static constexpr intptr_t kBlockMask = ~(kBlockSize - 1); + static constexpr intptr_t kBlocksPerPage = kPageSize / kBlockSize; + static void Init(); static void ClearCache(); static intptr_t CachedSize(); diff --git a/runtime/vm/heap/pages.cc b/runtime/vm/heap/pages.cc index c33ddb44c88..555d9c45a19 100644 --- a/runtime/vm/heap/pages.cc +++ b/runtime/vm/heap/pages.cc @@ -175,10 +175,10 @@ void PageSpace::RemoveExecPageLocked(Page* page, Page* previous_page) { Page* PageSpace::AllocatePage(bool is_exec, bool link) { { MutexLocker ml(&pages_lock_); - if (!CanIncreaseCapacityInWordsLocked(kPageSizeInWords)) { + if (!CanIncreaseCapacityInWordsLocked(Page::kPageSizeInWords)) { return nullptr; } - IncreaseCapacityInWordsLocked(kPageSizeInWords); + IncreaseCapacityInWordsLocked(Page::kPageSizeInWords); } uword flags = 0; if (is_exec) { @@ -187,10 +187,10 @@ Page* PageSpace::AllocatePage(bool is_exec, bool link) { if ((heap_ != nullptr) && (heap_->is_vm_isolate())) { flags |= Page::kVMIsolate; } - Page* page = Page::Allocate(kPageSize, flags); + Page* page = Page::Allocate(Page::kPageSize, flags); if (page == nullptr) { RELEASE_ASSERT(!FLAG_abort_on_oom); - IncreaseCapacityInWords(-kPageSizeInWords); + IncreaseCapacityInWords(-Page::kPageSizeInWords); return nullptr; } @@ -323,14 +323,14 @@ uword PageSpace::TryAllocateInFreshPage(intptr_t size, if (growth_policy != kForceGrowth) { ASSERT(!Thread::Current()->force_growth()); heap_->CheckConcurrentMarking(Thread::Current(), GCReason::kOldSpace, - kPageSize); + Page::kPageSize); } uword result = 0; SpaceUsage after_allocation = GetCurrentUsage(); after_allocation.used_in_words += size >> kWordSizeLog2; // Can we grow by one page? - after_allocation.capacity_in_words += kPageSizeInWords; + after_allocation.capacity_in_words += Page::kPageSizeInWords; if (growth_policy == kForceGrowth || !page_space_controller_.ReachedHardThreshold(after_allocation)) { Page* page = AllocatePage(is_exec); @@ -760,7 +760,7 @@ void PageSpace::PrintHeapMapToJSONStream(IsolateGroup* isolate_group, heap_map.AddProperty("freeClassId", static_cast(kFreeListElement)); heap_map.AddProperty("unitSizeBytes", static_cast(kObjectAlignment)); - heap_map.AddProperty("pageSizeBytes", kPageSizeInWords * kWordSize); + heap_map.AddProperty("pageSizeBytes", Page::kPageSizeInWords * kWordSize); { JSONObject class_list(&heap_map, "classList"); isolate_group->class_table()->PrintToJSONObject(&class_list); @@ -854,8 +854,9 @@ bool PageSpace::ShouldPerformIdleMarkCompact(int64_t deadline) { // Discount two pages to account for the newest data and code pages, whose // partial use doesn't indicate fragmentation. - const intptr_t excess_in_words = - usage_.capacity_in_words - usage_.used_in_words - 2 * kPageSizeInWords; + const intptr_t excess_in_words = usage_.capacity_in_words - + usage_.used_in_words - + 2 * Page::kPageSizeInWords; const double excess_ratio = static_cast(excess_in_words) / static_cast(usage_.capacity_in_words); const bool fragmented = excess_ratio > 0.05; @@ -1651,7 +1652,7 @@ void PageSpaceController::EvaluateGarbageCollection(SpaceUsage before, (static_cast(after.CombinedUsedInWords() / desired_utilization_) - (after.CombinedUsedInWords())) / - kPageSizeInWords; + Page::kPageSizeInWords; if (garbage_ratio == 0) { // No garbage in the previous cycle so it would be hard to compute a // growth_in_pages size based on estimated garbage so we use growth ratio @@ -1682,7 +1683,7 @@ void PageSpaceController::EvaluateGarbageCollection(SpaceUsage before, while (min < max) { local_growth_in_pages = (max + min) / 2; const intptr_t limit = after.CombinedUsedInWords() + - (local_growth_in_pages * kPageSizeInWords); + (local_growth_in_pages * Page::kPageSizeInWords); const intptr_t allocated_before_next_gc = limit - (after.CombinedUsedInWords()); const double estimated_garbage = k * allocated_before_next_gc; @@ -1712,7 +1713,7 @@ void PageSpaceController::EvaluateGarbageCollection(SpaceUsage before, ASSERT(growth_in_pages >= 0); // Fraction of asymptote used. double f = static_cast(after.CombinedUsedInWords() + - (kPageSizeInWords * growth_in_pages)) / + (Page::kPageSizeInWords * growth_in_pages)) / static_cast(max_capacity_in_words); ASSERT(f >= 0.0); // Increase weight at the high end. @@ -1723,7 +1724,7 @@ void PageSpaceController::EvaluateGarbageCollection(SpaceUsage before, // Discount growth more the closer we get to the desired asymptote. growth_in_pages = static_cast(growth_in_pages * f); // Minimum growth step after reaching the asymptote. - intptr_t min_step = (2 * MB) / kPageSize; + intptr_t min_step = (2 * MB) / Page::kPageSize; growth_in_pages = Utils::Maximum(min_step, growth_in_pages); } @@ -1740,11 +1741,11 @@ void PageSpaceController::EvaluateAfterLoading(SpaceUsage after) { growth_in_pages = (static_cast(after.CombinedUsedInWords() / desired_utilization_) - (after.CombinedUsedInWords())) / - kPageSizeInWords; + Page::kPageSizeInWords; } // Apply growth cap. - intptr_t heap_growth_min = FLAG_new_gen_semi_max_size * MB / kPageSize; + intptr_t heap_growth_min = FLAG_new_gen_semi_max_size * MB / Page::kPageSize; growth_in_pages = Utils::Maximum(static_cast(heap_growth_min), growth_in_pages); growth_in_pages = @@ -1759,7 +1760,7 @@ void PageSpaceController::RecordUpdate(SpaceUsage before, const char* reason) { // Save final threshold compared before growing. intptr_t threshold = - after.CombinedUsedInWords() + (kPageSizeInWords * growth_in_pages); + after.CombinedUsedInWords() + (Page::kPageSizeInWords * growth_in_pages); bool concurrent_mark = FLAG_concurrent_mark && (FLAG_marker_tasks != 0); if (concurrent_mark) { @@ -1772,7 +1773,7 @@ void PageSpaceController::RecordUpdate(SpaceUsage before, // Set a tight idle threshold. idle_gc_threshold_in_words_ = - after.CombinedUsedInWords() + (2 * kPageSizeInWords); + after.CombinedUsedInWords() + (2 * Page::kPageSizeInWords); #if defined(SUPPORT_TIMELINE) Thread* thread = Thread::Current(); diff --git a/runtime/vm/heap/scavenger.cc b/runtime/vm/heap/scavenger.cc index dc22f44f5ff..48b711bef12 100644 --- a/runtime/vm/heap/scavenger.cc +++ b/runtime/vm/heap/scavenger.cc @@ -730,11 +730,11 @@ Page* SemiSpace::TryAllocatePageLocked(bool link) { if (capacity_in_words_ >= gc_threshold_in_words_) { return nullptr; // Full. } - Page* page = Page::Allocate(kPageSize, Page::kNew); + Page* page = Page::Allocate(Page::kPageSize, Page::kNew); if (page == nullptr) { return nullptr; // Out of memory; } - capacity_in_words_ += kPageSizeInWords; + capacity_in_words_ += Page::kPageSizeInWords; if (link) { if (head_ == nullptr) { head_ = tail_ = page; @@ -813,7 +813,7 @@ intptr_t Scavenger::NewSizeInWords(intptr_t old_size_in_words, GCReason reason) const { intptr_t num_mutators = heap_->isolate_group()->MutatorCount(); bool grow = false; - if (2 * num_mutators > (old_size_in_words / kPageSizeInWords)) { + if (2 * num_mutators > (old_size_in_words / Page::kPageSizeInWords)) { // Not enough TLABs to give two to each mutator. grow = true; } @@ -842,7 +842,7 @@ intptr_t Scavenger::NewSizeInWords(intptr_t old_size_in_words, // Preserve old behavior when heap size is small. limit = Utils::Maximum(limit, max_semi_capacity_in_words_); // Align to TLAB size. - limit = Utils::RoundDown(limit, kPageSizeInWords); + limit = Utils::RoundDown(limit, Page::kPageSizeInWords); intptr_t growth_factor = grow ? FLAG_new_gen_growth_factor : 1; return Utils::Minimum(old_size_in_words * growth_factor, limit); diff --git a/runtime/vm/object_graph.cc b/runtime/vm/object_graph.cc index 87e9dcd289d..0f1f06d2ec9 100644 --- a/runtime/vm/object_graph.cc +++ b/runtime/vm/object_graph.cc @@ -767,7 +767,7 @@ class CountingBlock { } intptr_t Lookup(uword addr) const { - uword block_offset = addr & ~kBlockMask; + uword block_offset = addr & ~Page::kBlockMask; intptr_t bitvector_shift = block_offset >> kObjectAlignmentLog2; ASSERT(bitvector_shift < kBitsPerWord); uword preceding_bitmask = (static_cast(1) << bitvector_shift) - 1; @@ -781,7 +781,7 @@ class CountingBlock { base_count_ = id; // First object in the block. } - uword block_offset = old_addr & ~kBlockMask; + uword block_offset = old_addr & ~Page::kBlockMask; intptr_t bitvector_shift = block_offset >> kObjectAlignmentLog2; ASSERT(bitvector_shift < kBitsPerWord); count_bitvector_ |= static_cast(1) << bitvector_shift; @@ -790,7 +790,7 @@ class CountingBlock { private: intptr_t base_count_; uword count_bitvector_; - COMPILE_ASSERT(kBitVectorWordsPerBlock == 1); + COMPILE_ASSERT(Page::kBitVectorWordsPerBlock == 1); DISALLOW_COPY_AND_ASSIGN(CountingBlock); }; @@ -798,7 +798,7 @@ class CountingBlock { class CountingPage { public: void Clear() { - for (intptr_t i = 0; i < kBlocksPerPage; i++) { + for (intptr_t i = 0; i < Page::kBlocksPerPage; i++) { blocks_[i].Clear(); } } @@ -809,15 +809,15 @@ class CountingPage { } CountingBlock* BlockFor(uword addr) { - intptr_t page_offset = addr & ~kPageMask; - intptr_t block_number = page_offset / kBlockSize; + intptr_t page_offset = addr & ~Page::kPageMask; + intptr_t block_number = page_offset / Page::kBlockSize; ASSERT(block_number >= 0); - ASSERT(block_number <= kBlocksPerPage); + ASSERT(block_number <= Page::kBlocksPerPage); return &blocks_[block_number]; } private: - CountingBlock blocks_[kBlocksPerPage]; + CountingBlock blocks_[Page::kBlocksPerPage]; DISALLOW_ALLOCATION(); DISALLOW_IMPLICIT_CONSTRUCTORS(CountingPage); diff --git a/runtime/vm/virtual_memory_compressed.h b/runtime/vm/virtual_memory_compressed.h index ca940c8578d..9de46d19580 100644 --- a/runtime/vm/virtual_memory_compressed.h +++ b/runtime/vm/virtual_memory_compressed.h @@ -16,9 +16,9 @@ namespace dart { static constexpr intptr_t kGuardRegionSize = 32 * GB; static constexpr intptr_t kCompressedHeapSize = 4 * GB; static constexpr intptr_t kCompressedHeapAlignment = 4 * GB; -static constexpr intptr_t kCompressedPageSize = kPageSize; +static constexpr intptr_t kCompressedPageSize = Page::kPageSize; static constexpr intptr_t kCompressedHeapNumPages = - kCompressedHeapSize / kPageSize; + kCompressedHeapSize / Page::kPageSize; static constexpr intptr_t kCompressedHeapBitmapSize = kCompressedHeapNumPages / 8; diff --git a/runtime/vm/virtual_memory_posix.cc b/runtime/vm/virtual_memory_posix.cc index 694948862f0..f39f79f5e67 100644 --- a/runtime/vm/virtual_memory_posix.cc +++ b/runtime/vm/virtual_memory_posix.cc @@ -584,7 +584,7 @@ void VirtualMemory::Init() { int count = fscanf(fp, "%zu", &max_map_count); fclose(fp); if (count == 1) { - size_t max_heap_pages = FLAG_old_gen_heap_size * MB / kPageSize; + size_t max_heap_pages = FLAG_old_gen_heap_size * MB / Page::kPageSize; if (max_map_count < max_heap_pages) { OS::PrintErr( "warning: vm.max_map_count (%zu) is not large enough to support " diff --git a/runtime/vm/virtual_memory_test.cc b/runtime/vm/virtual_memory_test.cc index ab9b2e1acc9..b47e423c47a 100644 --- a/runtime/vm/virtual_memory_test.cc +++ b/runtime/vm/virtual_memory_test.cc @@ -52,7 +52,7 @@ VM_UNIT_TEST_CASE(AllocateVirtualMemory) { } VM_UNIT_TEST_CASE(AllocateAlignedVirtualMemory) { - intptr_t kHeapPageSize = kPageSize; + intptr_t kHeapPageSize = Page::kPageSize; intptr_t kVirtualPageSize = 4096; intptr_t kIterations = kHeapPageSize / kVirtualPageSize; @@ -111,7 +111,7 @@ VM_UNIT_TEST_CASE(DuplicateRXVirtualMemory) { const bool is_executable = false; VirtualMemory* vm2 = VirtualMemory::AllocateAligned( - vm->size(), kPageSize, is_executable, + vm->size(), Page::kPageSize, is_executable, /*is_compressed=*/false, "FfiCallbackMetadata::TrampolinePage"); bool ok = vm->DuplicateRX(vm2); EXPECT_EQ(true, ok); diff --git a/tools/run_offsets_extractor.dart b/tools/run_offsets_extractor.dart index 1bae3fb785b..ed426bbc367 100755 --- a/tools/run_offsets_extractor.dart +++ b/tools/run_offsets_extractor.dart @@ -53,6 +53,9 @@ Future runOffsetsExtractor() async { String toCValue(Object? value) { final intValue = int.parse(value as String); if (intValue == -1) return '-1'; + if (intValue < 0) { + return '-0x${(-intValue).toRadixString(16)}'; + } return '0x${intValue.toRadixString(16)}'; }