summaryrefslogtreecommitdiff
path: root/runtime/class_table.h
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2017-02-03 11:47:34 +0000
committer Vladimir Marko <vmarko@google.com> 2017-02-09 10:10:29 +0000
commitcd556b003adbb53739d4b3f43135e6a0ae69509a (patch)
treea30c9f03071d87e1f75a0d0b8c2961d113ea767d /runtime/class_table.h
parent357dcb73934356239292c46d6fbedba734da5e00 (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 'runtime/class_table.h')
-rw-r--r--runtime/class_table.h6
1 files changed, 6 insertions, 0 deletions
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<mirror::Class> TryInsert(ObjPtr<mirror::Class> klass)
+ REQUIRES(!lock_)
+ REQUIRES_SHARED(Locks::mutator_lock_);
+
void Insert(ObjPtr<mirror::Class> klass)
REQUIRES(!lock_)
REQUIRES_SHARED(Locks::mutator_lock_);