diff options
author | 2017-02-03 11:47:34 +0000 | |
---|---|---|
committer | 2017-02-09 10:10:29 +0000 | |
commit | cd556b003adbb53739d4b3f43135e6a0ae69509a (patch) | |
tree | a30c9f03071d87e1f75a0d0b8c2961d113ea767d /compiler/oat_writer.cc | |
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/oat_writer.cc')
-rw-r--r-- | compiler/oat_writer.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/oat_writer.cc b/compiler/oat_writer.cc index bd2c5e3bfc..73c40ab6a3 100644 --- a/compiler/oat_writer.cc +++ b/compiler/oat_writer.cc @@ -1250,7 +1250,7 @@ class OatWriter::WriteCodeMethodVisitor : public OatDexMethodVisitor { const ScopedObjectAccess soa_; const ScopedAssertNoThreadSuspension no_thread_suspension_; ClassLinker* const class_linker_; - mirror::DexCache* dex_cache_; + ObjPtr<mirror::DexCache> dex_cache_; std::vector<uint8_t> patched_code_; void ReportWriteFailure(const char* what, const ClassDataItemIterator& it) { @@ -1261,7 +1261,7 @@ class OatWriter::WriteCodeMethodVisitor : public OatDexMethodVisitor { ArtMethod* GetTargetMethod(const LinkerPatch& patch) REQUIRES_SHARED(Locks::mutator_lock_) { MethodReference ref = patch.TargetMethod(); - mirror::DexCache* dex_cache = + ObjPtr<mirror::DexCache> dex_cache = (dex_file_ == ref.dex_file) ? dex_cache_ : class_linker_->FindDexCache( Thread::Current(), *ref.dex_file); ArtMethod* method = dex_cache->GetResolvedMethod( @@ -1295,7 +1295,7 @@ class OatWriter::WriteCodeMethodVisitor : public OatDexMethodVisitor { return target_offset; } - mirror::DexCache* GetDexCache(const DexFile* target_dex_file) + ObjPtr<mirror::DexCache> GetDexCache(const DexFile* target_dex_file) REQUIRES_SHARED(Locks::mutator_lock_) { return (target_dex_file == dex_file_) ? dex_cache_ @@ -1303,7 +1303,7 @@ class OatWriter::WriteCodeMethodVisitor : public OatDexMethodVisitor { } mirror::Class* GetTargetType(const LinkerPatch& patch) REQUIRES_SHARED(Locks::mutator_lock_) { - mirror::DexCache* dex_cache = GetDexCache(patch.TargetTypeDexFile()); + ObjPtr<mirror::DexCache> dex_cache = GetDexCache(patch.TargetTypeDexFile()); mirror::Class* type = dex_cache->GetResolvedType(patch.TargetTypeIndex()); CHECK(type != nullptr); return type; |