summaryrefslogtreecommitdiffstats
path: root/runtime/gc/collector/semi_space.cc
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2014-02-25 17:01:10 -0800
committerIan Rogers <irogers@google.com>2014-02-26 16:38:22 -0800
commit6fac447555dc94a935b78198479cce645c837b89 (patch)
treebcf1449999084b1e1dec3dac287f6f3670d7eda0 /runtime/gc/collector/semi_space.cc
parent7f0ff7e7fff82566bca5f9353eaa2c4f81f0671a (diff)
downloadart-6fac447555dc94a935b78198479cce645c837b89.zip
art-6fac447555dc94a935b78198479cce645c837b89.tar.gz
art-6fac447555dc94a935b78198479cce645c837b89.tar.bz2
Make allocations report usable size.
Work-in-progress to allow arrays to fill usable size. Bug: 13028925. Use C++11's override keyword on GCC >= 2.7 to ensure that we override GC and allocator methods. Move initial mirror::Class set up into a Functor so that all allocated objects have non-zero sizes. Use this property to assert that all objects are never larger than their usable size. Other bits of GC related clean-up, missing initialization, missing use of const, hot methods in .cc files, "unimplemented" functions that fail at runtime in header files, reducing header file includes, move valgrind's space into its own files, reduce number of array allocation routines. Change-Id: Id5760041a2d7f94dcaf17ec760f6095ec75dadaa
Diffstat (limited to 'runtime/gc/collector/semi_space.cc')
-rw-r--r--runtime/gc/collector/semi_space.cc12
1 files changed, 7 insertions, 5 deletions
diff --git a/runtime/gc/collector/semi_space.cc b/runtime/gc/collector/semi_space.cc
index d639db5..a4c9dea 100644
--- a/runtime/gc/collector/semi_space.cc
+++ b/runtime/gc/collector/semi_space.cc
@@ -133,13 +133,15 @@ SemiSpace::SemiSpace(Heap* heap, bool generational, const std::string& name_pref
immune_end_(nullptr),
is_large_object_space_immune_(false),
to_space_(nullptr),
+ to_space_live_bitmap_(nullptr),
from_space_(nullptr),
self_(nullptr),
generational_(generational),
last_gc_to_space_end_(nullptr),
bytes_promoted_(0),
whole_heap_collection_(true),
- whole_heap_collection_interval_counter_(0) {
+ whole_heap_collection_interval_counter_(0),
+ saved_bytes_(0) {
}
void SemiSpace::InitializePhase() {
@@ -263,7 +265,7 @@ class SemiSpaceScanObjectVisitor {
semi_space_->ScanObject(obj);
}
private:
- SemiSpace* semi_space_;
+ SemiSpace* const semi_space_;
};
void SemiSpace::MarkReachableObjects() {
@@ -467,10 +469,10 @@ mirror::Object* SemiSpace::MarkNonForwardedObject(mirror::Object* obj) {
// of an old generation.)
size_t bytes_promoted;
space::MallocSpace* promo_dest_space = GetHeap()->GetPrimaryFreeListSpace();
- forward_address = promo_dest_space->Alloc(self_, object_size, &bytes_promoted);
+ forward_address = promo_dest_space->Alloc(self_, object_size, &bytes_promoted, nullptr);
if (forward_address == nullptr) {
// If out of space, fall back to the to-space.
- forward_address = to_space_->Alloc(self_, object_size, &bytes_allocated);
+ forward_address = to_space_->Alloc(self_, object_size, &bytes_allocated, nullptr);
} else {
GetHeap()->num_bytes_allocated_.FetchAndAdd(bytes_promoted);
bytes_promoted_ += bytes_promoted;
@@ -511,7 +513,7 @@ mirror::Object* SemiSpace::MarkNonForwardedObject(mirror::Object* obj) {
DCHECK(forward_address != nullptr);
} else {
// If it's allocated after the last GC (younger), copy it to the to-space.
- forward_address = to_space_->Alloc(self_, object_size, &bytes_allocated);
+ forward_address = to_space_->Alloc(self_, object_size, &bytes_allocated, nullptr);
}
// Copy over the object and add it to the mark stack since we still need to update its
// references.