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

155 lines
5.2 KiB
WebAssembly Text Format

(module $module1
(type $#Top <...>)
(type $BoxedInt <...>)
(type $JSExternWrapper <...>)
(type $Object <...>)
(global $".Foo0.doitDispatch(" (import "" "Foo0.doitDispatch(") (ref extern))
(global $".Foo1.doitDevirt(" (import "" "Foo1.doitDevirt(") (ref extern))
(global $".Foo1.doitDispatch(" (import "" "Foo1.doitDispatch(") (ref extern))
(global $".FooBase(" (import "" "FooBase(") (ref extern))
(global $"\")\"" (import "module0" "global2") (ref $JSExternWrapper))
(table $module0.cross-module-funcs-0 (import "module0" "cross-module-funcs-0") 18 funcref)
(table $module0.dispatch0 (import "module0" "dispatch0") 657 funcref)
(global $"\"Foo0.doitDispatch(\"" (ref $JSExternWrapper)
(i32.const 60)
(i32.const 0)
(global.get $".Foo0.doitDispatch(")
(struct.new $JSExternWrapper))
(global $"\"Foo1.doitDevirt(\"" (ref $JSExternWrapper)
(i32.const 60)
(i32.const 0)
(global.get $".Foo1.doitDevirt(")
(struct.new $JSExternWrapper))
(global $"\"Foo1.doitDispatch(\"" (ref $JSExternWrapper)
(i32.const 60)
(i32.const 0)
(global.get $".Foo1.doitDispatch(")
(struct.new $JSExternWrapper))
(global $"\"FooBase(\"" (ref $JSExternWrapper)
(i32.const 60)
(i32.const 0)
(global.get $".FooBase(")
(struct.new $JSExternWrapper))
(global $1 (ref $BoxedInt) <...>)
(global $2 (ref $BoxedInt) <...>)
(global $baseObj (mut (ref null $Object)) <...>)
(global $foo1Obj (mut (ref null $Object)) <...>)
(elem $module0.cross-module-funcs-0
(set 0 (ref.func $"runtimeTrue implicit getter"))
(set 1 (ref.func $foo1))
(set 2 (ref.func $foo0)))
(elem $module0.dispatch0 <...>)
(func $runtimeTrue implicit getter (result i32) <...>)
(func $Foo0.doitDispatch (param $var0 (ref $Object)) (param $var1 (ref null $#Top))
global.get $"\"Foo0.doitDispatch(\""
local.get $var1
global.get $"\")\""
i32.const 5
call_indirect $module0.cross-module-funcs-0 (param (ref null $#Top) (ref null $#Top) (ref null $#Top)) (result (ref $JSExternWrapper))
i32.const 6
call_indirect $module0.cross-module-funcs-0 (param (ref null $#Top))
local.get $var1
call $FooBase.doitDispatch
)
(func $Foo1 (result (ref $Object)) <...>)
(func $Foo1.doitDevirt
global.get $"\"Foo1.doitDevirt(\""
global.get $1
global.get $"\")\""
i32.const 5
call_indirect $module0.cross-module-funcs-0 (param (ref null $#Top) (ref null $#Top) (ref null $#Top)) (result (ref $JSExternWrapper))
i32.const 6
call_indirect $module0.cross-module-funcs-0 (param (ref null $#Top))
global.get $"\"FooBase(\""
global.get $1
global.get $"\")\""
i32.const 5
call_indirect $module0.cross-module-funcs-0 (param (ref null $#Top) (ref null $#Top) (ref null $#Top)) (result (ref $JSExternWrapper))
i32.const 6
call_indirect $module0.cross-module-funcs-0 (param (ref null $#Top))
)
(func $Foo1.doitDispatch (param $var0 (ref $Object)) (param $var1 (ref null $#Top))
global.get $"\"Foo1.doitDispatch(\""
local.get $var1
global.get $"\")\""
i32.const 5
call_indirect $module0.cross-module-funcs-0 (param (ref null $#Top) (ref null $#Top) (ref null $#Top)) (result (ref $JSExternWrapper))
i32.const 6
call_indirect $module0.cross-module-funcs-0 (param (ref null $#Top))
local.get $var1
call $FooBase.doitDispatch
)
(func $FooBase.doitDispatch (param $var0 (ref null $#Top))
global.get $"\"FooBase(\""
local.get $var0
global.get $"\")\""
i32.const 5
call_indirect $module0.cross-module-funcs-0 (param (ref null $#Top) (ref null $#Top) (ref null $#Top)) (result (ref $JSExternWrapper))
i32.const 6
call_indirect $module0.cross-module-funcs-0 (param (ref null $#Top))
)
(@binaryen.inline 0)
(func $foo0
call $"runtimeTrue implicit getter"
if (result (ref $Object))
i32.const 109
i32.const 0
struct.new $Object
else
call $Foo1
end
global.set $baseObj
call $"runtimeTrue implicit getter"
drop
call $Foo1
global.set $foo1Obj
i64.const 0
i32.const 3
call_indirect $module0.cross-module-funcs-0 (param i64) (result i32)
drop
call $foo1
)
(@binaryen.inline 0)
(func $foo1
(local $var0 (ref $Object))
block $label0
block $label1 (result (ref $Object))
global.get $baseObj
br_on_non_null $label1
br $label0
end $label1
local.tee $var0
global.get $1
local.get $var0
struct.get $Object $field0
i32.const 399
i32.add
call_indirect $module0.dispatch0 (param (ref $Object) (ref null $#Top))
block $label2 (result (ref $Object))
global.get $foo1Obj
br_on_non_null $label2
br $label0
end $label2
global.get $2
call $Foo1.doitDispatch
block $label3 (result (ref $Object))
global.get $foo1Obj
br_on_non_null $label3
br $label0
end $label3
drop
call $Foo1.doitDevirt
block $label4 (result (ref $Object))
global.get $foo1Obj
br_on_non_null $label4
br $label0
end $label4
drop
call $Foo1.doitDevirt
return
end $label0
i32.const 4
call_indirect $module0.cross-module-funcs-0
unreachable
)
)