@onda-lang/binaryen-web 0.9.1 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -10
- package/api.md +325 -310
- package/package.json +3 -3
- package/src/compiler/core.js +175 -289
- package/src/compiler/expression-tree.js +108 -0
- package/src/compiler/guarded-addresses.js +243 -0
- package/src/compiler/index.js +41 -30
- package/src/compiler/inlining.js +62 -0
- package/src/compiler/lowering.js +16 -7
- package/src/compiler/shared.js +15 -9
- package/src/compiler/simd-reductions.js +229 -0
package/README.md
CHANGED
|
@@ -122,9 +122,8 @@ compares targeted edge cases and deterministic random bit patterns against Rust'
|
|
|
122
122
|
`mul_add` oracle. Binaryen removes unused helper functions, so a program pays code size only for
|
|
123
123
|
the math closure it calls. Generated modules need no default host imports.
|
|
124
124
|
|
|
125
|
-
Compilation defaults to Binaryen O4
|
|
126
|
-
|
|
127
|
-
`artifact.metadata.optimization`:
|
|
125
|
+
Compilation defaults to Binaryen O4, strict floating-point optimization, and WebAssembly SIMD.
|
|
126
|
+
The selected options are recorded in `artifact.metadata.optimization`.
|
|
128
127
|
|
|
129
128
|
```js
|
|
130
129
|
compileTrustedMir(mir, {
|
|
@@ -138,10 +137,14 @@ compileTrustedMir(mir, {
|
|
|
138
137
|
});
|
|
139
138
|
```
|
|
140
139
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
140
|
+
The backend passes MIR inline hints to Binaryen's inliner. `always` requests inlining even
|
|
141
|
+
for callees with loops, subject to Binaryen's combined-function size and iteration limits.
|
|
142
|
+
`never` keeps shared callees out of the inliner. At O2 and above or shrink level 2,
|
|
143
|
+
Binaryen's cost model applies to `auto`, `prefer`, and linked math routines. Modules with
|
|
144
|
+
`always` run the inliner before identical functions can merge. Lower optimization levels
|
|
145
|
+
run the inliner only for `always`. Setting `optimize: false` skips inlining entirely.
|
|
146
|
+
`allowInliningFunctionsWithLoops` tunes the normal cost model. The compiler restores
|
|
147
|
+
Binaryen's process-global settings after each build.
|
|
145
148
|
|
|
146
149
|
O4 was selected by an affinity-pinned O3/O4 A/B over language, oversampling, saturator, and complete
|
|
147
150
|
math workloads. It improved three workloads and left saturator effectively unchanged, at the cost
|
|
@@ -188,9 +191,6 @@ Current limitations are explicit:
|
|
|
188
191
|
- scalar FMA and transcendental operations are software helpers on core Wasm targets, so LLVM may
|
|
189
192
|
still use faster target instructions or platform libm implementations
|
|
190
193
|
- recursive call graphs are rejected as unbounded realtime work
|
|
191
|
-
- `inline: always` and `inline: never` are validated but remain advisory because Binaryen.js does
|
|
192
|
-
not expose per-function inline/no-inline annotations; its module optimizer chooses whether to
|
|
193
|
-
inline a call
|
|
194
194
|
- this low-level package accepts MIR rather than source; the product-facing `onda-wasm` CLI lives in
|
|
195
195
|
`@onda-lang/wasm-compiler`, while the native `onda compile` command does not yet emit linked Wasm
|
|
196
196
|
- production consumers must package/cache Binaryen; Web Audio users can use the separate optional
|