| author | |
| committer | |
| log | fc4fbfe8e1689417da8130f02045e5cc9e120a1a |
| tree | 2c510c98859ae5d67c279b1d00d3fb6b6c35a7e9 |
| parent | 7e17cbbda5de49759f7b130320578ed96b3810a1 |
15 files changed, 278 insertions(+), 272 deletions(-)
test/cases.zig-1| ... | @@ -10,7 +10,6 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -10,7 +10,6 @@ pub fn addCases(ctx: *TestContext) !void { |
| 10 | try @import("compile_errors.zig").addCases(ctx); | 10 | try @import("compile_errors.zig").addCases(ctx); |
| 11 | try @import("stage2/cbe.zig").addCases(ctx); | 11 | try @import("stage2/cbe.zig").addCases(ctx); |
| 12 | try @import("stage2/arm.zig").addCases(ctx); | 12 | try @import("stage2/arm.zig").addCases(ctx); |
| 13 | try @import("stage2/aarch64.zig").addCases(ctx); | ||
| 14 | try @import("stage2/llvm.zig").addCases(ctx); | 13 | try @import("stage2/llvm.zig").addCases(ctx); |
| 15 | try @import("stage2/plan9.zig").addCases(ctx); | 14 | try @import("stage2/plan9.zig").addCases(ctx); |
| 16 | try @import("stage2/x86_64.zig").addCases(ctx); | 15 | try @import("stage2/x86_64.zig").addCases(ctx); |
test/incremental/aarch64-linux/conditional_branches.0.zig created+26| ... | @@ -0,0 +1,26 @@ | ||
| 1 | pub fn main() void { | ||
| 2 | foo(123); | ||
| 3 | } | ||
| 4 | |||
| 5 | fn foo(x: u64) void { | ||
| 6 | if (x > 42) { | ||
| 7 | print(); | ||
| 8 | } | ||
| 9 | } | ||
| 10 | |||
| 11 | fn print() void { | ||
| 12 | asm volatile ("svc #0" | ||
| 13 | : | ||
| 14 | : [number] "{x8}" (64), | ||
| 15 | [arg1] "{x0}" (1), | ||
| 16 | [arg2] "{x1}" (@ptrToInt("Hello, World!\n")), | ||
| 17 | [arg3] "{x2}" ("Hello, World!\n".len), | ||
| 18 | : "memory", "cc" | ||
| 19 | ); | ||
| 20 | } | ||
| 21 | |||
| 22 | // run | ||
| 23 | // target=aarch64-linux | ||
| 24 | // | ||
| 25 | // Hello, World! | ||
| 26 | // | ||
test/incremental/aarch64-linux/conditional_branches.1.zig created+25| ... | @@ -0,0 +1,25 @@ | ||
| 1 | pub fn main() void { | ||
| 2 | foo(true); | ||
| 3 | } | ||
| 4 | |||
| 5 | fn foo(x: bool) void { | ||
| 6 | if (x) { | ||
| 7 | print(); | ||
| 8 | } | ||
| 9 | } | ||
| 10 | |||
| 11 | fn print() void { | ||
| 12 | asm volatile ("svc #0" | ||
| 13 | : | ||
| 14 | : [number] "{x8}" (64), | ||
| 15 | [arg1] "{x0}" (1), | ||
| 16 | [arg2] "{x1}" (@ptrToInt("Hello, World!\n")), | ||
| 17 | [arg3] "{x2}" ("Hello, World!\n".len), | ||
| 18 | : "memory", "cc" | ||
| 19 | ); | ||
| 20 | } | ||
| 21 | |||
| 22 | // run | ||
| 23 | // | ||
| 24 | // Hello, World! | ||
| 25 | // | ||
test/incremental/aarch64-linux/hello_world_with_updates.0.zig created+31| ... | @@ -0,0 +1,31 @@ | ||
| 1 | pub export fn _start() noreturn { | ||
| 2 | print(); | ||
| 3 | exit(0); | ||
| 4 | } | ||
| 5 | |||
| 6 | fn print() void { | ||
| 7 | asm volatile ("svc #0" | ||
| 8 | : | ||
| 9 | : [number] "{x8}" (64), | ||
| 10 | [arg1] "{x0}" (1), | ||
| 11 | [arg2] "{x1}" (@ptrToInt("Hello, World!\n")), | ||
| 12 | [arg3] "{x2}" ("Hello, World!\n".len), | ||
| 13 | : "memory", "cc" | ||
| 14 | ); | ||
| 15 | } | ||
| 16 | |||
| 17 | fn exit(ret: usize) noreturn { | ||
| 18 | asm volatile ("svc #0" | ||
| 19 | : | ||
| 20 | : [number] "{x8}" (93), | ||
| 21 | [arg1] "{x0}" (ret), | ||
| 22 | : "memory", "cc" | ||
| 23 | ); | ||
| 24 | unreachable; | ||
| 25 | } | ||
| 26 | |||
| 27 | // run | ||
| 28 | // target=aarch64-linux | ||
| 29 | // | ||
| 30 | // Hello, World! | ||
| 31 | // | ||
test/incremental/aarch64-linux/hello_world_with_updates.1.zig created+36| ... | @@ -0,0 +1,36 @@ | ||
| 1 | pub export fn _start() noreturn { | ||
| 2 | print(); | ||
| 3 | print(); | ||
| 4 | print(); | ||
| 5 | print(); | ||
| 6 | exit(0); | ||
| 7 | } | ||
| 8 | |||
| 9 | fn print() void { | ||
| 10 | asm volatile ("svc #0" | ||
| 11 | : | ||
| 12 | : [number] "{x8}" (64), | ||
| 13 | [arg1] "{x0}" (1), | ||
| 14 | [arg2] "{x1}" (@ptrToInt("Hello, World!\n")), | ||
| 15 | [arg3] "{x2}" ("Hello, World!\n".len), | ||
| 16 | : "memory", "cc" | ||
| 17 | ); | ||
| 18 | } | ||
| 19 | |||
| 20 | fn exit(ret: usize) noreturn { | ||
| 21 | asm volatile ("svc #0" | ||
| 22 | : | ||
| 23 | : [number] "{x8}" (93), | ||
| 24 | [arg1] "{x0}" (ret), | ||
| 25 | : "memory", "cc" | ||
| 26 | ); | ||
| 27 | unreachable; | ||
| 28 | } | ||
| 29 | |||
| 30 | // run | ||
| 31 | // | ||
| 32 | // Hello, World! | ||
| 33 | // Hello, World! | ||
| 34 | // Hello, World! | ||
| 35 | // Hello, World! | ||
| 36 | // | ||
test/incremental/aarch64-linux/hello_world_with_updates.2.zig created+21| ... | @@ -0,0 +1,21 @@ | ||
| 1 | pub fn main() void { | ||
| 2 | print(); | ||
| 3 | print(); | ||
| 4 | } | ||
| 5 | |||
| 6 | fn print() void { | ||
| 7 | asm volatile ("svc #0" | ||
| 8 | : | ||
| 9 | : [number] "{x8}" (64), | ||
| 10 | [arg1] "{x0}" (1), | ||
| 11 | [arg2] "{x1}" (@ptrToInt("Hello, World!\n")), | ||
| 12 | [arg3] "{x2}" ("Hello, World!\n".len), | ||
| 13 | : "memory", "cc" | ||
| 14 | ); | ||
| 15 | } | ||
| 16 | |||
| 17 | // run | ||
| 18 | // | ||
| 19 | // Hello, World! | ||
| 20 | // Hello, World! | ||
| 21 | // | ||
test/incremental/aarch64-macos/hello_world_with_updates.0.zig created+5| ... | @@ -0,0 +1,5 @@ | ||
| 1 | // error | ||
| 2 | // output_mode=Exe | ||
| 3 | // target=aarch64-macos | ||
| 4 | // | ||
| 5 | // :109:9: error: struct 'tmp.tmp' has no member named 'main' | ||
test/incremental/aarch64-macos/hello_world_with_updates.1.zig created+5| ... | @@ -0,0 +1,5 @@ | ||
| 1 | pub export fn main() noreturn {} | ||
| 2 | |||
| 3 | // error | ||
| 4 | // | ||
| 5 | // :1:32: error: expected noreturn, found void | ||
test/incremental/aarch64-macos/hello_world_with_updates.2.zig created+19| ... | @@ -0,0 +1,19 @@ | ||
| 1 | extern "c" fn write(usize, usize, usize) usize; | ||
| 2 | extern "c" fn exit(usize) noreturn; | ||
| 3 | |||
| 4 | pub export fn main() noreturn { | ||
| 5 | print(); | ||
| 6 | |||
| 7 | exit(0); | ||
| 8 | } | ||
| 9 | |||
| 10 | fn print() void { | ||
| 11 | const msg = @ptrToInt("Hello, World!\n"); | ||
| 12 | const len = 14; | ||
| 13 | _ = write(1, msg, len); | ||
| 14 | } | ||
| 15 | |||
| 16 | // run | ||
| 17 | // | ||
| 18 | // Hello, World! | ||
| 19 | // | ||
test/incremental/aarch64-macos/hello_world_with_updates.3.zig created+16| ... | @@ -0,0 +1,16 @@ | ||
| 1 | extern "c" fn write(usize, usize, usize) usize; | ||
| 2 | |||
| 3 | pub fn main() void { | ||
| 4 | print(); | ||
| 5 | } | ||
| 6 | |||
| 7 | fn print() void { | ||
| 8 | const msg = @ptrToInt("Hello, World!\n"); | ||
| 9 | const len = 14; | ||
| 10 | _ = write(1, msg, len); | ||
| 11 | } | ||
| 12 | |||
| 13 | // run | ||
| 14 | // | ||
| 15 | // Hello, World! | ||
| 16 | // | ||
test/incremental/aarch64-macos/hello_world_with_updates.4.zig created+22| ... | @@ -0,0 +1,22 @@ | ||
| 1 | extern "c" fn write(usize, usize, usize) usize; | ||
| 2 | |||
| 3 | pub fn main() void { | ||
| 4 | print(); | ||
| 5 | print(); | ||
| 6 | print(); | ||
| 7 | print(); | ||
| 8 | } | ||
| 9 | |||
| 10 | fn print() void { | ||
| 11 | const msg = @ptrToInt("Hello, World!\n"); | ||
| 12 | const len = 14; | ||
| 13 | _ = write(1, msg, len); | ||
| 14 | } | ||
| 15 | |||
| 16 | // run | ||
| 17 | // | ||
| 18 | // Hello, World! | ||
| 19 | // Hello, World! | ||
| 20 | // Hello, World! | ||
| 21 | // Hello, World! | ||
| 22 | // | ||
test/incremental/aarch64-macos/hello_world_with_updates.5.zig created+16| ... | @@ -0,0 +1,16 @@ | ||
| 1 | extern "c" fn write(usize, usize, usize) usize; | ||
| 2 | |||
| 3 | pub fn main() void { | ||
| 4 | print(); | ||
| 5 | } | ||
| 6 | |||
| 7 | fn print() void { | ||
| 8 | const msg = @ptrToInt("What is up? This is a longer message that will force the data to be relocated in virtual address space.\n"); | ||
| 9 | const len = 104; | ||
| 10 | _ = write(1, msg, len); | ||
| 11 | } | ||
| 12 | |||
| 13 | // run | ||
| 14 | // | ||
| 15 | // What is up? This is a longer message that will force the data to be relocated in virtual address space. | ||
| 16 | // | ||
test/incremental/aarch64-macos/hello_world_with_updates.6.zig created+18| ... | @@ -0,0 +1,18 @@ | ||
| 1 | extern "c" fn write(usize, usize, usize) usize; | ||
| 2 | |||
| 3 | pub fn main() void { | ||
| 4 | print(); | ||
| 5 | print(); | ||
| 6 | } | ||
| 7 | |||
| 8 | fn print() void { | ||
| 9 | const msg = @ptrToInt("What is up? This is a longer message that will force the data to be relocated in virtual address space.\n"); | ||
| 10 | const len = 104; | ||
| 11 | _ = write(1, msg, len); | ||
| 12 | } | ||
| 13 | |||
| 14 | // run | ||
| 15 | // | ||
| 16 | // What is up? This is a longer message that will force the data to be relocated in virtual address space. | ||
| 17 | // What is up? This is a longer message that will force the data to be relocated in virtual address space. | ||
| 18 | // | ||
test/incremental/large_add_function.zig created+38| ... | @@ -0,0 +1,38 @@ | ||
| 1 | pub fn main() void { | ||
| 2 | assert(add(3, 4) == 791); | ||
| 3 | } | ||
| 4 | |||
| 5 | fn add(a: u32, b: u32) u32 { | ||
| 6 | const x: u32 = blk: { | ||
| 7 | const c = a + b; // 7 | ||
| 8 | const d = a + c; // 10 | ||
| 9 | const e = d + b; // 14 | ||
| 10 | const f = d + e; // 24 | ||
| 11 | const g = e + f; // 38 | ||
| 12 | const h = f + g; // 62 | ||
| 13 | const i = g + h; // 100 | ||
| 14 | const j = i + d; // 110 | ||
| 15 | const k = i + j; // 210 | ||
| 16 | const l = k + c; // 217 | ||
| 17 | const m = l + d; // 227 | ||
| 18 | const n = m + e; // 241 | ||
| 19 | const o = n + f; // 265 | ||
| 20 | const p = o + g; // 303 | ||
| 21 | const q = p + h; // 365 | ||
| 22 | const r = q + i; // 465 | ||
| 23 | const s = r + j; // 575 | ||
| 24 | const t = s + k; // 785 | ||
| 25 | break :blk t; | ||
| 26 | }; | ||
| 27 | const y = x + a; // 788 | ||
| 28 | const z = y + a; // 791 | ||
| 29 | return z; | ||
| 30 | } | ||
| 31 | |||
| 32 | fn assert(ok: bool) void { | ||
| 33 | if (!ok) unreachable; | ||
| 34 | } | ||
| 35 | |||
| 36 | // run | ||
| 37 | // target=aarch64-linux,aarch64-macos | ||
| 38 | // | ||
test/stage2/aarch64.zig deleted-271| ... | @@ -1,271 +0,0 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | const CrossTarget = std.zig.CrossTarget; | ||
| 3 | const TestContext = @import("../../src/test.zig").TestContext; | ||
| 4 | |||
| 5 | const linux_aarch64 = CrossTarget{ | ||
| 6 | .cpu_arch = .aarch64, | ||
| 7 | .os_tag = .linux, | ||
| 8 | }; | ||
| 9 | const macos_aarch64 = CrossTarget{ | ||
| 10 | .cpu_arch = .aarch64, | ||
| 11 | .os_tag = .macos, | ||
| 12 | }; | ||
| 13 | |||
| 14 | pub fn addCases(ctx: *TestContext) !void { | ||
| 15 | // Linux tests | ||
| 16 | { | ||
| 17 | var case = ctx.exe("linux_aarch64 hello world", linux_aarch64); | ||
| 18 | // Regular old hello world | ||
| 19 | case.addCompareOutput( | ||
| 20 | \\pub fn main() void { | ||
| 21 | \\ print(); | ||
| 22 | \\} | ||
| 23 | \\ | ||
| 24 | \\fn print() void { | ||
| 25 | \\ asm volatile ("svc #0" | ||
| 26 | \\ : | ||
| 27 | \\ : [number] "{x8}" (64), | ||
| 28 | \\ [arg1] "{x0}" (1), | ||
| 29 | \\ [arg2] "{x1}" (@ptrToInt("Hello, World!\n")), | ||
| 30 | \\ [arg3] "{x2}" ("Hello, World!\n".len) | ||
| 31 | \\ : "memory", "cc" | ||
| 32 | \\ ); | ||
| 33 | \\} | ||
| 34 | , | ||
| 35 | "Hello, World!\n", | ||
| 36 | ); | ||
| 37 | } | ||
| 38 | |||
| 39 | { | ||
| 40 | var case = ctx.exe("exit fn taking argument", linux_aarch64); | ||
| 41 | |||
| 42 | case.addCompareOutput( | ||
| 43 | \\pub export fn _start() noreturn { | ||
| 44 | \\ exit(0); | ||
| 45 | \\} | ||
| 46 | \\ | ||
| 47 | \\fn exit(ret: usize) noreturn { | ||
| 48 | \\ asm volatile ("svc #0" | ||
| 49 | \\ : | ||
| 50 | \\ : [number] "{x8}" (93), | ||
| 51 | \\ [arg1] "{x0}" (ret) | ||
| 52 | \\ : "memory", "cc" | ||
| 53 | \\ ); | ||
| 54 | \\ unreachable; | ||
| 55 | \\} | ||
| 56 | , | ||
| 57 | "", | ||
| 58 | ); | ||
| 59 | } | ||
| 60 | |||
| 61 | { | ||
| 62 | var case = ctx.exe("conditional branches", linux_aarch64); | ||
| 63 | |||
| 64 | case.addCompareOutput( | ||
| 65 | \\pub fn main() void { | ||
| 66 | \\ foo(123); | ||
| 67 | \\} | ||
| 68 | \\ | ||
| 69 | \\fn foo(x: u64) void { | ||
| 70 | \\ if (x > 42) { | ||
| 71 | \\ print(); | ||
| 72 | \\ } | ||
| 73 | \\} | ||
| 74 | \\ | ||
| 75 | \\fn print() void { | ||
| 76 | \\ asm volatile ("svc #0" | ||
| 77 | \\ : | ||
| 78 | \\ : [number] "{x8}" (64), | ||
| 79 | \\ [arg1] "{x0}" (1), | ||
| 80 | \\ [arg2] "{x1}" (@ptrToInt("Hello, World!\n")), | ||
| 81 | \\ [arg3] "{x2}" ("Hello, World!\n".len), | ||
| 82 | \\ : "memory", "cc" | ||
| 83 | \\ ); | ||
| 84 | \\} | ||
| 85 | , | ||
| 86 | "Hello, World!\n", | ||
| 87 | ); | ||
| 88 | |||
| 89 | case.addCompareOutput( | ||
| 90 | \\pub fn main() void { | ||
| 91 | \\ foo(true); | ||
| 92 | \\} | ||
| 93 | \\ | ||
| 94 | \\fn foo(x: bool) void { | ||
| 95 | \\ if (x) { | ||
| 96 | \\ print(); | ||
| 97 | \\ } | ||
| 98 | \\} | ||
| 99 | \\ | ||
| 100 | \\fn print() void { | ||
| 101 | \\ asm volatile ("svc #0" | ||
| 102 | \\ : | ||
| 103 | \\ : [number] "{x8}" (64), | ||
| 104 | \\ [arg1] "{x0}" (1), | ||
| 105 | \\ [arg2] "{x1}" (@ptrToInt("Hello, World!\n")), | ||
| 106 | \\ [arg3] "{x2}" ("Hello, World!\n".len), | ||
| 107 | \\ : "memory", "cc" | ||
| 108 | \\ ); | ||
| 109 | \\} | ||
| 110 | , | ||
| 111 | "Hello, World!\n", | ||
| 112 | ); | ||
| 113 | } | ||
| 114 | |||
| 115 | { | ||
| 116 | var case = ctx.exe("large add function", linux_aarch64); | ||
| 117 | |||
| 118 | case.addCompareOutput( | ||
| 119 | \\pub fn main() void { | ||
| 120 | \\ assert(add(3, 4) == 791); | ||
| 121 | \\} | ||
| 122 | \\ | ||
| 123 | \\fn add(a: u32, b: u32) u32 { | ||
| 124 | \\ const x: u32 = blk: { | ||
| 125 | \\ const c = a + b; // 7 | ||
| 126 | \\ const d = a + c; // 10 | ||
| 127 | \\ const e = d + b; // 14 | ||
| 128 | \\ const f = d + e; // 24 | ||
| 129 | \\ const g = e + f; // 38 | ||
| 130 | \\ const h = f + g; // 62 | ||
| 131 | \\ const i = g + h; // 100 | ||
| 132 | \\ const j = i + d; // 110 | ||
| 133 | \\ const k = i + j; // 210 | ||
| 134 | \\ const l = k + c; // 217 | ||
| 135 | \\ const m = l + d; // 227 | ||
| 136 | \\ const n = m + e; // 241 | ||
| 137 | \\ const o = n + f; // 265 | ||
| 138 | \\ const p = o + g; // 303 | ||
| 139 | \\ const q = p + h; // 365 | ||
| 140 | \\ const r = q + i; // 465 | ||
| 141 | \\ const s = r + j; // 575 | ||
| 142 | \\ const t = s + k; // 785 | ||
| 143 | \\ break :blk t; | ||
| 144 | \\ }; | ||
| 145 | \\ const y = x + a; // 788 | ||
| 146 | \\ const z = y + a; // 791 | ||
| 147 | \\ return z; | ||
| 148 | \\} | ||
| 149 | \\ | ||
| 150 | \\fn assert(ok: bool) void { | ||
| 151 | \\ if (!ok) unreachable; | ||
| 152 | \\} | ||
| 153 | , | ||
| 154 | "", | ||
| 155 | ); | ||
| 156 | } | ||
| 157 | |||
| 158 | // macOS tests | ||
| 159 | { | ||
| 160 | var case = ctx.exe("hello world with updates", macos_aarch64); | ||
| 161 | case.addError("", &[_][]const u8{ | ||
| 162 | ":109:9: error: struct 'tmp.tmp' has no member named 'main'", | ||
| 163 | }); | ||
| 164 | |||
| 165 | // Incorrect return type | ||
| 166 | case.addError( | ||
| 167 | \\pub export fn main() noreturn { | ||
| 168 | \\} | ||
| 169 | , &[_][]const u8{ | ||
| 170 | ":2:1: error: expected noreturn, found void", | ||
| 171 | }); | ||
| 172 | |||
| 173 | // Regular old hello world | ||
| 174 | case.addCompareOutput( | ||
| 175 | \\extern "c" fn write(usize, usize, usize) usize; | ||
| 176 | \\extern "c" fn exit(usize) noreturn; | ||
| 177 | \\ | ||
| 178 | \\pub export fn main() noreturn { | ||
| 179 | \\ print(); | ||
| 180 | \\ | ||
| 181 | \\ exit(0); | ||
| 182 | \\} | ||
| 183 | \\ | ||
| 184 | \\fn print() void { | ||
| 185 | \\ const msg = @ptrToInt("Hello, World!\n"); | ||
| 186 | \\ const len = 14; | ||
| 187 | \\ _ = write(1, msg, len); | ||
| 188 | \\} | ||
| 189 | , | ||
| 190 | "Hello, World!\n", | ||
| 191 | ); | ||
| 192 | |||
| 193 | // Now using start.zig without an explicit extern exit fn | ||
| 194 | case.addCompareOutput( | ||
| 195 | \\extern "c" fn write(usize, usize, usize) usize; | ||
| 196 | \\ | ||
| 197 | \\pub fn main() void { | ||
| 198 | \\ print(); | ||
| 199 | \\} | ||
| 200 | \\ | ||
| 201 | \\fn print() void { | ||
| 202 | \\ const msg = @ptrToInt("Hello, World!\n"); | ||
| 203 | \\ const len = 14; | ||
| 204 | \\ _ = write(1, msg, len); | ||
| 205 | \\} | ||
| 206 | , | ||
| 207 | "Hello, World!\n", | ||
| 208 | ); | ||
| 209 | |||
| 210 | // Print it 4 times and force growth and realloc. | ||
| 211 | case.addCompareOutput( | ||
| 212 | \\extern "c" fn write(usize, usize, usize) usize; | ||
| 213 | \\ | ||
| 214 | \\pub fn main() void { | ||
| 215 | \\ print(); | ||
| 216 | \\ print(); | ||
| 217 | \\ print(); | ||
| 218 | \\ print(); | ||
| 219 | \\} | ||
| 220 | \\ | ||
| 221 | \\fn print() void { | ||
| 222 | \\ const msg = @ptrToInt("Hello, World!\n"); | ||
| 223 | \\ const len = 14; | ||
| 224 | \\ _ = write(1, msg, len); | ||
| 225 | \\} | ||
| 226 | , | ||
| 227 | \\Hello, World! | ||
| 228 | \\Hello, World! | ||
| 229 | \\Hello, World! | ||
| 230 | \\Hello, World! | ||
| 231 | \\ | ||
| 232 | ); | ||
| 233 | |||
| 234 | // Print it once, and change the message. | ||
| 235 | case.addCompareOutput( | ||
| 236 | \\extern "c" fn write(usize, usize, usize) usize; | ||
| 237 | \\ | ||
| 238 | \\pub fn main() void { | ||
| 239 | \\ print(); | ||
| 240 | \\} | ||
| 241 | \\ | ||
| 242 | \\fn print() void { | ||
| 243 | \\ const msg = @ptrToInt("What is up? This is a longer message that will force the data to be relocated in virtual address space.\n"); | ||
| 244 | \\ const len = 104; | ||
| 245 | \\ _ = write(1, msg, len); | ||
| 246 | \\} | ||
| 247 | , | ||
| 248 | "What is up? This is a longer message that will force the data to be relocated in virtual address space.\n", | ||
| 249 | ); | ||
| 250 | |||
| 251 | // Now we print it twice. | ||
| 252 | case.addCompareOutput( | ||
| 253 | \\extern "c" fn write(usize, usize, usize) usize; | ||
| 254 | \\ | ||
| 255 | \\pub fn main() void { | ||
| 256 | \\ print(); | ||
| 257 | \\ print(); | ||
| 258 | \\} | ||
| 259 | \\ | ||
| 260 | \\fn print() void { | ||
| 261 | \\ const msg = @ptrToInt("What is up? This is a longer message that will force the data to be relocated in virtual address space.\n"); | ||
| 262 | \\ const len = 104; | ||
| 263 | \\ _ = write(1, msg, len); | ||
| 264 | \\} | ||
| 265 | , | ||
| 266 | \\What is up? This is a longer message that will force the data to be relocated in virtual address space. | ||
| 267 | \\What is up? This is a longer message that will force the data to be relocated in virtual address space. | ||
| 268 | \\ | ||
| 269 | ); | ||
| 270 | } | ||
| 271 | } | ||