diff --git a/static_core/compiler/aot/aot_manager.cpp b/static_core/compiler/aot/aot_manager.cpp index 27632ab72fca19c60e4400ab9951a1a521fc6d01..85acf98154f419df699465629e72d78b3b09fa20 100644 --- a/static_core/compiler/aot/aot_manager.cpp +++ b/static_core/compiler/aot/aot_manager.cpp @@ -85,6 +85,7 @@ void AotManager::UpdatePandaFilesSnapshot(const panda_file::File *pf, ClassLinke if (isArkAot) { pandaFilesSnapshot_.emplace_back(pf->GetFullFileName(), std::make_pair(pf, ctx)); } else { + os::memory::LockHolder lock {snapshotFilesLock_}; pandaFilesLoaded_.try_emplace(pf->GetFullFileName(), std::make_pair(pf, ctx)); UpdatePandaFilesSnapshot(isArkAot, true, true); } diff --git a/static_core/compiler/aot/aot_manager.h b/static_core/compiler/aot/aot_manager.h index 53a828aebf45f03ca54677881827fe6173ef7b24..4ae92dfc4f0b4e943fe6542aad043f2670782160 100644 --- a/static_core/compiler/aot/aot_manager.h +++ b/static_core/compiler/aot/aot_manager.h @@ -211,8 +211,9 @@ private: bool hasYoungAotStringRefs_ {false}; PandaVector aotStringYoungSet_; - PandaVector> pandaFilesSnapshot_; - PandaUnorderedMap pandaFilesLoaded_; + mutable os::memory::Mutex snapshotFilesLock_; + PandaVector> pandaFilesSnapshot_ GUARDED_BY(snapshotFilesLock_); + PandaUnorderedMap pandaFilesLoaded_ GUARDED_BY(snapshotFilesLock_); void UpdatePandaFilesSnapshot(bool isArkAot, bool bootContext, bool appContext); }; diff --git a/static_core/compiler/compiler.yaml b/static_core/compiler/compiler.yaml index 9a710f634180e20bf5e25388fef1ea1e61e103e7..4b07b00d5ad2df9311061c8a9e6375fcdffbe830 100644 --- a/static_core/compiler/compiler.yaml +++ b/static_core/compiler/compiler.yaml @@ -465,7 +465,7 @@ options: - name: compiler-inline-external-methods-aot type: bool - default: false + default: true description: Enable inlining external methods in AOT mode tags: [perf] diff --git a/static_core/runtime/class_linker.cpp b/static_core/runtime/class_linker.cpp index 8fcbfe49bbf94bd540fcd3edf6c1e1a60b4e596b..729e77a6498df1d0f0237a2e079d516ab78dbe41 100644 --- a/static_core/runtime/class_linker.cpp +++ b/static_core/runtime/class_linker.cpp @@ -58,9 +58,11 @@ void ClassLinker::AddPandaFile(std::unique_ptr &&pf, Cla os::memory::LockHolder lock {pandaFilesLock_}; pandaFiles_.push_back({context, std::forward>(pf)}); // NOTE(@srokashevich, #29734): after fix move the line below out of the lock block - GetAotManager()->UpdatePandaFilesSnapshot(file, context, Runtime::GetOptions().IsArkAot()); + // GetAotManager()->UpdatePandaFilesSnapshot(file, context, Runtime::GetOptions().IsArkAot()); } + GetAotManager()->UpdatePandaFilesSnapshot(file, context, Runtime::GetOptions().IsArkAot()); + if (context == nullptr || context->IsBootContext()) { os::memory::LockHolder lock {bootPandaFilesLock_}; bootPandaFiles_.push_back(file);