(component
(type $ty-test:test/test (;0;)
(instance
(type (;0;) (func (param "v" string) (result string)))
(export (;0;) "bar" (func (type 0)))
)
)
(import "test:test/test" (instance $test:test/test (;0;) (type $ty-test:test/test)))
(core module $main (;0;)
(type (;0;) (func (param i32 i32 i32 i32) (result i32)))
(import "c" "cabi_realloc" (func (;0;) (type 0)))
(table (;0;) 1 funcref)
(memory (;0;) 17)
(global (;0;) i32 i32.const 1048592)
(global (;1;) i32 i32.const 1)
(global (;2;) i32 i32.const 1048592)
(global (;3;) i32 i32.const 1)
(global (;4;) (mut i32) i32.const 1048608)
(export "cabi_realloc" (func 0))
(export "c:memory_base" (global 0))
(export "c:table_base" (global 1))
(export "foo:memory_base" (global 2))
(export "foo:table_base" (global 3))
(export "__heap_base" (global 4))
(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 $void (;0;) (func))
(type $malloc (;1;) (func (param i32) (result i32)))
(type $realloc (;2;) (func (param i32 i32 i32 i32) (result i32)))
(import "GOT.mem" "__heap_base" (global $__heap_base (;0;) (mut i32)))
(global $heap (;1;) (mut i32) i32.const 0)
(export "malloc" (func $malloc))
(export "cabi_realloc" (func $cabi_realloc))
(export "abort" (func $abort))
(start $start)
(func $start (;0;) (type $void)
global.get $__heap_base
global.set $heap
)
(func $malloc (;1;) (type $malloc) (param i32) (result i32)
global.get $heap
global.get $heap
local.get 0
i32.add
global.set $heap
)
(func $cabi_realloc (;2;) (type $realloc) (param i32 i32 i32 i32) (result i32)
local.get 3
call $malloc
)
(func $abort (;3;) (type $void)
unreachable
)
)
(core module $foo (;2;)
(@dylink.0
(mem-info (memory 16 4))
(needed "c")
)
(type (;0;) (func (param i32 i32 i32)))
(type (;1;) (func (result i32)))
(type (;2;) (func (param i32 i32) (result i32)))
(type (;3;) (func (param i32)))
(import "env" "memory" (memory (;0;) 1))
(import "test:test/test" "bar" (func $bar (;0;) (type 0)))
(export "run" (func 1))
(export "greet" (func 2))
(export "cabi_post_greet" (func 3))
(func (;1;) (type 1) (result i32)
unreachable
)
(func (;2;) (type 2) (param i32 i32) (result i32)
unreachable
)
(func (;3;) (type 3) (param i32)
unreachable
)
)
(core module $wit-component-shim-module (;3;)
(type (;0;) (func (param i32 i32 i32 i32) (result i32)))
(type (;1;) (func (param i32 i32 i32)))
(table (;0;) 2 2 funcref)
(export "0" (func $adapt-c-cabi_realloc))
(export "1" (func $indirect-test:test/test-bar))
(export "$imports" (table 0))
(func $adapt-c-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-test:test/test-bar (;1;) (type 1) (param i32 i32 i32)
local.get 0
local.get 1
local.get 2
i32.const 1
call_indirect (type 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-c-cabi_realloc (;0;)))
(core instance $c (;1;)
(export "cabi_realloc" (func $adapt-c-cabi_realloc))
)
(core instance $main (;2;) (instantiate $main
(with "c" (instance $c))
)
)
(alias core export $main "memory" (core memory $memory (;0;)))
(alias core export $main "__heap_base" (core global $__heap_base (;0;)))
(core instance $GOT.mem (;3;)
(export "__heap_base" (global $__heap_base))
)
(core instance $"#core-instance4 c" (@name "c") (;4;) (instantiate $c
(with "GOT.mem" (instance $GOT.mem))
)
)
(core instance $env (;5;)
(export "memory" (memory $memory))
)
(alias core export $wit-component-shim-instance "1" (core func $indirect-test:test/test-bar (;1;)))
(core instance $test:test/test (;6;)
(export "bar" (func $indirect-test:test/test-bar))
)
(core instance $foo (;7;) (instantiate $foo
(with "env" (instance $env))
(with "test:test/test" (instance $test:test/test))
)
)
(core module $wit-component-fixup (;4;)
(type (;0;) (func (param i32 i32 i32 i32) (result i32)))
(type (;1;) (func (param i32 i32 i32)))
(type (;2;) (func))
(import "actual" "0" (func $0 (;0;) (type 0)))
(import "actual" "1" (func $1 (;1;) (type 1)))
(import "main" "memory" (memory (;0;) 0))
(import "main" "__indirect_function_table" (table (;0;) 0 funcref))
(import "shim" "$imports" (table (;1;) 2 2 funcref))
(elem (;0;) (i32.const 1) func)
(elem (;1;) (i32.const 1) func)
(elem (;2;) (table 1) (i32.const 0) func $0 $1)
(data (;0;) (i32.const 1048576) "\00\00\00\00\00\00\10\00")
(@producers
(processed-by "wit-component" "$CARGO_PKG_VERSION")
)
)
(alias core export $"#core-instance4 c" "cabi_realloc" (core func $cabi_realloc (;2;)))
(alias export $test:test/test "bar" (func $bar (;0;)))
(alias core export $main "cabi_realloc" (core func $"#core-func3 cabi_realloc" (@name "cabi_realloc") (;3;)))
(core func $"#core-func4 indirect-test:test/test-bar" (@name "indirect-test:test/test-bar") (;4;) (canon lower (func $bar) (memory $memory) (realloc $"#core-func3 cabi_realloc") string-encoding=utf8))
(core instance $actual (;8;)
(export "0" (func $cabi_realloc))
(export "1" (func $"#core-func4 indirect-test:test/test-bar"))
)
(core instance $fixup (;9;) (instantiate $wit-component-fixup
(with "actual" (instance $actual))
(with "main" (instance $main))
(with "shim" (instance $wit-component-shim-instance))
)
)
(type (;1;) (func (result u32)))
(alias core export $foo "run" (core func $run (;5;)))
(func $run (;1;) (type 1) (canon lift (core func $run)))
(export $"#func2 run" (@name "run") (;2;) "run" (func $run))
(type (;2;) (func (param "name" string) (result string)))
(alias core export $foo "greet" (core func $greet (;6;)))
(alias core export $foo "cabi_post_greet" (core func $cabi_post_greet (;7;)))
(func $greet (;3;) (type 2) (canon lift (core func $greet) (memory $memory) (realloc $"#core-func3 cabi_realloc") string-encoding=utf8 (post-return $cabi_post_greet)))
(export $"#func4 greet" (@name "greet") (;4;) "greet" (func $greet))
(@producers
(processed-by "wit-component" "$CARGO_PKG_VERSION")
)
)