Files
sdk/pkg/dart2wasm/test/ir_tests/interop.double.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

73 lines
2.3 KiB
WebAssembly Text Format

(module $module0
(type $#Top (struct
(field $field0 i32)))
(type $BoxedDouble (sub final $#Top (struct
(field $field0 i32)
(field $value f64))))
(func $"dart2wasm.M (import)" (import "dart2wasm" "M") (param f64) (result externref))
(func $"dart2wasm.N (import)" (import "dart2wasm" "N") (param externref) (result externref))
(func $"dart2wasm.R (import)" (import "dart2wasm" "R") (param f64) (result externref))
(global $"doubleValueNullable initialized" (mut i32) <...>)
(global $doubleValueNullable (mut (ref null $BoxedDouble)) <...>)
(func $doubleValue implicit getter (result f64) <...>)
(func $ktrue implicit getter (result i32) <...>)
(func $sinkDouble (param $var0 f64) <...>)
(func $sinkDoubleNullable (param $var0 (ref null $BoxedDouble)) <...>)
(@binaryen.inline 0)
(func $testDoubleConstant
f64.const 1.1
call $"dart2wasm.R (import)"
call $toDartDouble
call $sinkDouble
)
(@binaryen.inline 0)
(func $testDoubleConstantNullable
ref.null noextern
call $"dart2wasm.N (import)"
call $toDartNullableDouble
call $sinkDoubleNullable
)
(@binaryen.inline 0)
(func $testDoubleValue
call $"doubleValue implicit getter"
call $"dart2wasm.R (import)"
call $toDartDouble
call $sinkDouble
)
(@binaryen.inline 0)
(func $testDoubleValueNullable
(local $var0 (ref null $BoxedDouble))
global.get $"doubleValueNullable initialized"
if (result (ref null $BoxedDouble))
global.get $doubleValueNullable
else
call $"ktrue implicit getter"
if (result (ref null $BoxedDouble))
i32.const 92
call $"doubleValue implicit getter"
struct.new $BoxedDouble
else
ref.null none
end
local.tee $var0
global.set $doubleValueNullable
i32.const 1
global.set $"doubleValueNullable initialized"
local.get $var0
end
local.tee $var0
ref.is_null
if (result externref)
ref.null noextern
else
local.get $var0
struct.get $BoxedDouble $value
call $"dart2wasm.M (import)"
end
call $"dart2wasm.N (import)"
call $toDartNullableDouble
call $sinkDoubleNullable
)
(func $toDartDouble (param $var0 externref) (result f64) <...>)
(func $toDartNullableDouble (param $var0 externref) (result (ref null $BoxedDouble)) <...>)
)