From b637b94892493fc270a3f74f8166f7ee0ef4f158 Mon Sep 17 00:00:00 2001 From: John O'Reilly Date: Thu, 29 Aug 2024 19:41:02 +0100 Subject: [PATCH] diagnosing wasm issues in safari preview version --- compose-web/build.gradle.kts | 36 +++++++++++++++++++++++ compose-web/src/wasmJsMain/kotlin/Main.kt | 1 + 2 files changed, 37 insertions(+) diff --git a/compose-web/build.gradle.kts b/compose-web/build.gradle.kts index 3f0884289..6dbc4c810 100644 --- a/compose-web/build.gradle.kts +++ b/compose-web/build.gradle.kts @@ -51,3 +51,39 @@ kotlin { compose.experimental { web.application {} } + + +tasks.withType().configureEach { + binaryenArgs = mutableListOf( + // Proposals + "--enable-gc", + "--enable-reference-types", + "--enable-exception-handling", + "--enable-bulk-memory", // For array initialization from data sections + + // Other options + "--enable-nontrapping-float-to-int", + "--closed-world", + + // Optimizations: + // Note the order and repetition of the next options matter. + // + // About Binaryen optimizations: + // GC Optimization Guidebook -- https://github.com/WebAssembly/binaryen/wiki/GC-Optimization-Guidebook + // Optimizer Cookbook -- https://github.com/WebAssembly/binaryen/wiki/Optimizer-Cookbook + // + "--inline-functions-with-loops", + "--traps-never-happen", + "--fast-math", + // without "--type-merging" it produces increases the size + "--type-ssa", + "-O3", + "-O3", + "--gufa", + "-O3", + // requires --closed-world + "--type-merging", + "-O3", + "-Oz", + ) +} \ No newline at end of file diff --git a/compose-web/src/wasmJsMain/kotlin/Main.kt b/compose-web/src/wasmJsMain/kotlin/Main.kt index 68f3d577b..6dac16ba8 100644 --- a/compose-web/src/wasmJsMain/kotlin/Main.kt +++ b/compose-web/src/wasmJsMain/kotlin/Main.kt @@ -31,6 +31,7 @@ val koin = initKoin { fun main() { val lifecycle = LifecycleRegistry(Lifecycle.State.STARTED) + println("JFOR, start of main") val appComponent = DefaultAppComponent( componentContext = DefaultComponentContext(lifecycle),