[vm] Move constants related to heap pages into Page
Moving these constants from global namespace to Page class prevents possible conflicts with other kPageSize/kPageMask/kBlockSize constants and allows us to export value of Page::kPageMask constant into runtime offsets via runtime/vm/compiler/runtime_offsets_list.h. TEST=ci Change-Id: I4357f4644f0f5f7beba50184231fef55dd86b124 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/476147 Reviewed-by: Ryan Macnak <rmacnak@google.com> Commit-Queue: Alexander Markov <alexmarkov@google.com>
This commit is contained in:
committed by
Commit Queue
parent
9f89e55d52
commit
f29628fe63
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<uword>(1) << kSmiBits) - 1;
|
||||
constexpr word kSmiMin = -(static_cast<uword>(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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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) \
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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<uword>(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<uword>(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_;
|
||||
|
||||
@@ -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
|
||||
|
||||
+15
-15
@@ -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();
|
||||
|
||||
+18
-17
@@ -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<intptr_t>(kFreeListElement));
|
||||
heap_map.AddProperty("unitSizeBytes",
|
||||
static_cast<intptr_t>(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<double>(excess_in_words) /
|
||||
static_cast<double>(usage_.capacity_in_words);
|
||||
const bool fragmented = excess_ratio > 0.05;
|
||||
@@ -1651,7 +1652,7 @@ void PageSpaceController::EvaluateGarbageCollection(SpaceUsage before,
|
||||
(static_cast<intptr_t>(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<double>(after.CombinedUsedInWords() +
|
||||
(kPageSizeInWords * growth_in_pages)) /
|
||||
(Page::kPageSizeInWords * growth_in_pages)) /
|
||||
static_cast<double>(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<intptr_t>(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<intptr_t>(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<intptr_t>(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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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<uword>(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<uword>(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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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 "
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -53,6 +53,9 @@ Future<String> 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)}';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user