Enable concurrent sweeping
Now we unlock the heap during the sweeping process. When sweeping, the heap is only locked when dealing with dlmalloc.
Change-Id: I705ac499adbf0039a3e57d2c5d354b1087317032
diff --git a/src/heap_bitmap.h b/src/heap_bitmap.h
index e2109d6..29a7b1f 100644
--- a/src/heap_bitmap.h
+++ b/src/heap_bitmap.h
@@ -51,7 +51,7 @@
SpaceBitmap* GetSpaceBitmap(const Object* obj) {
// TODO: C++0x auto
- for (BitmapVec::iterator cur = bitmaps_.begin(); cur != bitmaps_.end(); ++cur) {
+ for (Bitmaps::iterator cur = bitmaps_.begin(); cur != bitmaps_.end(); ++cur) {
if ((*cur)->HasAddress(obj)) {
return *cur;
}
@@ -61,18 +61,21 @@
void Walk(SpaceBitmap::Callback* callback, void* arg) {
// TODO: C++0x auto
- for (BitmapVec::iterator cur = bitmaps_.begin(); cur != bitmaps_.end(); ++cur) {
+ for (Bitmaps::iterator cur = bitmaps_.begin(); cur != bitmaps_.end(); ++cur) {
(*cur)->Walk(callback, arg);
}
}
+ // Find and replace a bitmap pointer, this is used by for the bitmap swapping in the GC.
+ void ReplaceBitmap(SpaceBitmap* old_bitmap, SpaceBitmap* new_bitmap);
+
private:
void AddSpaceBitmap(SpaceBitmap* space) {
bitmaps_.push_back(space);
}
- typedef std::vector<SpaceBitmap*> BitmapVec;
- BitmapVec bitmaps_;
+ typedef std::vector<SpaceBitmap*> Bitmaps;
+ Bitmaps bitmaps_;
friend class Heap;
};