summaryrefslogtreecommitdiff
path: root/runtime/class_linker.cc
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2019-06-13 12:18:37 +0100
committer Vladimir Marko <vmarko@google.com> 2019-06-27 08:25:24 +0000
commit31c3daa15da0599b0f916202c49ef4d35e77213b (patch)
tree3966159700b54af8a39a8b426ab06c8c4b6960f1 /runtime/class_linker.cc
parentb476a29a2cda22b86fc1d96e4cc65ce36fb878af (diff)
GC-independent image layout.
Make sure we visit objects in a defined order, independent of their order in the heap. The new order depends only on dex file contents and contents of initialized classes, thus any non-determinism would have to be contributed by the class initialization itself rather than GC. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Test: aosp_taimen-userdebug boots. Test: run-gtests.sh Test: testrunner.py --target --optimizing Bug: 26687569 Change-Id: I62521322289a22eb13faae526ba2c3589e6ab381
Diffstat (limited to 'runtime/class_linker.cc')
-rw-r--r--runtime/class_linker.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 0c8d53927e..2d19bfc207 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -2538,7 +2538,9 @@ ObjPtr<mirror::DexCache> ClassLinker::AllocDexCache(/*out*/ ObjPtr<mirror::Strin
self->AssertPendingOOMException();
return nullptr;
}
- ObjPtr<mirror::String> location = intern_table_->InternStrong(dex_file.GetLocation().c_str());
+ // Use InternWeak() so that the location String can be collected when the ClassLoader
+ // with this DexCache is collected.
+ ObjPtr<mirror::String> location = intern_table_->InternWeak(dex_file.GetLocation().c_str());
if (location == nullptr) {
self->AssertPendingOOMException();
return nullptr;