diff --git a/ets2panda/driver/build_system/src/build/base_mode.ts b/ets2panda/driver/build_system/src/build/base_mode.ts index 0117bdc06b3a32b303592f64bc6539c3f918c377..43c25cd27ef9f241ec18cb37ce1479ef3a659235 100644 --- a/ets2panda/driver/build_system/src/build/base_mode.ts +++ b/ets2panda/driver/build_system/src/build/base_mode.ts @@ -348,7 +348,8 @@ export abstract class BaseMode { moduleInfo.arktsConfigFile, '--output', intermediateFilePath, - '--simultaneous' + '--simultaneous', + '--opt-try-catch-func=false' ]; ensurePathExists(intermediateFilePath); if (this.isDebug) { diff --git a/ets2panda/driver/build_system/src/build/compile_worker.ts b/ets2panda/driver/build_system/src/build/compile_worker.ts index a93ea46d22758f39b71e9b32b72c235bf816ae3a..252c963381710f3316df70bdc8d7cdd0e64af075 100644 --- a/ets2panda/driver/build_system/src/build/compile_worker.ts +++ b/ets2panda/driver/build_system/src/build/compile_worker.ts @@ -59,6 +59,7 @@ process.on('message', (message: { '_', '--extension', 'ets', '--arktsconfig', fileInfo.arktsConfigFile, '--output', fileInfo.abcFilePath, + '--opt-try-catch-func=false' ]; if (isDebug) { ets2pandaCmd.push('--debug-info'); diff --git a/ets2panda/util/generateBin.cpp b/ets2panda/util/generateBin.cpp index 134b2c9511a761a51fa5f546e98cd90d932f6c1a..46fa686579245f1313cac4bc5e24fdae83e0a2c2 100644 --- a/ets2panda/util/generateBin.cpp +++ b/ets2panda/util/generateBin.cpp @@ -50,6 +50,7 @@ static int OptimizeBytecode(ark::pandasm::Program *prog, const util::Options &op } ark::bytecodeopt::g_options.SetOptLevel(options.GetOptLevel()); + ark::bytecodeopt::g_options.SetSkipMethodsWithEh(!options.IsOptTryCatchFunc()); // Set default value instead of maximum set in ark::bytecodeopt::SetCompilerOptions() ark::compiler::CompilerLogger::Init({"all"}); ark::compiler::g_options.SetCompilerMaxBytecodeSize(ark::compiler::g_options.GetCompilerMaxBytecodeSize()); diff --git a/ets2panda/util/options.yaml b/ets2panda/util/options.yaml index 0e3f72acae799aa579df78765a481c7cb3c340b5..32274e6c7df8df7990fd5a21478e989b568695a8 100644 --- a/ets2panda/util/options.yaml +++ b/ets2panda/util/options.yaml @@ -101,6 +101,11 @@ options: description: Compiler optimization level range: 0-2 +- name: opt-try-catch-func + type: bool + default: true + description: Enable optimizations for functions with try-catch blocks + - name: ets-module type: bool default: false