Files
sdk/pkg/dart2wasm/test/ir_tests/pure_function.wat
T
Martin Kustermann 5cd42e6b21 [dart2wasm] Start emitting binaryen.inline custom section
Binaryen introduced `binaryen.inline` which allows us to tell it
inlining hints now, including "never inline" hint (see [0])

This allows us to remove the ugly mangling of wasm function names with
`<noInline>` postfix.

We also now pass `--strip-toolchain-annotations`: The annotations
occupy size in the wasm binary and wasm runtimes ignore them (they are
for `wams-opt` only).

Except for IR tests: Here we want to see the annotations, so we keep
them there.

We also rename the package:wasm_builder classes to clearly indicate
those are binaryen specific sections.

We also make the ir_test.dart put it's options first, allowing the IR
tests to override options if needed.

[0] https://github.com/WebAssembly/binaryen/commit/3c25487214600a9

Change-Id: I96688bfaeba403a39cd5e7376f8d2889bcbae030
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510000
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2026-06-10 15:51:47 -07:00

43 lines
1.4 KiB
WebAssembly Text Format

(module $$
(type $#Top <...>)
(type $BoxedInt <...>)
(type $JSExternWrapper <...>)
(@binaryen.removable.if.unused)
(func $"wasm:js-string.length (import)" (import "wasm:js-string" "length") (param externref) (result i32))
(global $"\")\"" (ref $JSExternWrapper) <...>)
(global $"\"3\"" (ref $JSExternWrapper) <...>)
(global $"\"4\"" (ref $JSExternWrapper) <...>)
(global $"\"bar(\"" (ref $JSExternWrapper) <...>)
(global $"\"foo(\"" (ref $JSExternWrapper) <...>)
(func $JSStringImpl._interpolate3 (param $var0 (ref $JSExternWrapper)) (param $var1 (ref $#Top)) (param $var2 (ref $JSExternWrapper)) (result (ref $JSExternWrapper)) <...>)
(@binaryen.removable.if.unused)
(@binaryen.inline 0)
(func $foo (param $var0 (ref $JSExternWrapper)) (result (ref $BoxedInt))
global.get $"\"foo(\""
local.get $var0
global.get $"\")\""
call $JSStringImpl._interpolate3
drop
global.get $"\"bar(\""
local.get $var0
global.get $"\")\""
call $JSStringImpl._interpolate3
drop
i32.const 84
local.get $var0
struct.get $JSExternWrapper $_externRef
call $"wasm:js-string.length (import)"
i64.extend_i32_u
struct.new $BoxedInt
)
(func $print (param $var0 (ref $#Top)) <...>)
(@binaryen.inline 0)
(func $runApp
global.get $"\"3\""
call $foo
call $print
global.get $"\"4\""
call $foo
call $print
)
)