diff --git a/ets2panda/driver/build_system/src/build/base_mode.ts b/ets2panda/driver/build_system/src/build/base_mode.ts index 231eaa73492433aa195173e9d409202725f39fc8..d2a5b6d8167723ad802bec31ede4fa612d7705e8 100644 --- a/ets2panda/driver/build_system/src/build/base_mode.ts +++ b/ets2panda/driver/build_system/src/build/base_mode.ts @@ -360,7 +360,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 fbb0b497c0fc5da6e0184e5495ae3583308cae21..47abc6440ab11b20ade9f7b95511e5d5e45938f9 100644 --- a/ets2panda/driver/build_system/src/build/compile_worker.ts +++ b/ets2panda/driver/build_system/src/build/compile_worker.ts @@ -62,7 +62,8 @@ process.on('message', async (message: { let ets2pandaCmd = [ '_', '--extension', 'ets', '--arktsconfig', fileInfo.arktsConfigFile, - '--output', fileInfo.abcFilePath + '--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 a27bac139ca92ee86ee2aae2e7c000ae54fe4799..8fd646b5a514947962b8a6e0e5bd855b7ad2a9cf 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