summaryrefslogtreecommitdiffstats
path: root/runtime/class_linker.cc
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2015-04-24 20:22:06 -0700
committerAndreas Gampe <agampe@google.com>2015-04-24 20:22:06 -0700
commit94329d31d2a99c9aff889b88ba4b675135409b82 (patch)
tree661df73fd35c4281438667abd488fb282175a8b1 /runtime/class_linker.cc
parent6e655afb37a528cfd90aa702b1600e1eb5d10a58 (diff)
downloadart-94329d31d2a99c9aff889b88ba4b675135409b82.zip
art-94329d31d2a99c9aff889b88ba4b675135409b82.tar.gz
art-94329d31d2a99c9aff889b88ba4b675135409b82.tar.bz2
ART: Duplicate-classes cleanup
Disable old test. Improve collision warning message. Add a comment about the algorithm. Change-Id: Ibd29d79565732162150aebd7fe08d0895ccf3d79
Diffstat (limited to 'runtime/class_linker.cc')
-rw-r--r--runtime/class_linker.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 07790b8..8a0c315 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -817,6 +817,13 @@ static void FreeDexFilesInHeap(std::priority_queue<DexFileAndClassPair>* heap) {
}
}
+// Check for class-def collisions in dex files.
+//
+// This works by maintaining a heap with one class from each dex file, sorted by the class
+// descriptor. Then a dex-file/class pair is continually removed from the heap and compared
+// against the following top element. If the descriptor is the same, it is now checked whether
+// the two elements agree on whether their dex file was from an already-loaded oat-file or the
+// new oat file. Any disagreement indicates a collision.
bool ClassLinker::HasCollisions(const OatFile* oat_file, std::string* error_msg) {
if (!kCheckForDexCollisions) {
return false;
@@ -940,7 +947,13 @@ std::vector<std::unique_ptr<const DexFile>> ClassLinker::OpenDexFilesFromOat(
source_oat_file = oat_file.release();
RegisterOatFile(source_oat_file);
} else {
- LOG(WARNING) << "Found duplicate classes, falling back to interpreter mode (if enabled):";
+ if (Runtime::Current()->IsDexFileFallbackEnabled()) {
+ LOG(WARNING) << "Found duplicate classes, falling back to interpreter mode for "
+ << dex_location;
+ } else {
+ LOG(WARNING) << "Found duplicate classes, dex-file-fallback disabled, will be failing to "
+ " load classes for " << dex_location;
+ }
LOG(WARNING) << error_msg;
}
}