mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-11-23 10:09:54 +00:00
Skipped try-catch aot compile
1. Modify aot compiler preprocess 2. Add an option to pass unittest Issue: https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/IAAV7U?from=project-issue Signed-off-by: xing-yunhao <xingyunhao1@huawei.com> Change-Id: Idd2eba6583bf3a15e7a364e4f5a59c85cbfc5476
This commit is contained in:
parent
4343720042
commit
fb515ebe0a
@ -50,6 +50,7 @@ CompilationOptions::CompilationOptions(JSRuntimeOptions &runtimeOptions)
|
||||
isEnableLaterElimination_ = runtimeOptions.IsEnableLaterElimination();
|
||||
isEnableValueNumbering_ = runtimeOptions.IsEnableValueNumbering();
|
||||
isEnableOptInlining_ = runtimeOptions.IsEnableOptInlining();
|
||||
isEnableTryCatchFunction_ = runtimeOptions.IsEnableTryCatchFunction();
|
||||
isEnableOptString_ = runtimeOptions.IsEnableOptString();
|
||||
isEnableOptPGOType_ = runtimeOptions.IsEnableOptPGOType();
|
||||
isEnableOptTrackField_ = runtimeOptions.IsEnableOptTrackField();
|
||||
@ -334,6 +335,15 @@ bool AotCompilerPreprocessor::FilterOption(const std::map<std::string, std::vect
|
||||
return find(vec.begin(), vec.end(), methodName) != vec.end();
|
||||
}
|
||||
|
||||
bool AotCompilerPreprocessor::MethodHasTryCatch(const JSPandaFile *jsPandaFile,
|
||||
const MethodLiteral *methodLiteral) const
|
||||
{
|
||||
auto pf = jsPandaFile->GetPandaFile();
|
||||
panda_file::MethodDataAccessor mda(*pf, methodLiteral->GetMethodId());
|
||||
panda_file::CodeDataAccessor cda(*pf, mda.GetCodeId().value());
|
||||
return cda.GetTriesSize() != 0;
|
||||
}
|
||||
|
||||
bool AotCompilerPreprocessor::IsSkipMethod(const JSPandaFile *jsPandaFile, const BCInfo &bytecodeInfo,
|
||||
const CString &recordName, const MethodLiteral *methodLiteral,
|
||||
const MethodPcInfo &methodPCInfo, const std::string &methodName,
|
||||
@ -348,6 +358,10 @@ bool AotCompilerPreprocessor::IsSkipMethod(const JSPandaFile *jsPandaFile, const
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!cOptions.isEnableTryCatchFunction_ && MethodHasTryCatch(jsPandaFile, methodLiteral)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!cOptions.optionSelectMethods_.empty()) {
|
||||
return !FilterOption(cOptions.optionSelectMethods_, ConvertToStdString(recordName), methodName);
|
||||
} else if (!cOptions.optionSkipMethods_.empty()) {
|
||||
|
@ -74,6 +74,7 @@ struct CompilationOptions {
|
||||
bool isEnableLaterElimination_ {true};
|
||||
bool isEnableValueNumbering_ {true};
|
||||
bool isEnableOptInlining_ {true};
|
||||
bool isEnableTryCatchFunction_ {false};
|
||||
bool isEnableOptString_ {true};
|
||||
bool isEnableOptPGOType_ {true};
|
||||
bool isEnableOptTrackField_ {true};
|
||||
@ -128,6 +129,8 @@ public:
|
||||
bool FilterOption(const std::map<std::string, std::vector<std::string>> &optionMap,
|
||||
const std::string &recordName, const std::string &methodName) const;
|
||||
|
||||
bool MethodHasTryCatch(const JSPandaFile *jsPandaFile, const MethodLiteral *methodLiteral) const;
|
||||
|
||||
bool IsSkipMethod(const JSPandaFile *jsPandaFile, const BCInfo &bytecodeInfo,
|
||||
const CString &recordName, const MethodLiteral *methodLiteral,
|
||||
const MethodPcInfo &methodPCInfo, const std::string &methodName,
|
||||
|
@ -89,6 +89,7 @@ const std::string PUBLIC_API HELP_OPTION_MSG =
|
||||
"--compiler-opt-string: Enable string optimization pass for aot compiler. Default: 'true'\n"
|
||||
"--compiler-opt-value-numbering: Enable ValueNumbering for aot compiler. Default: 'true'\n"
|
||||
"--compiler-opt-inlining: Enable inlining function for aot compiler: Default: 'true'\n"
|
||||
"--compiler-try-catch-function: Enable function with try-catch for aot compiler: Default: 'false'\n"
|
||||
"--compiler-opt-pgotype: Enable pgo type for aot compiler: Default: 'true'\n"
|
||||
"--compiler-opt-track-field: Enable track field for aot compiler: Default: 'false'\n"
|
||||
"--entry-point: Full name of entrypoint function. Default: '_GLOBAL::func_main_0'\n"
|
||||
@ -229,6 +230,7 @@ bool JSRuntimeOptions::ParseCommand(const int argc, const char **argv)
|
||||
{"compiler-opt-value-numbering", required_argument, nullptr, OPTION_COMPILER_OPT_VALUE_NUMBERING},
|
||||
{"compiler-opt-new-value-numbering", required_argument, nullptr, OPTION_COMPILER_OPT_NEW_VALUE_NUMBERING},
|
||||
{"compiler-opt-inlining", required_argument, nullptr, OPTION_COMPILER_OPT_INLINING},
|
||||
{"compiler-try-catch-function", required_argument, nullptr, OPTION_COMPILER_TRY_CATCH_FUNCTION},
|
||||
{"compiler-opt-pgotype", required_argument, nullptr, OPTION_COMPILER_OPT_PGOTYPE},
|
||||
{"compiler-opt-track-field", required_argument, nullptr, OPTION_COMPILER_OPT_TRACK_FIELD},
|
||||
{"entry-point", required_argument, nullptr, OPTION_ENTRY_POINT},
|
||||
@ -836,6 +838,14 @@ bool JSRuntimeOptions::ParseCommand(const int argc, const char **argv)
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case OPTION_COMPILER_TRY_CATCH_FUNCTION:
|
||||
ret = ParseBoolParam(&argBool);
|
||||
if (ret) {
|
||||
SetEnableTryCatchFunction(argBool);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case OPTION_COMPILER_OPT_PGOTYPE:
|
||||
ret = ParseBoolParam(&argBool);
|
||||
if (ret) {
|
||||
|
@ -128,6 +128,7 @@ enum CommandValues {
|
||||
OPTION_COMPILER_OPT_STRING,
|
||||
OPTION_COMPILER_OPT_VALUE_NUMBERING,
|
||||
OPTION_COMPILER_OPT_INLINING,
|
||||
OPTION_COMPILER_TRY_CATCH_FUNCTION,
|
||||
OPTION_COMPILER_OPT_PGOTYPE,
|
||||
OPTION_COMPILER_OPT_TRACK_FIELD,
|
||||
OPTION_COMPILER_PGO_PROFILER_PATH,
|
||||
@ -197,7 +198,7 @@ enum CommandValues {
|
||||
OPTION_COMPILER_ENABLE_JIT_FAST_COMPILE,
|
||||
OPTION_COMPILER_BASELINE_PGO,
|
||||
};
|
||||
static_assert(OPTION_SPLIT_ONE == 64);
|
||||
static_assert(OPTION_SPLIT_ONE == 65);
|
||||
|
||||
class PUBLIC_API JSRuntimeOptions {
|
||||
public:
|
||||
@ -1290,6 +1291,16 @@ public:
|
||||
return enableOptInlining_;
|
||||
}
|
||||
|
||||
void SetEnableTryCatchFunction(bool value)
|
||||
{
|
||||
enableTryCatchFunction_ = value;
|
||||
}
|
||||
|
||||
bool IsEnableTryCatchFunction() const
|
||||
{
|
||||
return enableTryCatchFunction_;
|
||||
}
|
||||
|
||||
void SetEnableOptPGOType(bool value)
|
||||
{
|
||||
enableOptPGOType_ = value;
|
||||
@ -1902,6 +1913,7 @@ private:
|
||||
bool enableInstrcutionCombine {true};
|
||||
bool enableNewValueNumbering_ {true};
|
||||
bool enableOptInlining_ {true};
|
||||
bool enableTryCatchFunction_ {false};
|
||||
bool enableOptPGOType_ {true};
|
||||
bool enableFastJIT_{false};
|
||||
bool enableAPPJIT_{false};
|
||||
|
@ -1196,7 +1196,7 @@ template("host_aot_js_test_action") {
|
||||
script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
|
||||
|
||||
_aot_compile_options_ = " --aot-file=" + rebase_path(_test_aot_arg_) +
|
||||
" --log-level=" + _test_aot_log_level + " --log-components=compiler --compiler-opt-type-lowering=false --compiler-opt-inlining=false" + " --compiler-opt-loop-peeling=false"
|
||||
" --log-level=" + _test_aot_log_level + " --log-components=compiler --compiler-opt-type-lowering=false --compiler-opt-inlining=false" + " --compiler-opt-loop-peeling=false" + " --compiler-try-catch-function=true"
|
||||
|
||||
if (defined(invoker.is_enable_pgo) && invoker.is_enable_pgo) {
|
||||
_aot_compile_options_ += " --compiler-pgo-profiler-path=" +
|
||||
@ -1463,7 +1463,8 @@ template("host_aot_js_test_action") {
|
||||
" --compiler-opt-type-lowering=false" +
|
||||
" --compiler-opt-inlining=false" +
|
||||
" --compiler-opt-loop-peeling=false" +
|
||||
" --compiler-enable-litecg=true"
|
||||
" --compiler-enable-litecg=true" +
|
||||
" --compiler-try-catch-function=true"
|
||||
|
||||
if (defined(invoker.is_enable_pgo) && invoker.is_enable_pgo) {
|
||||
_aot_compile_options_ += " --compiler-pgo-profiler-path=" +
|
||||
@ -1713,7 +1714,8 @@ template("host_aot_js_test_action") {
|
||||
" --compiler-opt-inlining=false" +
|
||||
" --compiler-opt-loop-peeling=false" +
|
||||
" --compiler-enable-litecg=true" +
|
||||
" --compiler-target-triple=aarch64-unknown-linux-gnu"
|
||||
" --compiler-target-triple=aarch64-unknown-linux-gnu" +
|
||||
" --compiler-try-catch-function=true"
|
||||
|
||||
if (defined(invoker.is_enable_pgo) && invoker.is_enable_pgo) {
|
||||
_aot_compile_options_ += " --compiler-pgo-profiler-path=" +
|
||||
@ -2062,7 +2064,7 @@ template("host_aot_js_assert_test_action") {
|
||||
script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
|
||||
|
||||
_aot_compile_options_ = " --aot-file=" + rebase_path(_test_aot_arg_) +
|
||||
" --log-level=" + _test_aot_log_level + " --log-components=compiler --compiler-opt-type-lowering=false --compiler-opt-inlining=false" + " --compiler-opt-loop-peeling=false"
|
||||
" --log-level=" + _test_aot_log_level + " --log-components=compiler --compiler-opt-type-lowering=false --compiler-opt-inlining=false" + " --compiler-opt-loop-peeling=false" + " --compiler-try-catch-function=true"
|
||||
|
||||
if (defined(invoker.is_enable_pgo) && invoker.is_enable_pgo) {
|
||||
_aot_compile_options_ += " --compiler-pgo-profiler-path=" +
|
||||
@ -2482,7 +2484,9 @@ template("host_aot_test_action") {
|
||||
_aot_compile_options_ =
|
||||
" --aot-file=" + rebase_path(_test_aot_arg_) + " --log-level=" +
|
||||
_test_aot_log_level + " --log-components=compiler" +
|
||||
" --compiler-opt-inlining=false" + " --compiler-opt-loop-peeling=false"
|
||||
" --compiler-opt-inlining=false" +
|
||||
" --compiler-opt-loop-peeling=false" +
|
||||
" --compiler-try-catch-function=true"
|
||||
|
||||
if (defined(invoker.is_enable_pgo) && invoker.is_enable_pgo) {
|
||||
_aot_compile_options_ +=
|
||||
@ -2573,7 +2577,9 @@ template("host_aot_test_action") {
|
||||
" --aot-file=" + rebase_path(_test_aot_arg_slowpath_) +
|
||||
" --log-level=" + _test_aot_log_level + " --log-components=compiler" +
|
||||
" --compiler-opt-type-lowering=false" +
|
||||
" --compiler-opt-inlining=false" + " --compiler-opt-loop-peeling=false"
|
||||
" --compiler-opt-inlining=false" +
|
||||
" --compiler-opt-loop-peeling=false" +
|
||||
" --compiler-try-catch-function=true"
|
||||
if (defined(invoker.is_enable_trace_deopt) &&
|
||||
invoker.is_enable_trace_deopt) {
|
||||
_aot_compile_options_ += " --compiler-trace-deopt=true"
|
||||
@ -2884,7 +2890,8 @@ template("host_aot_test_action") {
|
||||
" --log-level=" + _test_aot_log_level + " --log-components=compiler" +
|
||||
" --compiler-opt-inlining=false" +
|
||||
" --compiler-opt-loop-peeling=false" +
|
||||
" --compiler-enable-litecg=true"
|
||||
" --compiler-enable-litecg=true" +
|
||||
" --compiler-try-catch-function=true"
|
||||
|
||||
if (defined(invoker.is_enable_pgo) && invoker.is_enable_pgo) {
|
||||
_aot_compile_options_ +=
|
||||
@ -2979,7 +2986,8 @@ template("host_aot_test_action") {
|
||||
" --compiler-opt-type-lowering=false" +
|
||||
" --compiler-opt-inlining=false" +
|
||||
" --compiler-opt-loop-peeling=false" +
|
||||
" --compiler-enable-litecg=true"
|
||||
" --compiler-enable-litecg=true" +
|
||||
" --compiler-try-catch-function=true"
|
||||
if (defined(invoker.is_enable_trace_deopt) &&
|
||||
invoker.is_enable_trace_deopt) {
|
||||
_aot_compile_options_ += " --compiler-trace-deopt=true"
|
||||
@ -3280,7 +3288,8 @@ template("host_aot_test_action") {
|
||||
" --compiler-opt-inlining=false" +
|
||||
" --compiler-opt-loop-peeling=false" +
|
||||
" --compiler-enable-litecg=true" +
|
||||
" --compiler-target-triple=aarch64-unknown-linux-gnu"
|
||||
" --compiler-target-triple=aarch64-unknown-linux-gnu" +
|
||||
" --compiler-try-catch-function=true"
|
||||
|
||||
if (defined(invoker.is_enable_pgo) && invoker.is_enable_pgo) {
|
||||
_aot_compile_options_ +=
|
||||
@ -3376,7 +3385,8 @@ template("host_aot_test_action") {
|
||||
" --compiler-opt-inlining=false" +
|
||||
" --compiler-opt-loop-peeling=false" +
|
||||
" --compiler-enable-litecg=true" +
|
||||
" --compiler-target-triple=aarch64-unknown-linux-gnu"
|
||||
" --compiler-target-triple=aarch64-unknown-linux-gnu" +
|
||||
" --compiler-try-catch-function=true"
|
||||
if (defined(invoker.is_enable_trace_deopt) &&
|
||||
invoker.is_enable_trace_deopt) {
|
||||
_aot_compile_options_ += " --compiler-trace-deopt=true"
|
||||
@ -3784,7 +3794,9 @@ template("host_aot_assert_test_action") {
|
||||
_aot_compile_options_ =
|
||||
" --aot-file=" + rebase_path(_test_aot_arg_) + " --log-level=" +
|
||||
_test_aot_log_level + " --log-components=compiler" +
|
||||
" --compiler-opt-inlining=false" + " --compiler-opt-loop-peeling=false"
|
||||
" --compiler-opt-inlining=false" +
|
||||
" --compiler-opt-loop-peeling=false" +
|
||||
" --compiler-try-catch-function=true"
|
||||
|
||||
if (defined(invoker.is_enable_pgo) && invoker.is_enable_pgo) {
|
||||
_aot_compile_options_ += " --compiler-pgo-profiler-path=" +
|
||||
@ -3877,7 +3889,9 @@ template("host_aot_assert_test_action") {
|
||||
" --aot-file=" + rebase_path(_test_aot_arg_slowpath_) +
|
||||
" --log-level=" + _test_aot_log_level + " --log-components=compiler" +
|
||||
" --compiler-opt-type-lowering=false" +
|
||||
" --compiler-opt-inlining=false" + " --compiler-opt-loop-peeling=false"
|
||||
" --compiler-opt-inlining=false" +
|
||||
" --compiler-opt-loop-peeling=false" +
|
||||
" --compiler-try-catch-function=true"
|
||||
if (defined(invoker.is_enable_trace_deopt) &&
|
||||
invoker.is_enable_trace_deopt) {
|
||||
_aot_compile_options_ += " --compiler-trace-deopt=true"
|
||||
@ -4262,7 +4276,8 @@ template("host_pgotypeinfer_test_action") {
|
||||
script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
|
||||
|
||||
_aot_compile_options_ = " --compiler-opt-type-lowering=false" +
|
||||
" --compiler-opt-loop-peeling=false"
|
||||
" --compiler-opt-loop-peeling=false" +
|
||||
" --compiler-try-catch-function=true"
|
||||
|
||||
# Pgo Option
|
||||
_aot_compile_options_ += " --compiler-pgo-profiler-path=" +
|
||||
@ -4311,7 +4326,8 @@ template("host_pgotypeinfer_test_action") {
|
||||
|
||||
_aot_compile_options_ =
|
||||
" --compiler-opt-type-lowering=false" +
|
||||
" --compiler-opt-loop-peeling=false" + " --compiler-enable-litecg=true"
|
||||
" --compiler-opt-loop-peeling=false" +
|
||||
" --compiler-enable-litecg=true" + " --compiler-try-catch-function=true"
|
||||
|
||||
# Pgo Option
|
||||
_aot_compile_options_ += " --compiler-pgo-profiler-path=" +
|
||||
|
Loading…
Reference in New Issue
Block a user