diff options
author | Mathieu Chartier <mathieuc@google.com> | 2013-09-19 10:01:59 -0700 |
---|---|---|
committer | Mathieu Chartier <mathieuc@google.com> | 2013-09-20 10:36:49 -0700 |
commit | c11d9b8870de5f860b13c84003ade7b3f3125a52 (patch) | |
tree | 89b0250d35a950774f98fa1abfa9cc296c9d85db /runtime/intern_table.cc | |
parent | 261d3cda32b28782d894be0244e617f78182ee3b (diff) | |
download | art-c11d9b8870de5f860b13c84003ade7b3f3125a52.zip art-c11d9b8870de5f860b13c84003ade7b3f3125a52.tar.gz art-c11d9b8870de5f860b13c84003ade7b3f3125a52.tar.bz2 |
Re-enable concurrent system weak sweeping.
Enabled by disallowing new system weaks during the pause and
re-allowing it after the system weaks have been swept. Reduces
GC pause by ~1ms.
Fixes pause regression caused by fix for
Bug: 10626133
Change-Id: If49d33e7ef19cb728ed3cef5187acfa53b9b05d8
Diffstat (limited to 'runtime/intern_table.cc')
-rw-r--r-- | runtime/intern_table.cc | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/runtime/intern_table.cc b/runtime/intern_table.cc index 89c15f8..2072979 100644 --- a/runtime/intern_table.cc +++ b/runtime/intern_table.cc @@ -28,7 +28,9 @@ namespace art { InternTable::InternTable() - : intern_table_lock_("InternTable lock"), is_dirty_(false) {} + : intern_table_lock_("InternTable lock"), is_dirty_(false), allow_new_interns_(true), + new_intern_condition_("New intern condition", intern_table_lock_) { +} size_t InternTable::Size() const { MutexLock mu(Thread::Current(), intern_table_lock_); @@ -111,12 +113,30 @@ static mirror::String* LookupStringFromImage(mirror::String* s) return NULL; } +void InternTable::AllowNewInterns() { + Thread* self = Thread::Current(); + MutexLock mu(self, intern_table_lock_); + allow_new_interns_ = true; + new_intern_condition_.Broadcast(self); +} + +void InternTable::DisallowNewInterns() { + Thread* self = Thread::Current(); + MutexLock mu(self, intern_table_lock_); + allow_new_interns_ = false; +} + mirror::String* InternTable::Insert(mirror::String* s, bool is_strong) { - MutexLock mu(Thread::Current(), intern_table_lock_); + Thread* self = Thread::Current(); + MutexLock mu(self, intern_table_lock_); DCHECK(s != NULL); uint32_t hash_code = s->GetHashCode(); + while (UNLIKELY(!allow_new_interns_)) { + new_intern_condition_.WaitHoldingLocks(self); + } + if (is_strong) { // Check the strong table for a match. mirror::String* strong = Lookup(strong_interns_, s, hash_code); |