[Wasm] Introduce Xwasm-generate-wat compiler flag (disabled by default)

This commit is contained in:
Igor Yakovlev
2022-12-27 17:45:44 +01:00
committed by teamcity
parent fc80104d55
commit 71afbb36f5
4 changed files with 9 additions and 1 deletions
@@ -336,6 +336,9 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
@Argument(value = "-Xwasm-enable-asserts", description = "Turn on asserts")
var wasmEnableAsserts: Boolean by FreezableVar(false)
@Argument(value = "-Xwasm-generate-wat", description = "Generate wat file")
var wasmGenerateWat: Boolean by FreezableVar(false)
@Argument(
value = "-Xuse-deprecated-legacy-compiler",
description = "Use deprecated legacy compiler without error"
@@ -200,6 +200,7 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
configuration.put(JSConfigurationKeys.WASM_ENABLE_ARRAY_RANGE_CHECKS, arguments.wasmEnableArrayRangeChecks)
configuration.put(JSConfigurationKeys.WASM_ENABLE_ASSERTS, arguments.wasmEnableAsserts)
configuration.put(JSConfigurationKeys.WASM_GENERATE_WAT, arguments.wasmGenerateWat)
val commonSourcesArray = arguments.commonSources
val commonSources = commonSourcesArray?.toSet() ?: emptySet()
@@ -376,7 +377,7 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
baseFileName = outputName,
emitNameSection = arguments.wasmDebug,
allowIncompleteImplementations = arguments.irDce,
generateWat = true,
generateWat = configuration.get(JSConfigurationKeys.WASM_GENERATE_WAT, false),
generateSourceMaps = generateSourceMaps
)
+1
View File
@@ -50,6 +50,7 @@ where advanced options include:
-Xwasm-enable-array-range-checks
Turn on range checks for the array access functions
-Xwasm-enable-asserts Turn on asserts
-Xwasm-generate-wat Generate wat file
-Xwasm-kclass-fqn Enable support for FQ names in KClass
-Xallow-any-scripts-in-source-roots
Allow to compile any scripts along with regular Kotlin sources
@@ -120,4 +120,7 @@ public class JSConfigurationKeys {
public static final CompilerConfigurationKey<Boolean> WASM_ENABLE_ASSERTS =
CompilerConfigurationKey.create("enable asserts");
public static final CompilerConfigurationKey<Boolean> WASM_GENERATE_WAT =
CompilerConfigurationKey.create("generate wat file");
}