Skip to content
This repository has been archived by the owner on Feb 25, 2025. It is now read-only.

Commit

Permalink
[vm, gc] New-space alignment is not configurable.
Browse files Browse the repository at this point in the history
Change-Id: I6bb1c3dab0319ac5d827c947f38cb6396d2f7d81
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134809
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
  • Loading branch information
rmacnak-google authored and commit-bot@chromium.org committed Feb 7, 2020
1 parent dae6000 commit 16782e6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
2 changes: 1 addition & 1 deletion runtime/vm/heap/heap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Heap::Heap(Isolate* isolate,
intptr_t max_new_gen_semi_words,
intptr_t max_old_gen_words)
: isolate_(isolate),
new_space_(this, max_new_gen_semi_words, kNewObjectAlignmentOffset),
new_space_(this, max_new_gen_semi_words),
old_space_(this, max_old_gen_words),
barrier_(),
barrier_done_(),
Expand Down
7 changes: 2 additions & 5 deletions runtime/vm/heap/scavenger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -421,12 +421,9 @@ void SemiSpace::WriteProtect(bool read_only) {
// on the device's actual speed.
static const intptr_t kConservativeInitialScavengeSpeed = 40;

Scavenger::Scavenger(Heap* heap,
intptr_t max_semi_capacity_in_words,
uword object_alignment)
Scavenger::Scavenger(Heap* heap, intptr_t max_semi_capacity_in_words)
: heap_(heap),
max_semi_capacity_in_words_(max_semi_capacity_in_words),
object_alignment_(object_alignment),
scavenging_(false),
delayed_weak_properties_(NULL),
gc_time_micros_(0),
Expand Down Expand Up @@ -1009,7 +1006,7 @@ uword Scavenger::TryAllocateNewTLAB(Thread* thread, intptr_t size) {
return 0;
}
ASSERT(to_->Contains(result));
ASSERT((result & kObjectAlignmentMask) == object_alignment_);
ASSERT((result & kObjectAlignmentMask) == kNewObjectAlignmentOffset);
top_ += size;
ASSERT(to_->Contains(top_) || (top_ == to_->end()));
ASSERT(result < top_);
Expand Down
15 changes: 6 additions & 9 deletions runtime/vm/heap/scavenger.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,7 @@ class ScavengeStats {

class Scavenger {
public:
Scavenger(Heap* heap,
intptr_t max_semi_capacity_in_words,
uword object_alignment);
Scavenger(Heap* heap, intptr_t max_semi_capacity_in_words);
~Scavenger();

// Check whether this Scavenger contains this address.
Expand All @@ -140,7 +138,7 @@ class Scavenger {
// the new to_ space. It must succeed.
ASSERT(size <= remaining);
ASSERT(to_->Contains(result));
ASSERT((result & kObjectAlignmentMask) == object_alignment_);
ASSERT((result & kObjectAlignmentMask) == kNewObjectAlignmentOffset);
top_ += size;
ASSERT((to_->Contains(top_)) || (top_ == to_->end()));
return result;
Expand All @@ -157,7 +155,7 @@ class Scavenger {
return 0;
}
ASSERT(to_->Contains(result));
ASSERT((result & kObjectAlignmentMask) == object_alignment_);
ASSERT((result & kObjectAlignmentMask) == kNewObjectAlignmentOffset);
top += size;
ASSERT((to_->Contains(top)) || (top == to_->end()));
thread->set_top(top);
Expand Down Expand Up @@ -237,7 +235,9 @@ class Scavenger {
kToKBAfterStoreBuffer = 3
};

uword FirstObjectStart() const { return to_->start() | object_alignment_; }
uword FirstObjectStart() const {
return to_->start() + kNewObjectAlignmentOffset;
}
SemiSpace* Prologue(Isolate* isolate);
void IterateStoreBuffers(Isolate* isolate, ScavengerVisitor* visitor);
void IterateObjectIdTable(Isolate* isolate, ScavengerVisitor* visitor);
Expand Down Expand Up @@ -298,9 +298,6 @@ class Scavenger {

intptr_t max_semi_capacity_in_words_;

// All object are aligned to this value.
uword object_alignment_;

// Keep track whether a scavenge is currently running.
bool scavenging_;

Expand Down

0 comments on commit 16782e6

Please sign in to comment.