diff options
author | 2017-02-03 11:47:34 +0000 | |
---|---|---|
committer | 2017-02-09 10:10:29 +0000 | |
commit | cd556b003adbb53739d4b3f43135e6a0ae69509a (patch) | |
tree | a30c9f03071d87e1f75a0d0b8c2961d113ea767d /compiler/optimizing | |
parent | 357dcb73934356239292c46d6fbedba734da5e00 (diff) |
Fix dex cache resolved types and class table mismatch.
Record class table in ClassLinker::DexCacheData and use
it in DexCache.setResolvedType() to store the type also
in the initiating loader's class table if the dex file
has been registered.
Also throw InternalError when trying to register the
same DexFile with multiple class loaders. (Different
DexFile instances referencing the same file are OK.)
Test: 155-java-set-resolved-type
Test: m test-art-host
Bug: 30627598
Bug: 34193123
Bug: 34839984
Change-Id: Ia48acb300337c45880ea1459d2d32789546d67f4
Diffstat (limited to 'compiler/optimizing')
-rw-r--r-- | compiler/optimizing/reference_type_propagation.cc | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/compiler/optimizing/reference_type_propagation.cc b/compiler/optimizing/reference_type_propagation.cc index b02f2509ab..c55fccc7d3 100644 --- a/compiler/optimizing/reference_type_propagation.cc +++ b/compiler/optimizing/reference_type_propagation.cc @@ -24,9 +24,8 @@ namespace art { -static inline mirror::DexCache* FindDexCacheWithHint(Thread* self, - const DexFile& dex_file, - Handle<mirror::DexCache> hint_dex_cache) +static inline ObjPtr<mirror::DexCache> FindDexCacheWithHint( + Thread* self, const DexFile& dex_file, Handle<mirror::DexCache> hint_dex_cache) REQUIRES_SHARED(Locks::mutator_lock_) { if (LIKELY(hint_dex_cache->GetDexFile() == &dex_file)) { return hint_dex_cache.Get(); @@ -542,7 +541,7 @@ void ReferenceTypePropagation::RTPVisitor::UpdateReferenceTypeInfo(HInstruction* DCHECK_EQ(instr->GetType(), Primitive::kPrimNot); ScopedObjectAccess soa(Thread::Current()); - mirror::DexCache* dex_cache = FindDexCacheWithHint(soa.Self(), dex_file, hint_dex_cache_); + ObjPtr<mirror::DexCache> dex_cache = FindDexCacheWithHint(soa.Self(), dex_file, hint_dex_cache_); // Get type from dex cache assuming it was populated by the verifier. SetClassAsTypeInfo(instr, dex_cache->GetResolvedType(type_idx), is_exact); } @@ -562,7 +561,7 @@ static mirror::Class* GetClassFromDexCache(Thread* self, dex::TypeIndex type_idx, Handle<mirror::DexCache> hint_dex_cache) REQUIRES_SHARED(Locks::mutator_lock_) { - mirror::DexCache* dex_cache = FindDexCacheWithHint(self, dex_file, hint_dex_cache); + ObjPtr<mirror::DexCache> dex_cache = FindDexCacheWithHint(self, dex_file, hint_dex_cache); // Get type from dex cache assuming it was populated by the verifier. return dex_cache->GetResolvedType(type_idx); } |