diff options
author | 2023-06-27 13:48:47 +0100 | |
---|---|---|
committer | 2023-06-27 14:33:16 +0000 | |
commit | cc19d4026302b76016d4b9fa769eefda67aa67dd (patch) | |
tree | 186e48832be911aac073f131b3e299edfa7d49d2 /runtime/class_linker.cc | |
parent | 00fc938bb5f62ae99ef3dab495ee6b70d0fb6d40 (diff) |
Disable the shared memory optimization for methods in non-zygote mode.
The optimization is only useful for apps forked from zygote.
Test: test.py
Change-Id: I9e02621bd7f152ec826c6ed0a61d81b193371f7c
Diffstat (limited to 'runtime/class_linker.cc')
-rw-r--r-- | runtime/class_linker.cc | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc index ca822fdeee..687ab09265 100644 --- a/runtime/class_linker.cc +++ b/runtime/class_linker.cc @@ -2204,11 +2204,16 @@ bool ClassLinker::AddImageSpace(gc::space::ImageSpace* space, } if (!runtime->IsAotCompiler()) { - // If we are profiling the boot classpath, disable the shared memory for - // boot image method optimization. We need to disable it before doing - // ResetCounter below, as counters of shared memory method always hold the - // "hot" value. - if (runtime->GetJITOptions()->GetProfileSaverOptions().GetProfileBootClassPath()) { + // If the boot image is not loaded by the zygote, we don't need the shared + // memory optimization. + // If we are profiling the boot classpath, we disable the shared memory + // optimization to make sure boot classpath methods all get properly + // profiled. + // + // We need to disable the flag before doing ResetCounter below, as counters + // of shared memory method always hold the "hot" value. + if (!runtime->IsZygote() || + runtime->GetJITOptions()->GetProfileSaverOptions().GetProfileBootClassPath()) { header.VisitPackedArtMethods([&](ArtMethod& method) REQUIRES_SHARED(Locks::mutator_lock_) { method.ClearMemorySharedMethod(); }, space->Begin(), image_pointer_size_); |