diff options
author | 2022-11-30 12:20:40 +0000 | |
---|---|---|
committer | 2022-11-30 12:24:02 +0000 | |
commit | 0110e952e488bc41429f6f33f36e8884f41a26d8 (patch) | |
tree | 69b19ac65cf5ee7a5f4acefa53abf7f5ef191846 /runtime/jit/jit_code_cache.cc | |
parent | 7a570e0216b3b03cd8a83153ff739833d86a4430 (diff) |
Revert "Reland "ART: Rewrite compiled code check in FaultHandler.""
This reverts commit 64fdbedd880bda36215e6e680d23bc2c361d2bfb.
Reason for revert: Buildbot breakages: `Check failed: !bad_mutexes_held`.
Bug: 38383823
Change-Id: I33d41c764c130cef05171de1eed82b778740704f
Diffstat (limited to 'runtime/jit/jit_code_cache.cc')
-rw-r--r-- | runtime/jit/jit_code_cache.cc | 34 |
1 files changed, 7 insertions, 27 deletions
diff --git a/runtime/jit/jit_code_cache.cc b/runtime/jit/jit_code_cache.cc index f4b26284e1..ee5d5c7ce3 100644 --- a/runtime/jit/jit_code_cache.cc +++ b/runtime/jit/jit_code_cache.cc @@ -220,10 +220,9 @@ JitCodeCache* JitCodeCache::Create(bool used_only_for_profile_data, } } - Runtime* runtime = Runtime::Current(); - size_t initial_capacity = runtime->GetJITOptions()->GetCodeCacheInitialCapacity(); + size_t initial_capacity = Runtime::Current()->GetJITOptions()->GetCodeCacheInitialCapacity(); // Check whether the provided max capacity in options is below 1GB. - size_t max_capacity = runtime->GetJITOptions()->GetCodeCacheMaxCapacity(); + size_t max_capacity = Runtime::Current()->GetJITOptions()->GetCodeCacheMaxCapacity(); // We need to have 32 bit offsets from method headers in code cache which point to things // in the data cache. If the maps are more than 4G apart, having multiple maps wouldn't work. // Ensure we're below 1 GB to be safe. @@ -245,11 +244,6 @@ JitCodeCache* JitCodeCache::Create(bool used_only_for_profile_data, return nullptr; } - if (region.HasCodeMapping()) { - const MemMap* exec_pages = region.GetExecPages(); - runtime->AddGeneratedCodeRange(exec_pages->Begin(), exec_pages->Size()); - } - std::unique_ptr<JitCodeCache> jit_code_cache(new JitCodeCache()); if (is_zygote) { // Zygote should never collect code to share the memory with the children. @@ -284,16 +278,7 @@ JitCodeCache::JitCodeCache() histogram_profiling_info_memory_use_("Memory used for profiling info", 16) { } -JitCodeCache::~JitCodeCache() { - if (private_region_.HasCodeMapping()) { - const MemMap* exec_pages = private_region_.GetExecPages(); - Runtime::Current()->RemoveGeneratedCodeRange(exec_pages->Begin(), exec_pages->Size()); - } - if (shared_region_.HasCodeMapping()) { - const MemMap* exec_pages = shared_region_.GetExecPages(); - Runtime::Current()->RemoveGeneratedCodeRange(exec_pages->Begin(), exec_pages->Size()); - } -} +JitCodeCache::~JitCodeCache() {} bool JitCodeCache::PrivateRegionContainsPc(const void* ptr) const { return private_region_.IsInExecSpace(ptr); @@ -1859,8 +1844,7 @@ void JitCodeCache::PostForkChildAction(bool is_system_server, bool is_zygote) { // We do this now and not in Jit::PostForkChildAction, as system server calls // JitCodeCache::PostForkChildAction first, and then does some code loading // that may result in new JIT tasks that we want to keep. - Runtime* runtime = Runtime::Current(); - ThreadPool* pool = runtime->GetJit()->GetThreadPool(); + ThreadPool* pool = Runtime::Current()->GetJit()->GetThreadPool(); if (pool != nullptr) { pool->RemoveAllTasks(self); } @@ -1871,7 +1855,7 @@ void JitCodeCache::PostForkChildAction(bool is_system_server, bool is_zygote) { // to write to them. shared_region_.ResetWritableMappings(); - if (is_zygote || runtime->IsSafeMode()) { + if (is_zygote || Runtime::Current()->IsSafeMode()) { // Don't create a private region for a child zygote. Regions are usually map shared // (to satisfy dual-view), and we don't want children of a child zygote to inherit it. return; @@ -1886,8 +1870,8 @@ void JitCodeCache::PostForkChildAction(bool is_system_server, bool is_zygote) { histogram_code_memory_use_.Reset(); histogram_profiling_info_memory_use_.Reset(); - size_t initial_capacity = runtime->GetJITOptions()->GetCodeCacheInitialCapacity(); - size_t max_capacity = runtime->GetJITOptions()->GetCodeCacheMaxCapacity(); + size_t initial_capacity = Runtime::Current()->GetJITOptions()->GetCodeCacheInitialCapacity(); + size_t max_capacity = Runtime::Current()->GetJITOptions()->GetCodeCacheMaxCapacity(); std::string error_msg; if (!private_region_.Initialize(initial_capacity, max_capacity, @@ -1896,10 +1880,6 @@ void JitCodeCache::PostForkChildAction(bool is_system_server, bool is_zygote) { &error_msg)) { LOG(WARNING) << "Could not create private region after zygote fork: " << error_msg; } - if (private_region_.HasCodeMapping()) { - const MemMap* exec_pages = private_region_.GetExecPages(); - runtime->AddGeneratedCodeRange(exec_pages->Begin(), exec_pages->Size()); - } } JitMemoryRegion* JitCodeCache::GetCurrentRegion() { |