Skip to content

Commit

Permalink
diagnosing wasm issues in safari preview version
Browse files Browse the repository at this point in the history
  • Loading branch information
joreilly committed Aug 29, 2024
1 parent 188810d commit b637b94
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
36 changes: 36 additions & 0 deletions compose-web/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,39 @@ kotlin {
compose.experimental {
web.application {}
}


tasks.withType<org.jetbrains.kotlin.gradle.targets.js.binaryen.BinaryenExec>().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",
)
}
1 change: 1 addition & 0 deletions compose-web/src/wasmJsMain/kotlin/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit b637b94

Please sign in to comment.