[Wasm] Add compiler flag to disable exception handling proposal

Fail with unreachable instead of throwing an exception

Merge-request: KT-MR-11481
Merged-by: Svyatoslav Kuzmich <svyatoslav.kuzmich@jetbrains.com>
This commit is contained in:
Svyatoslav Kuzmich
2023-08-07 16:19:29 +00:00
committed by Space Team
parent ec73815f80
commit 47ade4530c
17 changed files with 118 additions and 13 deletions
@@ -73,6 +73,7 @@ fun copyK2JSCompilerArguments(from: K2JSCompilerArguments, to: K2JSCompilerArgum
to.wasmGenerateWat = from.wasmGenerateWat
to.wasmKClassFqn = from.wasmKClassFqn
to.wasmTarget = from.wasmTarget
to.wasmUseTrapsInsteadOfExceptions = from.wasmUseTrapsInsteadOfExceptions
return to
}
@@ -630,6 +630,16 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
field = if (value.isNullOrEmpty()) null else value
}
@Argument(
value = "-Xwasm-use-traps-instead-of-exceptions",
description = "Trap instead of throwing exceptions"
)
var wasmUseTrapsInsteadOfExceptions = false
set(value) {
checkFrozen()
field = value
}
@Argument(
value = "-Xforce-deprecated-legacy-compiler-usage",
description = "The flag is used only for our inner infrastructure. It will be removed soon, so it's unsafe to use it nowadays."