-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Copy pathraw.wast
52 lines (47 loc) · 977 Bytes
/
raw.wast
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
(module
(import "./globals.js" "jsthunk" (func $js_thunk))
(import "./globals.js" "add" (func $js_add (param i32) (param i32) (result i32)))
(export "call_js_thunk_n_times" (func $call_thunk))
(export "call_js_add_n_times" (func $call_add))
(export "thunk" (func $thunk))
(export "add" (func $add))
(func $call_thunk (param i32)
block
get_local 0
i32.eqz
br_if 0
loop
call $js_thunk
get_local 0
i32.const 1
i32.sub
tee_local 0
br_if 0
end
end
)
(func $call_add (param i32) (param i32) (param i32)
block
get_local 0
i32.eqz
br_if 0
loop
get_local 2
get_local 1
call $js_add
drop
get_local 0
i32.const 1
i32.sub
tee_local 0
br_if 0
end
end
)
(func $thunk)
(func $add (param i32) (param i32) (result i32)
get_local 0
get_local 1
i32.add
)
)