summaryrefslogtreecommitdiff
path: root/runtime/mirror/dex_cache-inl.h
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2022-10-26 08:00:23 +0000
committer Treehugger Robot <treehugger-gerrit@google.com> 2022-10-26 10:08:43 +0000
commitcc97f11fe689c1344bb04ab85e8bdc7baaeb3fb1 (patch)
tree7d6449469c1966232ab922f5a2772b9b8dcfeac1 /runtime/mirror/dex_cache-inl.h
parent39083d582c75c8e88923353fdce9ac1b373d9480 (diff)
Revert "Allocate dex cache arrays at startup."
This reverts commit a25aeadee55630760b521176d0813d12eebae8c8. Bug: 255465158 Reason for revert:b/255465158 Change-Id: Ic9c89532bfec75d2706b8dbcc599fad5c4c71735
Diffstat (limited to 'runtime/mirror/dex_cache-inl.h')
-rw-r--r--runtime/mirror/dex_cache-inl.h12
1 files changed, 3 insertions, 9 deletions
diff --git a/runtime/mirror/dex_cache-inl.h b/runtime/mirror/dex_cache-inl.h
index 5a44fff665..0b6bb1433b 100644
--- a/runtime/mirror/dex_cache-inl.h
+++ b/runtime/mirror/dex_cache-inl.h
@@ -54,7 +54,7 @@ static void InitializeArray(T*) {
}
template<typename T>
-T* DexCache::AllocArray(MemberOffset obj_offset, size_t num, LinearAllocKind kind, bool startup) {
+T* DexCache::AllocArray(MemberOffset obj_offset, size_t num, LinearAllocKind kind) {
Thread* self = Thread::Current();
mirror::DexCache* dex_cache = this;
if (gUseReadBarrier && self->GetIsGcMarking()) {
@@ -63,14 +63,8 @@ T* DexCache::AllocArray(MemberOffset obj_offset, size_t num, LinearAllocKind kin
dex_cache = reinterpret_cast<DexCache*>(ReadBarrier::Mark(this));
}
// DON'T USE 'this' from now on.
- Runtime* runtime = Runtime::Current();
- // Note: in the 1002-notify-startup test, the startup linear alloc can become null
- // concurrently, even if the runtime is marked at startup. Therefore we should only
- // fetch it once here.
- LinearAlloc* startup_linear_alloc = runtime->GetStartupLinearAlloc();
- LinearAlloc* alloc = (startup && startup_linear_alloc != nullptr)
- ? startup_linear_alloc
- : runtime->GetClassLinker()->GetOrCreateAllocatorForClassLoader(GetClassLoader());
+ ClassLinker* linker = Runtime::Current()->GetClassLinker();
+ LinearAlloc* alloc = linker->GetOrCreateAllocatorForClassLoader(GetClassLoader());
MutexLock mu(self, *Locks::dex_cache_lock_); // Avoid allocation by multiple threads.
T* array = dex_cache->GetFieldPtr64<T*>(obj_offset);
if (array != nullptr) {