summaryrefslogtreecommitdiffstats
path: root/runtime/gc/accounting
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2014-02-13 18:02:13 -0800
committerMathieu Chartier <mathieuc@google.com>2014-02-18 10:45:12 -0800
commit815873ecc312b1d231acce71e1a16f42cdaf09f2 (patch)
tree18ba2fa951775e60b240271bfe975e6e2cfc654c /runtime/gc/accounting
parent2befd09cf4fe89a18a655f3e1dd310831bfa769f (diff)
downloadandroid_art-815873ecc312b1d231acce71e1a16f42cdaf09f2.tar.gz
android_art-815873ecc312b1d231acce71e1a16f42cdaf09f2.tar.bz2
android_art-815873ecc312b1d231acce71e1a16f42cdaf09f2.zip
Change root visitor to use Object**.
Simplifies code and improves the performance of root visiting since we usually don't need to check to see if the object moved. Change-Id: Iba998f5a15ae1fa1b53ca5226dd2168a411196cf
Diffstat (limited to 'runtime/gc/accounting')
-rw-r--r--runtime/gc/accounting/mod_union_table.cc17
-rw-r--r--runtime/gc/accounting/mod_union_table.h6
2 files changed, 12 insertions, 11 deletions
diff --git a/runtime/gc/accounting/mod_union_table.cc b/runtime/gc/accounting/mod_union_table.cc
index 625807048a..06127c11b9 100644
--- a/runtime/gc/accounting/mod_union_table.cc
+++ b/runtime/gc/accounting/mod_union_table.cc
@@ -70,7 +70,7 @@ class ModUnionClearCardVisitor {
class ModUnionUpdateObjectReferencesVisitor {
public:
- ModUnionUpdateObjectReferencesVisitor(RootCallback* callback, void* arg)
+ ModUnionUpdateObjectReferencesVisitor(MarkObjectCallback* callback, void* arg)
: callback_(callback),
arg_(arg) {
}
@@ -80,7 +80,7 @@ class ModUnionUpdateObjectReferencesVisitor {
bool /* is_static */) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
// Only add the reference if it is non null and fits our criteria.
if (ref != nullptr) {
- Object* new_ref = callback_(ref, arg_, 0, kRootVMInternal);
+ Object* new_ref = callback_(ref, arg_);
if (new_ref != ref) {
// Use SetFieldObjectWithoutWriteBarrier to avoid card mark as an optimization which
// reduces dirtied pages and improves performance.
@@ -94,13 +94,13 @@ class ModUnionUpdateObjectReferencesVisitor {
}
private:
- RootCallback* const callback_;
+ MarkObjectCallback* const callback_;
void* arg_;
};
class ModUnionScanImageRootVisitor {
public:
- ModUnionScanImageRootVisitor(RootCallback* callback, void* arg)
+ ModUnionScanImageRootVisitor(MarkObjectCallback* callback, void* arg)
: callback_(callback), arg_(arg) {}
void operator()(Object* root) const
@@ -112,7 +112,7 @@ class ModUnionScanImageRootVisitor {
}
private:
- RootCallback* const callback_;
+ MarkObjectCallback* const callback_;
void* const arg_;
};
@@ -265,7 +265,8 @@ void ModUnionTableReferenceCache::Dump(std::ostream& os) {
}
}
-void ModUnionTableReferenceCache::UpdateAndMarkReferences(RootCallback* callback, void* arg) {
+void ModUnionTableReferenceCache::UpdateAndMarkReferences(MarkObjectCallback* callback,
+ void* arg) {
Heap* heap = GetHeap();
CardTable* card_table = heap->GetCardTable();
@@ -300,7 +301,7 @@ void ModUnionTableReferenceCache::UpdateAndMarkReferences(RootCallback* callback
for (mirror::HeapReference<Object>* obj_ptr : ref.second) {
Object* obj = obj_ptr->AsMirrorPtr();
if (obj != nullptr) {
- Object* new_obj = callback(obj, arg, 0, kRootVMInternal);
+ Object* new_obj = callback(obj, arg);
// Avoid dirtying pages in the image unless necessary.
if (new_obj != obj) {
obj_ptr->Assign(new_obj);
@@ -322,7 +323,7 @@ void ModUnionTableCardCache::ClearCards() {
}
// Mark all references to the alloc space(s).
-void ModUnionTableCardCache::UpdateAndMarkReferences(RootCallback* callback, void* arg) {
+void ModUnionTableCardCache::UpdateAndMarkReferences(MarkObjectCallback* callback, void* arg) {
CardTable* card_table = heap_->GetCardTable();
ModUnionScanImageRootVisitor scan_visitor(callback, arg);
SpaceBitmap* bitmap = space_->GetLiveBitmap();
diff --git a/runtime/gc/accounting/mod_union_table.h b/runtime/gc/accounting/mod_union_table.h
index 7d5d8d2e19..2e22a116c7 100644
--- a/runtime/gc/accounting/mod_union_table.h
+++ b/runtime/gc/accounting/mod_union_table.h
@@ -69,7 +69,7 @@ class ModUnionTable {
// Update the mod-union table using data stored by ClearCards. There may be multiple ClearCards
// before a call to update, for example, back-to-back sticky GCs. Also mark references to other
// spaces which are stored in the mod-union table.
- virtual void UpdateAndMarkReferences(RootCallback* callback, void* arg) = 0;
+ virtual void UpdateAndMarkReferences(MarkObjectCallback* callback, void* arg) = 0;
// Verification, sanity checks that we don't have clean cards which conflict with out cached data
// for said cards. Exclusive lock is required since verify sometimes uses
@@ -106,7 +106,7 @@ class ModUnionTableReferenceCache : public ModUnionTable {
void ClearCards();
// Update table based on cleared cards and mark all references to the other spaces.
- void UpdateAndMarkReferences(RootCallback* callback, void* arg)
+ void UpdateAndMarkReferences(MarkObjectCallback* callback, void* arg)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
EXCLUSIVE_LOCKS_REQUIRED(Locks::heap_bitmap_lock_);
@@ -142,7 +142,7 @@ class ModUnionTableCardCache : public ModUnionTable {
void ClearCards();
// Mark all references to the alloc space(s).
- void UpdateAndMarkReferences(RootCallback* callback, void* arg)
+ void UpdateAndMarkReferences(MarkObjectCallback* callback, void* arg)
EXCLUSIVE_LOCKS_REQUIRED(Locks::heap_bitmap_lock_)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);