!6842 jit enable list

Merge pull request !6842 from zoumujia/jit
This commit is contained in:
openharmony_ci 2024-04-11 11:51:08 +00:00 committed by Gitee
commit 9e46c1099c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
6 changed files with 43 additions and 1 deletions

View File

@ -1308,3 +1308,12 @@ ohos_prebuilt_etc("app_aot_disable_list") {
part_name = "ets_runtime"
subsystem_name = "arkcompiler"
}
ohos_prebuilt_etc("app_jit_enable_list") {
relative_install_dir = "ark"
source = "$js_root/ecmascript/ohos/app_jit_enable_list.conf"
# Set the subsystem name
part_name = "ets_runtime"
subsystem_name = "arkcompiler"
}

View File

@ -46,6 +46,7 @@
"sub_component": [
"//arkcompiler/ets_runtime:app_aot_enable_list",
"//arkcompiler/ets_runtime:app_aot_disable_list",
"//arkcompiler/ets_runtime:app_jit_enable_list",
"//arkcompiler/ets_runtime:ark_js_packages",
"//arkcompiler/ets_runtime/etc:arkcompiler.para.dac"
],

View File

@ -168,7 +168,12 @@ void EcmaVM::PostFork()
bool isEnableJit = options_.IsEnableJIT() && options_.GetEnableAsmInterpreter();
options_.SetEnableAPPJIT(true);
Jit::GetInstance()->SetEnableOrDisable(options_, isEnableJit);
if (ohos::EnableAotListHelper::GetJitInstance()->IsEnableJit(bundleName) && options_.GetEnableAsmInterpreter()) {
Jit::GetInstance()->SetEnableOrDisable(options_, isEnableJit);
if (isEnableJit) {
EnableJit();
}
}
#ifdef ENABLE_POSTFORK_FORCEEXPAND
heap_->NotifyPostFork();
heap_->NotifyFinishColdStartSoon();

View File

@ -0,0 +1,4 @@
# Apps in this configuration file can be compiled by jit compiler, enable list can be written as below:
# {bundleName}:{moduleName}
# {bundleName}
# com.huawei.hmos.calculator

View File

@ -17,4 +17,5 @@
namespace panda::ecmascript::ohos {
const std::string EnableAotListHelper::ENABLE_LIST_NAME = "/etc/ark/app_aot_enable_list.conf";
const std::string EnableAotListHelper::DISABLE_LIST_NAME = "/etc/ark/app_aot_disable_list.conf";
const std::string EnableAotListHelper::JIT_ENABLE_LIST_NAME = "/etc/ark/app_jit_enable_list.conf";
} // namespace panda::ecmascript::ohos

View File

@ -34,6 +34,12 @@ public:
return helper;
}
static std::shared_ptr<EnableAotListHelper> GetJitInstance()
{
static auto helper = std::make_shared<EnableAotListHelper>(JIT_ENABLE_LIST_NAME, "");
return helper;
}
explicit EnableAotListHelper(const std::string &enableListName, const std::string &disableListName)
{
ReadEnableAotList(enableListName);
@ -56,6 +62,11 @@ public:
return IsEnableList(bundleName + ":" + moduleName);
}
bool IsEnableJit(const std::string &candidate)
{
return jitEnableList_.find(candidate) != jitEnableList_.end();
}
bool IsDisableBlackList(const std::string &candidate)
{
return disableList_.find(candidate) != disableList_.end();
@ -79,10 +90,16 @@ public:
disableList_.insert(entry);
}
void AddJitEnableListEntry(const std::string &entry)
{
jitEnableList_.insert(entry);
}
void Clear()
{
disableList_.clear();
enableList_.clear();
jitEnableList_.clear();
}
private:
@ -129,12 +146,17 @@ private:
if (aotListName == DISABLE_LIST_NAME) {
AddDisableListEntry(appName);
}
if (aotListName == JIT_ENABLE_LIST_NAME) {
AddJitEnableListEntry(appName);
}
}
}
std::set<std::string> enableList_ {};
std::set<std::string> disableList_ {};
std::set<std::string> jitEnableList_ {};
static const std::string ENABLE_LIST_NAME;
static const std::string DISABLE_LIST_NAME;
static const std::string JIT_ENABLE_LIST_NAME;
};
} // namespace panda::ecmascript::ohos
#endif // ECMASCRIPT_OHOS_ENABLE_AOT_LIST_HELPER_H