diff options
author | 2018-10-31 11:50:26 -0700 | |
---|---|---|
committer | 2018-10-31 12:50:20 -0700 | |
commit | 41c080891ca9d8834c9b50c3ac18dd01c20de9e9 (patch) | |
tree | abdf11b6e000884004c0c82f784a90595f63da05 /runtime/intern_table.h | |
parent | 41271dd3dfc2ff75702ae3b709eb8afa9464a49f (diff) |
Hold intern table lock for AddImageStringsToTable
Fixes a correctness issue where another thread adding an intern string
after the visitor could cause duplicate strings.
Reduces how often the intern table lock is acquired, probably
improving performance.
Bug: 116059983
Test: test-art-host
Change-Id: I5ba6ca3ba7535de6d4ad5cb46750bd23a6e9aadc
Diffstat (limited to 'runtime/intern_table.h')
-rw-r--r-- | runtime/intern_table.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/runtime/intern_table.h b/runtime/intern_table.h index 1bc89a1048..e918a458b9 100644 --- a/runtime/intern_table.h +++ b/runtime/intern_table.h @@ -145,11 +145,15 @@ class InternTable { ObjPtr<mirror::String> LookupStrong(Thread* self, uint32_t utf16_length, const char* utf8_data) REQUIRES(!Locks::intern_table_lock_) REQUIRES_SHARED(Locks::mutator_lock_); + ObjPtr<mirror::String> LookupStrongLocked(ObjPtr<mirror::String> s) + REQUIRES_SHARED(Locks::mutator_lock_) REQUIRES(Locks::intern_table_lock_); // Lookup a weak intern, returns null if not found. ObjPtr<mirror::String> LookupWeak(Thread* self, ObjPtr<mirror::String> s) REQUIRES(!Locks::intern_table_lock_) REQUIRES_SHARED(Locks::mutator_lock_); + ObjPtr<mirror::String> LookupWeakLocked(ObjPtr<mirror::String> s) + REQUIRES_SHARED(Locks::mutator_lock_) REQUIRES(Locks::intern_table_lock_); // Total number of interned strings. size_t Size() const REQUIRES(!Locks::intern_table_lock_); @@ -250,10 +254,6 @@ class InternTable { size_t AddTableFromMemory(const uint8_t* ptr, const Visitor& visitor) REQUIRES(!Locks::intern_table_lock_) REQUIRES_SHARED(Locks::mutator_lock_); - ObjPtr<mirror::String> LookupStrongLocked(ObjPtr<mirror::String> s) - REQUIRES_SHARED(Locks::mutator_lock_) REQUIRES(Locks::intern_table_lock_); - ObjPtr<mirror::String> LookupWeakLocked(ObjPtr<mirror::String> s) - REQUIRES_SHARED(Locks::mutator_lock_) REQUIRES(Locks::intern_table_lock_); ObjPtr<mirror::String> InsertStrong(ObjPtr<mirror::String> s) REQUIRES_SHARED(Locks::mutator_lock_) REQUIRES(Locks::intern_table_lock_); ObjPtr<mirror::String> InsertWeak(ObjPtr<mirror::String> s) |