[Wasm] Introduce Xwasm-generate-wat compiler flag (disabled by default)
This commit is contained in:
+3
@@ -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
@@ -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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user