diff options
author | 2015-04-03 11:21:55 -0700 | |
---|---|---|
committer | 2015-04-06 10:44:37 -0700 | |
commit | bb87e0f1a52de656bc77cb01cb887e51a0e5198b (patch) | |
tree | 113f014c6e20fab3e936a3ac05f9f738639541f6 /runtime/intern_table.cc | |
parent | e57fc0f0260fcb1d08cbb720ec95c04c0f394b91 (diff) |
Refactor and improve GC root handling
Changed GcRoot to use compressed references. Changed root visiting to
use virtual functions instead of function pointers. Changed root visting
interface to be an array of roots instead of a single root at a time.
Added buffered root marking helper to avoid dispatch overhead.
Root marking seems a bit faster on EvaluateAndApplyChanges due to batch
marking. Pause times unaffected.
Mips64 is untested but might work, maybe.
Before:
MarkConcurrentRoots: Sum: 67.678ms 99% C.I. 2us-664.999us Avg: 161.138us Max: 671us
After:
MarkConcurrentRoots: Sum: 54.806ms 99% C.I. 2us-499.986us Avg: 136.333us Max: 602us
Bug: 19264997
Change-Id: I0a71ebb5928f205b9b3f7945b25db6489d5657ca
Diffstat (limited to 'runtime/intern_table.cc')
-rw-r--r-- | runtime/intern_table.cc | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/runtime/intern_table.cc b/runtime/intern_table.cc index 19bfc4e353..8e85435154 100644 --- a/runtime/intern_table.cc +++ b/runtime/intern_table.cc @@ -53,14 +53,14 @@ void InternTable::DumpForSigQuit(std::ostream& os) const { os << "Intern table: " << StrongSize() << " strong; " << WeakSize() << " weak\n"; } -void InternTable::VisitRoots(RootCallback* callback, void* arg, VisitRootFlags flags) { +void InternTable::VisitRoots(RootVisitor* visitor, VisitRootFlags flags) { MutexLock mu(Thread::Current(), *Locks::intern_table_lock_); if ((flags & kVisitRootFlagAllRoots) != 0) { - strong_interns_.VisitRoots(callback, arg); + strong_interns_.VisitRoots(visitor); } else if ((flags & kVisitRootFlagNewRoots) != 0) { for (auto& root : new_strong_intern_roots_) { mirror::String* old_ref = root.Read<kWithoutReadBarrier>(); - root.VisitRoot(callback, arg, RootInfo(kRootInternedString)); + root.VisitRoot(visitor, RootInfo(kRootInternedString)); mirror::String* new_ref = root.Read<kWithoutReadBarrier>(); if (new_ref != old_ref) { // The GC moved a root in the log. Need to search the strong interns and update the @@ -335,12 +335,13 @@ void InternTable::Table::Insert(mirror::String* s) { post_zygote_table_.Insert(GcRoot<mirror::String>(s)); } -void InternTable::Table::VisitRoots(RootCallback* callback, void* arg) { +void InternTable::Table::VisitRoots(RootVisitor* visitor) { + BufferedRootVisitor<128> buffered_visitor(visitor, RootInfo(kRootInternedString)); for (auto& intern : pre_zygote_table_) { - intern.VisitRoot(callback, arg, RootInfo(kRootInternedString)); + buffered_visitor.VisitRoot(intern); } for (auto& intern : post_zygote_table_) { - intern.VisitRoot(callback, arg, RootInfo(kRootInternedString)); + buffered_visitor.VisitRoot(intern); } } |