diff --git a/compiler_service/include/aot_args_handler.h b/compiler_service/include/aot_args_handler.h index c33bbdb9ecb0596f0ab07a0f75d1276f60b681f3..50b9a40ca0f488a4bc86d92f264f7733da97bc2e 100644 --- a/compiler_service/include/aot_args_handler.h +++ b/compiler_service/include/aot_args_handler.h @@ -68,6 +68,9 @@ public: static int32_t FindArgsIdxToString(const std::unordered_map &argsMap, const std::string &keyName, std::string &bundleArg); +#ifdef ENABLE_COMPILER_SERVICE_GET_PARAMETER + static bool IsEnableStaticCompiler(); +#endif }; class AOTArgsParser final : public AOTArgsParserBase { diff --git a/compiler_service/src/aot_args_handler.cpp b/compiler_service/src/aot_args_handler.cpp index 88ec60d99d837afe3f8e40530c34945b4f20bf92..079dea9bb8fc15a36a60c3592fadf6bd0cf84475 100644 --- a/compiler_service/src/aot_args_handler.cpp +++ b/compiler_service/src/aot_args_handler.cpp @@ -53,6 +53,11 @@ const std::string APP_SANBOX_PATH_PREFIX = "/data/storage/el1/bundle/"; const std::string ETS_PATH = "/ets"; const std::string OWNERID_SHARED_TAG = "SHARED_LIB_ID"; +#ifdef ENABLE_COMPILER_SERVICE_GET_PARAMETER +// Default closed, open on qiangji +const bool ARK_AOT_ENABLE_STATIC_COMPILER_DEFAULT_VALUE = true; +#endif + AOTArgsHandler::AOTArgsHandler(const std::unordered_map &argsMap) : argsMap_(argsMap) { parser_ = *AOTArgsParserFactory::GetParser(argsMap); @@ -172,6 +177,16 @@ int32_t AOTArgsParser::Parse(const std::unordered_map return ERR_OK; } +#ifdef ENABLE_COMPILER_SERVICE_GET_PARAMETER +bool AOTArgsParserBase::IsEnableStaticCompiler() +{ + bool enable = OHOS::system::GetBoolParameter("ark.aot.enable_static_compiler", + ARK_AOT_ENABLE_STATIC_COMPILER_DEFAULT_VALUE); + LOG_SA(INFO) << "enable static compiler switch is : " << enable; + return enable; +} +#endif + void AOTArgsParser::AddExpandArgs(std::vector &argVector, int32_t thermalLevel) { std::string thermalLevelArg = "--compiler-thermal-level=" + std::to_string(thermalLevel); @@ -325,6 +340,11 @@ bool StaticAOTArgsParser::ParseProfileUse(HapArgs &hapArgs, std::string &pkgInfo std::optional> AOTArgsParserFactory::GetParser( const std::unordered_map &argsMap) { +#ifdef ENABLE_COMPILER_SERVICE_GET_PARAMETER + if (!AOTArgsParserBase::IsEnableStaticCompiler()) { + return std::make_unique(); + } +#endif int32_t isSystemComponent = 0; if ((AOTArgsParserBase::FindArgsIdxToInteger(argsMap, ArgsIdx::IS_SYSTEM_COMPONENT, isSystemComponent) != ERR_OK)) { LOG_SA(INFO) << "aot sa failed to get isSystemComponent";