Also handle indirect recursive inlining

This commit is contained in:
dcodeIO
2018-07-14 18:21:11 +02:00
parent 4b8500355a
commit 1928f46cb9
6 changed files with 47 additions and 17 deletions

View File

@ -2,8 +2,16 @@
(type $v (func))
(memory $0 0)
(export "foo" (func $inlining-recursive/foo))
(export "baz" (func $inlining-recursive/baz))
(export "bar" (func $inlining-recursive/bar))
(export "memory" (memory $0))
(func $inlining-recursive/foo (; 0 ;) (type $v)
(call $inlining-recursive/foo)
)
(func $inlining-recursive/baz (; 1 ;) (type $v)
(call $inlining-recursive/bar)
)
(func $inlining-recursive/bar (; 2 ;) (type $v)
(call $inlining-recursive/baz)
)
)

View File

@ -1,4 +1,18 @@
// direct
@inline
export function foo(): void {
foo();
}
// indirect
@inline
export function bar(): void {
baz();
}
@inline
export function baz(): void {
bar();
}

View File

@ -3,10 +3,22 @@
(global $HEAP_BASE i32 (i32.const 8))
(memory $0 0)
(export "foo" (func $inlining-recursive/foo))
(export "baz" (func $inlining-recursive/baz))
(export "bar" (func $inlining-recursive/bar))
(export "memory" (memory $0))
(func $inlining-recursive/foo (; 0 ;) (type $v)
(block $inlining-recursive/foo|inlined.0
(call $inlining-recursive/foo)
)
)
(func $inlining-recursive/baz (; 1 ;) (type $v)
(call $inlining-recursive/bar)
)
(func $inlining-recursive/bar (; 2 ;) (type $v)
(block $inlining-recursive/baz|inlined.0
(block $inlining-recursive/bar|inlined.0
(call $inlining-recursive/baz)
)
)
)
)