Skip to content

[test] Add a test for non-treelike behavior of stack #961

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 4, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions test/core/stack.wast
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,31 @@
end
local.get $res
)

(global $temp (mut i32) (i32.const 0))
(func $add_one_to_global (result i32)
(local i32)
(global.set $temp (i32.add (i32.const 1) (global.get $temp)))
(global.get $temp)
)
(func $add_one_to_global_and_drop
(drop (call $add_one_to_global))
)
(func (export "not-quite-a-tree") (result i32)
call $add_one_to_global
call $add_one_to_global
call $add_one_to_global_and_drop
i32.add
)
)

(assert_return (invoke "fac-expr" (i64.const 25)) (i64.const 7034535277573963776))
(assert_return (invoke "fac-stack" (i64.const 25)) (i64.const 7034535277573963776))
(assert_return (invoke "fac-mixed" (i64.const 25)) (i64.const 7034535277573963776))

(assert_return (invoke "not-quite-a-tree") (i32.const 3))
(assert_return (invoke "not-quite-a-tree") (i32.const 9))


;; Syntax of flat call_indirect

Expand Down