summaryrefslogtreecommitdiff
path: root/test/passes/stack-check_enable-mutable-globals.txt
blob: 43e352bdbad3069f4481c1212d858e653f79a571 (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
(module
 (type $0 (func (result i32)))
 (type $1 (func (param i32 i32)))
 (import "env" "__stack_pointer" (global $sp (mut i32)))
 (global $__stack_base (mut i32) (i32.const 0))
 (global $__stack_limit (mut i32) (i32.const 0))
 (export "use_stack" (func $use_stack))
 (export "__set_stack_limits" (func $__set_stack_limits))
 (func $use_stack (result i32)
  (local $0 i32)
  (block
   (if
    (i32.or
     (i32.gt_u
      (local.tee $0
       (i32.const 42)
      )
      (global.get $__stack_base)
     )
     (i32.lt_u
      (local.get $0)
      (global.get $__stack_limit)
     )
    )
    (then
     (unreachable)
    )
   )
   (global.set $sp
    (local.get $0)
   )
  )
  (global.get $sp)
 )
 (func $__set_stack_limits (param $0 i32) (param $1 i32)
  (global.set $__stack_base
   (local.get $0)
  )
  (global.set $__stack_limit
   (local.get $1)
  )
 )
)
(module
 (type $0 (func (result i32)))
 (type $1 (func (param i32 i32)))
 (import "env" "__stack_pointer" (global $sp (mut i32)))
 (global $__stack_base (mut i32) (i32.const 0))
 (global $__stack_limit (mut i32) (i32.const 0))
 (global $__stack_base_3 (mut i32) (i32.const 0))
 (global $__stack_limit_3 (mut i32) (i32.const 0))
 (export "use_stack" (func $0))
 (export "__set_stack_limits" (func $__set_stack_limits))
 (func $0 (result i32)
  (unreachable)
 )
 (func $__set_stack_limits (param $0 i32) (param $1 i32)
  (global.set $__stack_base_3
   (local.get $0)
  )
  (global.set $__stack_limit_3
   (local.get $1)
  )
 )
)