Files
sdk/pkg/dart2wasm/test/ir_tests/deferred.constant.multi_module_use_module1.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

72 lines
2.2 KiB
WebAssembly Text Format

(module $module1
(type $#Top (struct
(field $field0 i32)))
(type $JSExternWrapper (sub $Object (struct
(field $field0 i32)
(field $field1 (mut i32))
(field $_externRef externref))))
(type $MyConstClass (sub final $Object (struct
(field $field0 i32)
(field $field1 (mut i32))
(field $b (ref $JSExternWrapper)))))
(type $Object (sub $#Top (struct
(field $field0 i32)
(field $field1 (mut i32)))))
(global $.h1-nonshared-const (import "" "h1-nonshared-const") (ref extern))
(global $.shared-const (import "" "shared-const") (ref extern))
(table $module0.cross-module-funcs-0 (import "module0" "cross-module-funcs-0") 17 funcref)
(global $"\"bad\"" (ref $JSExternWrapper) <...>)
(global $MyConstClass (ref $MyConstClass)
(i32.const 109)
(i32.const 0)
(i32.const 60)
(i32.const 0)
(global.get $.h1-nonshared-const)
(struct.new $JSExternWrapper)
(struct.new $MyConstClass))
(global $MyConstClass_14 (ref $MyConstClass)
(i32.const 109)
(i32.const 0)
(i32.const 60)
(i32.const 0)
(global.get $.shared-const)
(struct.new $JSExternWrapper)
(struct.new $MyConstClass))
(elem $module0.cross-module-funcs-0
(set 0 (ref.func $int.parse))
(set 1 (ref.func $mainImpl))
(set 16 (ref.func $0)))
(func $null (result (ref $MyConstClass)) <...>)
(func $int.parse (result i64) <...>)
(@binaryen.inline 0)
(func $mainImpl (param $var0 i32)
i64.const 0
i32.const 2
call_indirect $module0.cross-module-funcs-0 (param i64) (result i32)
drop
local.get $var0
i32.const 3
call_indirect $module0.cross-module-funcs-0 (param i32) (result (ref $MyConstClass))
i64.const 1
i32.const 2
call_indirect $module0.cross-module-funcs-0 (param i64) (result i32)
drop
local.get $var0
call $modH1Use
ref.eq
i32.eqz
if
global.get $"\"bad\""
i32.const 4
call_indirect $module0.cross-module-funcs-0 (param (ref $#Top))
unreachable
end
)
(@binaryen.inline 0)
(func $modH1Use (param $var0 i32) (result (ref $MyConstClass))
global.get $MyConstClass
global.get $MyConstClass_14
local.get $var0
select (ref $MyConstClass)
)
)