summaryrefslogtreecommitdiff
path: root/test/decompile/stack-flush.txt
blob: cea4fe9bc8f180060869a2368521c3e43edf9fb8 (plain)
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
;;; TOOL: run-wasm-decompile

(module
  (memory 1)
  (func $f (param i32 i32) (result i32) (local i64 f32 f64)
    ;; Two-level flushing to stack with code that can't be reordered.
    call $s
    call $s
    drop
    call $s
    call $s
    call $s
    drop
    i32.add
    drop
    drop
    ;; Two level flushing with constants that can be re-ordered.
    i32.const 14
    i32.const 15
    drop
    i32.const 11
    i32.const 12
    i32.const 13
    drop
    i32.add
    drop
    drop
    ;; Multi-value examples.
    call $mv
    call $mv
    drop
    i32.add
    drop
    drop
    call $mv
    i32.eq
  )
  (func $s (param) (result i32)
    i32.const 1
  )
  (func $mv (param) (result i32 i32)
    i32.const 1
    i32.const 2
  )
  (export "f" (func $f))
  (export "s" (func $s))
  (export "mv" (func $mv))
)

(;; STDOUT ;;;
memory M_a(initial: 1, max: 0);

export function f(a:int, b:int):int {
  let t0 = s();
  s();
  let t1, t2 = s(), s();
  s();
  t1 + t2;
  t0;
  15;
  13;
  11 + 12;
  14;
  let t3, t4 = mv();
  let t5, t6 = mv();
  t6;
  t4 + t5;
  t3;
  let t7, t8 = mv();
  return t7 == t8;
}

export function s():int {
  return 1
}

export function mv():(int, int) {
  return 1, 2
}

;;; STDOUT ;;)