mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-04-27 19:09:47 +03:00
ad7a028228
This PR enables all incremental tests under the `test/incremental` directory, except one: `change_exports`, which is currently ignored as it requires a non-trivial amount of work on the linker, since we do not currently support exporting data symbols. To enable the other tests, the following fixes were needed: 1. `src/link/Wasm.zig`: instead of chasing function type through Nav, get it directly. 2. `src/target.zig`: `.panic_fn` appears to work fine with the wasm backend. 3. `src/codegen/wasm/CodeGen.zig`: there was a liveness related bug that caused some `ArenaAllocator` code to crash the backend. More info on (3), the liveness and local reuse code in the backend for years in unfinished state. For example there is currently no branch merging and reuse happens only when inst die in same block level. I initially considered doing a large refactor to implement everything correctly, but aborted due to its sheer size and currently! no clear idea about how to do this efficiently. Instead, I fixed the bug with minimal changes and removed useless code, keeping the old solution otherwise intact.
42 lines
1.0 KiB
Plaintext
42 lines
1.0 KiB
Plaintext
#target=x86_64-linux-selfhosted
|
|
#target=x86_64-windows-selfhosted
|
|
#target=x86_64-linux-cbe
|
|
#target=x86_64-windows-cbe
|
|
#target=x86_64-linux-llvm
|
|
#target=wasm32-wasi-selfhosted
|
|
#update=non-inline version
|
|
#file=main.zig
|
|
pub fn main() !void {
|
|
try foo();
|
|
}
|
|
fn foo() !void {
|
|
try std.Io.File.stdout().writeStreamingAll(io, "Hello, World!\n");
|
|
}
|
|
const std = @import("std");
|
|
const io = std.Io.Threaded.global_single_threaded.io();
|
|
#expect_stdout="Hello, World!\n"
|
|
|
|
#update=make function inline
|
|
#file=main.zig
|
|
pub fn main() !void {
|
|
try foo();
|
|
}
|
|
inline fn foo() !void {
|
|
try std.Io.File.stdout().writeStreamingAll(io, "Hello, World!\n");
|
|
}
|
|
const std = @import("std");
|
|
const io = std.Io.Threaded.global_single_threaded.io();
|
|
#expect_stdout="Hello, World!\n"
|
|
|
|
#update=change string
|
|
#file=main.zig
|
|
pub fn main() !void {
|
|
try foo();
|
|
}
|
|
inline fn foo() !void {
|
|
try std.Io.File.stdout().writeStreamingAll(io, "Hello, `inline` World!\n");
|
|
}
|
|
const std = @import("std");
|
|
const io = std.Io.Threaded.global_single_threaded.io();
|
|
#expect_stdout="Hello, `inline` World!\n"
|