Files
cli/vendor/wit-component/tests/components/link-bare-funcs/component.wat

213 lines
7.5 KiB
Plaintext
Raw Normal View History

(component
(type (;0;) (func))
(import "foo1" (func $foo1 (;0;) (type 0)))
(type (;1;) (func (result string)))
(import "bar" (func $bar (;1;) (type 1)))
(core module $main (;0;)
(type (;0;) (func (param i32 i32 i32 i32) (result i32)))
(import "foo" "cabi_realloc" (func (;0;) (type 0)))
(table (;0;) 1 funcref)
(memory (;0;) 17)
(global (;0;) (mut i32) i32.const 1048576)
(global (;1;) (mut i32) i32.const 1048576)
(global (;2;) (mut i32) i32.const 0)
(global (;3;) i32 i32.const 1048592)
(global (;4;) i32 i32.const 1)
(global (;5;) i32 i32.const 1048592)
(global (;6;) i32 i32.const 1)
(global (;7;) (mut i32) i32.const 1048608)
(global (;8;) (mut i32) i32.const 1114112)
(export "cabi_realloc" (func 0))
(export "__stack_pointer" (global 0))
(export "__stack_high" (global 1))
(export "__stack_low" (global 2))
(export "c:memory_base" (global 3))
(export "c:table_base" (global 4))
(export "foo:memory_base" (global 5))
(export "foo:table_base" (global 6))
(export "__heap_base" (global 7))
(export "__heap_end" (global 8))
(export "__indirect_function_table" (table 0))
(export "memory" (memory 0))
(@producers
(processed-by "wit-component" "$CARGO_PKG_VERSION")
)
)
(core module $c (;1;)
(@dylink.0
(mem-info (memory 0 4))
)
(type (;0;) (func))
(type (;1;) (func (param i32) (result i32)))
(import "GOT.mem" "__heap_base" (global $__heap_base (;0;) (mut i32)))
(import "GOT.mem" "__heap_end" (global $__heap_end (;1;) (mut i32)))
(global $heap (;2;) (mut i32) i32.const 0)
(export "malloc" (func $malloc))
(export "abort" (func $abort))
(start $start)
(func $start (;0;) (type 0)
global.get $__heap_base
global.set $heap
)
(func $malloc (;1;) (type 1) (param i32) (result i32)
global.get $heap
global.get $heap
local.get 0
i32.add
global.set $heap
)
(func $abort (;2;) (type 0)
unreachable
)
)
(core module $foo (;2;)
(@dylink.0
(mem-info (memory 4 4))
(needed "c")
)
(type (;0;) (func))
(type (;1;) (func (param i32)))
(type (;2;) (func (param i32 i32) (result i32)))
(type (;3;) (func (param i32 i32 i32 i32) (result i32)))
(import "env" "memory" (memory (;0;) 1))
(import "$root" "foo1" (func (;0;) (type 0)))
(import "$root" "bar" (func (;1;) (type 1)))
(export "baz" (func 2))
(export "foo2" (func 3))
(export "cabi_post_foo2" (func 4))
(export "cabi_realloc" (func 5))
(export "cabi_import_realloc" (func 6))
(export "cabi_export_realloc" (func 7))
(func (;2;) (type 0))
(func (;3;) (type 2) (param i32 i32) (result i32)
unreachable
)
(func (;4;) (type 1) (param i32)
unreachable
)
(func (;5;) (type 3) (param i32 i32 i32 i32) (result i32)
unreachable
)
(func (;6;) (type 3) (param i32 i32 i32 i32) (result i32)
unreachable
)
(func (;7;) (type 3) (param i32 i32 i32 i32) (result i32)
unreachable
)
)
(core module $__init (;3;)
(type (;0;) (func))
(type (;1;) (func (param i32)))
(import "env" "memory" (memory (;0;) 0))
(import "env" "__indirect_function_table" (table (;0;) 0 funcref))
(start 0)
(elem (;0;) (i32.const 1) func)
(elem (;1;) (i32.const 1) func)
(func (;0;) (type 0))
(data (;0;) (i32.const 1048576) "\00\00\00\00\00\00\10\00")
(@producers
(processed-by "wit-component" "$CARGO_PKG_VERSION")
)
)
(core module $wit-component-shim-module (;4;)
(type (;0;) (func (param i32 i32 i32 i32) (result i32)))
(type (;1;) (func (param i32)))
(table (;0;) 2 2 funcref)
(export "0" (func $adapt-foo-cabi_realloc))
(export "1" (func $indirect-$root-bar))
(export "$imports" (table 0))
(func $adapt-foo-cabi_realloc (;0;) (type 0) (param i32 i32 i32 i32) (result i32)
local.get 0
local.get 1
local.get 2
local.get 3
i32.const 0
call_indirect (type 0)
)
(func $indirect-$root-bar (;1;) (type 1) (param i32)
local.get 0
i32.const 1
call_indirect (type 1)
)
(@producers
(processed-by "wit-component" "$CARGO_PKG_VERSION")
)
)
(core module $wit-component-fixup (;5;)
(type (;0;) (func (param i32 i32 i32 i32) (result i32)))
(type (;1;) (func (param i32)))
(import "" "0" (func (;0;) (type 0)))
(import "" "1" (func (;1;) (type 1)))
(import "" "$imports" (table (;0;) 2 2 funcref))
(elem (;0;) (i32.const 0) func 0 1)
(@producers
(processed-by "wit-component" "$CARGO_PKG_VERSION")
)
)
(core instance $wit-component-shim-instance (;0;) (instantiate $wit-component-shim-module))
(alias core export $wit-component-shim-instance "0" (core func $adapt-foo-cabi_realloc (;0;)))
(core instance $foo (;1;)
(export "cabi_realloc" (func $adapt-foo-cabi_realloc))
)
(core instance $main (;2;) (instantiate $main
(with "foo" (instance $foo))
)
)
(alias core export $main "memory" (core memory $memory (;0;)))
(alias core export $main "__heap_base" (core global $__heap_base (;0;)))
(alias core export $main "__heap_end" (core global $__heap_end (;1;)))
(core instance $GOT.mem (;3;)
(export "__heap_base" (global $__heap_base))
(export "__heap_end" (global $__heap_end))
)
(core instance $c (;4;) (instantiate $c
(with "GOT.mem" (instance $GOT.mem))
)
)
(core instance $env (;5;)
(export "memory" (memory $memory))
)
(core func $foo1 (;1;) (canon lower (func $foo1)))
(alias core export $wit-component-shim-instance "1" (core func $indirect-$root-bar (;2;)))
(core instance $$root (;6;)
(export "foo1" (func $foo1))
(export "bar" (func $indirect-$root-bar))
)
(core instance $"#core-instance7 foo" (@name "foo") (;7;) (instantiate $foo
(with "env" (instance $env))
(with "$root" (instance $$root))
)
)
(alias core export $wit-component-shim-instance "$imports" (core table $"shim table" (;0;)))
(alias core export $"#core-instance7 foo" "cabi_realloc" (core func $cabi_realloc (;3;)))
(alias core export $"#core-instance7 foo" "cabi_import_realloc" (core func $realloc (;4;)))
(core func $"#core-func5 indirect-$root-bar" (@name "indirect-$root-bar") (;5;) (canon lower (func $bar) (memory $memory) (realloc $realloc) string-encoding=utf8))
(core instance $fixup-args (;8;)
(export "$imports" (table $"shim table"))
(export "0" (func $cabi_realloc))
(export "1" (func $"#core-func5 indirect-$root-bar"))
)
(core instance $fixup (;9;) (instantiate $wit-component-fixup
(with "" (instance $fixup-args))
)
)
(core instance $__init (;10;) (instantiate $__init
(with "env" (instance $main))
)
)
(alias core export $"#core-instance7 foo" "baz" (core func $baz (;6;)))
(alias core export $"#core-instance7 foo" "cabi_export_realloc" (core func $cabi_export_realloc (;7;)))
(func $baz (;2;) (type 0) (canon lift (core func $baz)))
(export $"#func3 baz" (@name "baz") (;3;) "baz" (func $baz))
(type (;2;) (list u8))
(type (;3;) (option 2))
(type (;4;) (func (param "x" string) (result 3)))
(alias core export $"#core-instance7 foo" "foo2" (core func $foo2 (;8;)))
(alias core export $"#core-instance7 foo" "cabi_post_foo2" (core func $cabi_post_foo2 (;9;)))
(func $foo2 (;4;) (type 4) (canon lift (core func $foo2) (memory $memory) (realloc $cabi_export_realloc) string-encoding=utf8 (post-return $cabi_post_foo2)))
(export $"#func5 foo2" (@name "foo2") (;5;) "foo2" (func $foo2))
(@producers
(processed-by "wit-component" "$CARGO_PKG_VERSION")
)
)