From cd556b003adbb53739d4b3f43135e6a0ae69509a Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Fri, 3 Feb 2017 11:47:34 +0000 Subject: 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 --- runtime/class_table.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'runtime/class_table.h') diff --git a/runtime/class_table.h b/runtime/class_table.h index c8ec28eca4..711eae45b8 100644 --- a/runtime/class_table.h +++ b/runtime/class_table.h @@ -192,6 +192,12 @@ class ClassTable { REQUIRES(!lock_) REQUIRES_SHARED(Locks::mutator_lock_); + // Try to insert a class and return the inserted class if successful. If another class + // with the same descriptor is already in the table, return the existing entry. + ObjPtr TryInsert(ObjPtr klass) + REQUIRES(!lock_) + REQUIRES_SHARED(Locks::mutator_lock_); + void Insert(ObjPtr klass) REQUIRES(!lock_) REQUIRES_SHARED(Locks::mutator_lock_); -- cgit v1.2.3-59-g8ed1b