summaryrefslogtreecommitdiffstats
path: root/runtime/gc/accounting/mod_union_table.cc
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2014-01-28 14:50:23 -0800
committerMathieu Chartier <mathieuc@google.com>2014-02-11 10:40:10 -0800
commit83c8ee000d525017ead8753fce6bc1020249b96a (patch)
treed5167ed15dee2629905ac3640b6ea0578d4ae312 /runtime/gc/accounting/mod_union_table.cc
parent7cba217ab0661d74deccbb97160cdf60b74d4ea3 (diff)
downloadart-83c8ee000d525017ead8753fce6bc1020249b96a.tar.gz
art-83c8ee000d525017ead8753fce6bc1020249b96a.tar.bz2
art-83c8ee000d525017ead8753fce6bc1020249b96a.zip
Add root types and thread id to root visiting.
Enables us to pass the root type and thread id to hprof. Bug: 12680863 Change-Id: I6a0f1f9e3aa8f9b4033d695818ae7ca3460d67cb
Diffstat (limited to 'runtime/gc/accounting/mod_union_table.cc')
-rw-r--r--runtime/gc/accounting/mod_union_table.cc26
1 files changed, 13 insertions, 13 deletions
diff --git a/runtime/gc/accounting/mod_union_table.cc b/runtime/gc/accounting/mod_union_table.cc
index 0225f29fef..aad214af3e 100644
--- a/runtime/gc/accounting/mod_union_table.cc
+++ b/runtime/gc/accounting/mod_union_table.cc
@@ -70,8 +70,8 @@ class ModUnionClearCardVisitor {
class ModUnionUpdateObjectReferencesVisitor {
public:
- ModUnionUpdateObjectReferencesVisitor(RootVisitor visitor, void* arg)
- : visitor_(visitor),
+ ModUnionUpdateObjectReferencesVisitor(RootCallback* 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 = visitor_(ref, arg_);
+ Object* new_ref = callback_(ref, arg_, 0, kRootVMInternal);
if (new_ref != ref) {
// Use SetFieldObjectWithoutWriteBarrier to avoid card mark as an optimization which
// reduces dirtied pages and improves performance.
@@ -90,26 +90,26 @@ class ModUnionUpdateObjectReferencesVisitor {
}
private:
- RootVisitor* visitor_;
+ RootCallback* const callback_;
void* arg_;
};
class ModUnionScanImageRootVisitor {
public:
- ModUnionScanImageRootVisitor(RootVisitor visitor, void* arg)
- : visitor_(visitor), arg_(arg) {}
+ ModUnionScanImageRootVisitor(RootCallback* callback, void* arg)
+ : callback_(callback), arg_(arg) {}
void operator()(Object* root) const
EXCLUSIVE_LOCKS_REQUIRED(Locks::heap_bitmap_lock_)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
DCHECK(root != NULL);
- ModUnionUpdateObjectReferencesVisitor ref_visitor(visitor_, arg_);
+ ModUnionUpdateObjectReferencesVisitor ref_visitor(callback_, arg_);
collector::MarkSweep::VisitObjectReferences(root, ref_visitor, true);
}
private:
- RootVisitor* visitor_;
- void* arg_;
+ RootCallback* const callback_;
+ void* const arg_;
};
void ModUnionTableReferenceCache::ClearCards() {
@@ -261,7 +261,7 @@ void ModUnionTableReferenceCache::Dump(std::ostream& os) {
}
}
-void ModUnionTableReferenceCache::UpdateAndMarkReferences(RootVisitor visitor, void* arg) {
+void ModUnionTableReferenceCache::UpdateAndMarkReferences(RootCallback* callback, void* arg) {
Heap* heap = GetHeap();
CardTable* card_table = heap->GetCardTable();
@@ -296,7 +296,7 @@ void ModUnionTableReferenceCache::UpdateAndMarkReferences(RootVisitor visitor, v
for (mirror::HeapReference<Object>* obj_ptr : ref.second) {
Object* obj = obj_ptr->AsMirrorPtr();
if (obj != nullptr) {
- Object* new_obj = visitor(obj, arg);
+ Object* new_obj = callback(obj, arg, 0, kRootVMInternal);
// Avoid dirtying pages in the image unless necessary.
if (new_obj != obj) {
obj_ptr->Assign(new_obj);
@@ -318,9 +318,9 @@ void ModUnionTableCardCache::ClearCards() {
}
// Mark all references to the alloc space(s).
-void ModUnionTableCardCache::UpdateAndMarkReferences(RootVisitor visitor, void* arg) {
+void ModUnionTableCardCache::UpdateAndMarkReferences(RootCallback* callback, void* arg) {
CardTable* card_table = heap_->GetCardTable();
- ModUnionScanImageRootVisitor scan_visitor(visitor, arg);
+ ModUnionScanImageRootVisitor scan_visitor(callback, arg);
SpaceBitmap* bitmap = space_->GetLiveBitmap();
for (const byte* card_addr : cleared_cards_) {
uintptr_t start = reinterpret_cast<uintptr_t>(card_table->AddrFromCard(card_addr));