|
2 | 2 | (type $ii (func (param i32) (result i32))) |
3 | 3 | (type $iv (func (param i32))) |
4 | 4 | (type $v (func)) |
| 5 | + (global "$(lib)/allocator/arena/startOffset" (mut i32) (i32.const 0)) |
5 | 6 | (global "$(lib)/allocator/arena/offset" (mut i32) (i32.const 0)) |
6 | 7 | (global $HEAP_BASE i32 (i32.const 4)) |
7 | 8 | (memory $0 1) |
8 | 9 | (export "allocate_memory" (func "$(lib)/allocator/arena/allocate_memory")) |
9 | 10 | (export "free_memory" (func "$(lib)/allocator/arena/free_memory")) |
10 | 11 | (export "reset_memory" (func "$(lib)/allocator/arena/reset_memory")) |
11 | 12 | (export "memory" (memory $0)) |
12 | | - (start $(lib)/allocator/arena/reset_memory) |
| 13 | + (start $start) |
13 | 14 | (func "$(lib)/allocator/arena/allocate_memory" (; 0 ;) (type $ii) (param $0 i32) (result i32) |
14 | 15 | (local $1 i32) |
15 | 16 | (local $2 i32) |
16 | 17 | (local $3 i32) |
17 | 18 | (local $4 i32) |
18 | | - ;;@ (lib)/allocator/arena.ts:14:2 |
| 19 | + ;;@ (lib)/allocator/arena.ts:17:2 |
19 | 20 | (if |
20 | | - ;;@ (lib)/allocator/arena.ts:14:6 |
| 21 | + ;;@ (lib)/allocator/arena.ts:17:6 |
21 | 22 | (i32.eqz |
22 | | - ;;@ (lib)/allocator/arena.ts:14:7 |
| 23 | + ;;@ (lib)/allocator/arena.ts:17:7 |
23 | 24 | (get_local $0) |
24 | 25 | ) |
25 | | - ;;@ (lib)/allocator/arena.ts:14:20 |
| 26 | + ;;@ (lib)/allocator/arena.ts:17:20 |
26 | 27 | (return |
27 | 28 | (i32.const 0) |
28 | 29 | ) |
29 | 30 | ) |
30 | | - ;;@ (lib)/allocator/arena.ts:18:2 |
| 31 | + ;;@ (lib)/allocator/arena.ts:21:2 |
31 | 32 | (if |
32 | | - ;;@ (lib)/allocator/arena.ts:18:6 |
| 33 | + ;;@ (lib)/allocator/arena.ts:21:6 |
33 | 34 | (i32.gt_u |
34 | | - ;;@ (lib)/allocator/arena.ts:16:2 |
| 35 | + ;;@ (lib)/allocator/arena.ts:19:2 |
35 | 36 | (tee_local $2 |
36 | | - ;;@ (lib)/allocator/arena.ts:16:15 |
| 37 | + ;;@ (lib)/allocator/arena.ts:19:15 |
37 | 38 | (i32.and |
38 | 39 | (i32.add |
39 | | - ;;@ (lib)/allocator/arena.ts:16:16 |
| 40 | + ;;@ (lib)/allocator/arena.ts:19:16 |
40 | 41 | (i32.add |
41 | | - ;;@ (lib)/allocator/arena.ts:15:2 |
| 42 | + ;;@ (lib)/allocator/arena.ts:18:2 |
42 | 43 | (tee_local $1 |
43 | | - ;;@ (lib)/allocator/arena.ts:15:12 |
| 44 | + ;;@ (lib)/allocator/arena.ts:18:12 |
44 | 45 | (get_global "$(lib)/allocator/arena/offset") |
45 | 46 | ) |
46 | | - ;;@ (lib)/allocator/arena.ts:16:22 |
| 47 | + ;;@ (lib)/allocator/arena.ts:19:22 |
47 | 48 | (get_local $0) |
48 | 49 | ) |
49 | | - ;;@ (lib)/allocator/arena.ts:16:29 |
| 50 | + ;;@ (lib)/allocator/arena.ts:19:29 |
50 | 51 | (i32.const 7) |
51 | 52 | ) |
52 | 53 | (i32.const -8) |
53 | 54 | ) |
54 | 55 | ) |
55 | | - ;;@ (lib)/allocator/arena.ts:18:15 |
| 56 | + ;;@ (lib)/allocator/arena.ts:21:15 |
56 | 57 | (i32.shl |
57 | | - ;;@ (lib)/allocator/arena.ts:17:2 |
| 58 | + ;;@ (lib)/allocator/arena.ts:20:2 |
58 | 59 | (tee_local $0 |
59 | | - ;;@ (lib)/allocator/arena.ts:17:20 |
| 60 | + ;;@ (lib)/allocator/arena.ts:20:20 |
60 | 61 | (current_memory) |
61 | 62 | ) |
62 | | - ;;@ (lib)/allocator/arena.ts:18:37 |
| 63 | + ;;@ (lib)/allocator/arena.ts:21:37 |
63 | 64 | (i32.const 16) |
64 | 65 | ) |
65 | 66 | ) |
66 | | - ;;@ (lib)/allocator/arena.ts:21:4 |
| 67 | + ;;@ (lib)/allocator/arena.ts:24:4 |
67 | 68 | (if |
68 | | - ;;@ (lib)/allocator/arena.ts:21:8 |
| 69 | + ;;@ (lib)/allocator/arena.ts:24:8 |
69 | 70 | (i32.lt_s |
70 | 71 | (grow_memory |
71 | | - ;;@ (lib)/allocator/arena.ts:20:22 |
| 72 | + ;;@ (lib)/allocator/arena.ts:23:22 |
72 | 73 | (select |
73 | | - ;;@ (lib)/allocator/arena.ts:20:26 |
| 74 | + ;;@ (lib)/allocator/arena.ts:23:26 |
74 | 75 | (get_local $0) |
75 | 76 | (tee_local $4 |
76 | | - ;;@ (lib)/allocator/arena.ts:19:4 |
| 77 | + ;;@ (lib)/allocator/arena.ts:22:4 |
77 | 78 | (tee_local $3 |
78 | | - ;;@ (lib)/allocator/arena.ts:19:22 |
| 79 | + ;;@ (lib)/allocator/arena.ts:22:22 |
79 | 80 | (i32.shr_u |
80 | 81 | (i32.and |
81 | | - ;;@ (lib)/allocator/arena.ts:19:23 |
| 82 | + ;;@ (lib)/allocator/arena.ts:22:23 |
82 | 83 | (i32.add |
83 | | - ;;@ (lib)/allocator/arena.ts:19:24 |
| 84 | + ;;@ (lib)/allocator/arena.ts:22:24 |
84 | 85 | (i32.sub |
85 | 86 | (get_local $2) |
86 | | - ;;@ (lib)/allocator/arena.ts:19:33 |
| 87 | + ;;@ (lib)/allocator/arena.ts:22:33 |
87 | 88 | (get_local $1) |
88 | 89 | ) |
89 | | - ;;@ (lib)/allocator/arena.ts:19:39 |
| 90 | + ;;@ (lib)/allocator/arena.ts:22:39 |
90 | 91 | (i32.const 65535) |
91 | 92 | ) |
92 | 93 | (i32.const -65536) |
93 | 94 | ) |
94 | | - ;;@ (lib)/allocator/arena.ts:19:62 |
| 95 | + ;;@ (lib)/allocator/arena.ts:22:62 |
95 | 96 | (i32.const 16) |
96 | 97 | ) |
97 | 98 | ) |
|
102 | 103 | ) |
103 | 104 | ) |
104 | 105 | ) |
105 | | - ;;@ (lib)/allocator/arena.ts:21:35 |
| 106 | + ;;@ (lib)/allocator/arena.ts:24:35 |
106 | 107 | (i32.const 0) |
107 | 108 | ) |
108 | | - ;;@ (lib)/allocator/arena.ts:22:6 |
| 109 | + ;;@ (lib)/allocator/arena.ts:25:6 |
109 | 110 | (if |
110 | | - ;;@ (lib)/allocator/arena.ts:22:10 |
| 111 | + ;;@ (lib)/allocator/arena.ts:25:10 |
111 | 112 | (i32.lt_s |
112 | 113 | (grow_memory |
113 | | - ;;@ (lib)/allocator/arena.ts:22:22 |
| 114 | + ;;@ (lib)/allocator/arena.ts:25:22 |
114 | 115 | (get_local $3) |
115 | 116 | ) |
116 | | - ;;@ (lib)/allocator/arena.ts:22:37 |
| 117 | + ;;@ (lib)/allocator/arena.ts:25:37 |
117 | 118 | (i32.const 0) |
118 | 119 | ) |
119 | | - ;;@ (lib)/allocator/arena.ts:23:8 |
| 120 | + ;;@ (lib)/allocator/arena.ts:26:8 |
120 | 121 | (unreachable) |
121 | 122 | ) |
122 | 123 | ) |
123 | 124 | ) |
124 | | - ;;@ (lib)/allocator/arena.ts:27:2 |
| 125 | + ;;@ (lib)/allocator/arena.ts:30:2 |
125 | 126 | (set_global "$(lib)/allocator/arena/offset" |
126 | | - ;;@ (lib)/allocator/arena.ts:27:11 |
| 127 | + ;;@ (lib)/allocator/arena.ts:30:11 |
127 | 128 | (get_local $2) |
128 | 129 | ) |
129 | | - ;;@ (lib)/allocator/arena.ts:28:9 |
| 130 | + ;;@ (lib)/allocator/arena.ts:31:9 |
130 | 131 | (get_local $1) |
131 | 132 | ) |
132 | 133 | (func "$(lib)/allocator/arena/free_memory" (; 1 ;) (type $iv) (param $0 i32) |
133 | | - ;;@ (lib)/allocator/arena.ts:32:46 |
| 134 | + ;;@ (lib)/allocator/arena.ts:35:46 |
134 | 135 | (nop) |
135 | 136 | ) |
136 | 137 | (func "$(lib)/allocator/arena/reset_memory" (; 2 ;) (type $v) |
137 | | - ;;@ (lib)/allocator/arena.ts:38:2 |
| 138 | + ;;@ (lib)/allocator/arena.ts:41:2 |
138 | 139 | (set_global "$(lib)/allocator/arena/offset" |
139 | | - ;;@ (lib)/allocator/arena.ts:38:11 |
| 140 | + ;;@ (lib)/allocator/arena.ts:41:11 |
| 141 | + (get_global "$(lib)/allocator/arena/startOffset") |
| 142 | + ) |
| 143 | + ) |
| 144 | + (func $start (; 3 ;) (type $v) |
| 145 | + (set_global "$(lib)/allocator/arena/startOffset" |
| 146 | + ;;@ (lib)/allocator/arena.ts:12:25 |
140 | 147 | (i32.and |
141 | 148 | (i32.add |
142 | | - ;;@ (lib)/allocator/arena.ts:38:12 |
| 149 | + ;;@ (lib)/allocator/arena.ts:12:26 |
143 | 150 | (get_global $HEAP_BASE) |
144 | | - ;;@ (lib)/allocator/arena.ts:38:24 |
| 151 | + ;;@ (lib)/allocator/arena.ts:12:38 |
145 | 152 | (i32.const 7) |
146 | 153 | ) |
147 | 154 | (i32.const -8) |
148 | 155 | ) |
149 | 156 | ) |
| 157 | + (set_global "$(lib)/allocator/arena/offset" |
| 158 | + ;;@ (lib)/allocator/arena.ts:13:20 |
| 159 | + (get_global "$(lib)/allocator/arena/startOffset") |
| 160 | + ) |
150 | 161 | ) |
151 | 162 | ) |
0 commit comments