()
| 198 | #[test] |
| 199 | fn regalloc_pointers_structs_and_arrays() { |
| 200 | assert_equivalent( |
| 201 | r#" |
| 202 | external free: (p: i64*) -> void |
| 203 | |
| 204 | struct Point { |
| 205 | x: i64, |
| 206 | y: i64, |
| 207 | } |
| 208 | |
| 209 | sum_buffer: (buf: i64*, len: i64) -> i64 { |
| 210 | total: i64 = 0 |
| 211 | i: i64 = 0 |
| 212 | while i < len { |
| 213 | total = total + buf[i] |
| 214 | i = i + 1 |
| 215 | } |
| 216 | return total |
| 217 | } |
| 218 | |
| 219 | main: () -> i32 { |
| 220 | p: Point = { .x = 17 as i64, .y = 25 as i64 } |
| 221 | arr: i64[4] = [1 as i64, 2 as i64, 3 as i64, 4 as i64] |
| 222 | local: i64 = arr[0] + arr[1] + arr[2] + arr[3] |
| 223 | buf: i64* = new(i64, 4) |
| 224 | i: i64 = 0 |
| 225 | while i < 4 { |
| 226 | buf[i] = i * 10 |
| 227 | i = i + 1 |
| 228 | } |
| 229 | s: i64 = sum_buffer(buf, 4) |
| 230 | free(buf) |
| 231 | return (p.x + p.y + local + s) as i32 |
| 232 | } |
| 233 | "#, |
| 234 | ); |
| 235 | } |
| 236 | |
| 237 | #[test] |
| 238 | fn regalloc_mixed_float_and_int() { |
| 239 | // Floats stay slot-based while their integer neighbors are allocated; the |
nothing calls this directly
no test coverage detected