Commit Graph

36130 Commits

Author SHA1 Message Date
pentuppup c2aeef04e5 sema: remove special case check in is_non_err 2025-12-08 14:59:55 +01:00
Alex Rønne Petersen 5d96a58f1d build: bump test-compiler-rt max_rss to 868_445_388 on x86_64-linux 2025-12-07 11:28:06 +01:00
Pavel Verigo bf58a3bc08 stage2_wasm: revival, enabling tests 2025-12-07 07:21:15 +01:00
Pavel Verigo cc099afca5 sema: fix error_return_trace_index handling in zirCondBr 2025-12-07 07:20:59 +01:00
Alex Rønne Petersen a21d9408a3 build: bump test-zigc max_rss to 871_883_161 on x86_64-linux 2025-12-07 04:04:06 +01:00
Matthew Lugg b5ff96b4d2 std.heap: remove raw_c_allocator
After https://codeberg.org/ziglang/zig/pulls/30103, `raw_c_allocator` is
redundant. It existed to avoid overhead when you could assert that all
of your `Allocator` usage was going to be compatible with the C `malloc`
API, but the standard `c_allocator` is now able to avoid that overhead
*in the case* that your usage is compatible (and use the less efficient
path in the rare case where it's not), so there's no need for the raw
version anymore. Leaving it in `std.heap` at this point seems like it
would just be a footgun.
2025-12-06 22:08:40 +01:00
Matthew Lugg db15df5daa build_runner: don't dim the tree line of reused step
This was presumably unintentional, as the old behavior looked quite odd
when you noticed it. All of the line-drawing characters ought to be the
same color; only the step name/status is dimmed when a step is "reused"
(i.e. appears multiple times in the tree).
2025-12-06 14:22:47 +00:00
Matthew Lugg 65922a2d43 std: make stack unwinding faster on macOS
https://github.com/ziglang/zig/issues/26027#issuecomment-3571227050
tracked some bad performance in `DebugAllocator` on macOS down to a
function in dyld which `std.debug.SelfInfo` was calling into. It turns
out `dladdr`'s symbol lookup logic is horrendously slow (looking at its
source code, it appears to be doing a *linear scan* over all symbols in
the image?!). However, we don't actually need the symbol, so we want to
try and avoid this logic.

Luckily, dyld has more precise APIs for what we need! Unluckily, Apple,
in their infinite wisdom, decided they should be deprecated in favour of
`dladdr`, despite the latter being several times slower (and by "several
times", I have measured a 50x slowdown on repeated calls to `dladdr`
compared to the other API). But luckily again, the deprecated APIs are
still exposed.

So, after a careful analysis of the situation (reading dyld code and
cursing Apple engineers), I think it makes sense to just use these
deprecated APIs for now. If they ever go away, we can write our own
cache for this data to bypass Apple's awfully slow code, but I suspect
these functions will stick around for the foreseeable future.

Uh, and if `_dyld_get_image_header_containing_address` goes away,
there's also `dyld_image_header_containing_address`, which is a
seemingly identical function, exported by dyld just the same, but with a
separate (functionally identical) implementation, and not documented in
the public header file. Apple work in mysterious ways, I guess.
2025-12-06 10:41:42 +00:00
Alex Rønne Petersen 621e1d7b1e Compilation: fix appendFileSystemInput race between main thread and C object workers
Co-authored-by: Matthew Lugg <mlugg@mlugg.co.uk>
2025-12-06 09:54:43 +01:00
pentuppup 28c5cc390c detect comptime var references in asm input/output and improve errors 2025-12-06 09:42:51 +01:00
mlugg dbb4c8d151 Merge pull request 'Remove things deprecated during the 0.15 release cycle' (#30018) from linus/zig:remove-deprecated-stuff into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/30018
2025-12-06 08:51:15 +01:00
Alex Rønne Petersen d41c16930d Merge pull request 'link: support --dependency-file linker option' (#30073) from alexrp/zig:elf-depfile into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/30073
Reviewed-by: mlugg <mlugg@noreply.codeberg.org>
2025-12-06 08:32:25 +01:00
Alex Rønne Petersen 1e616096d4 build: bump test-zigc max_rss to 767_483_904 on x86_64-linux 2025-12-06 01:51:01 +01:00
Matthew Lugg 4ce7b57e86 std.heap: rework c_allocator
The main goal here was to avoid allocating padding and header space if
`malloc` already guarantees the alignment we need via `max_align_t`.
Previously, the compiler was using `std.heap.raw_c_allocator` as its GPA
in some cases depending on `std.c.max_align_t`, but that's pretty
fragile (it meant we had to encode our alignment requirements into
`src/main.zig`!). Perhaps more importantly, that solution is
unnecessarily restrictive: since Zig's `Allocator` API passes the
`Alignment` not only to `alloc`, but also to `free` etc, we are able to
use a different strategy depending on its value. So `c_allocator` can
simply compare the requested align to `Alignment.of(std.c.max_align_t)`,
and use a raw `malloc` call (no header needed!) if it will guarantee a
suitable alignment (which, in practice, will be true the vast majority
of the time).

So in short, this makes `std.heap.c_allocator` more memory efficient,
and probably removes any incentive to use `std.heap.raw_c_allocator`.

I also refactored the `c_allocator` implementation while doing this,
just to neaten things up a little.
2025-12-06 00:16:33 +01:00
Matthew Lugg ea94ac52c5 std.debug: skip manage resources correctly with cbe 2025-12-05 15:10:58 +01:00
Aidan Welch 032e3c9254 std.Io.Timestamp: when creating a Clock.Timestamp actually set .raw instead of the non-existant .nanoseconds 2025-12-05 14:14:01 +01:00
Luna Schwalbe adc5a39de2 Change github links to codeberg 2025-12-05 14:12:39 +01:00
Loris Cro 58e3c2cefd make Io.net.sendMany compile 2025-12-05 11:50:04 +01:00
Alex Rønne Petersen d22231c039 Compilation: track indirect file system inputs from clang's depfile
Co-authored-by: Matthew Lugg <mlugg@mlugg.co.uk>
2025-12-05 11:22:10 +01:00
Alex Rønne Petersen 38415911c1 compiler: handle -Xlinker args similarly to -Wl args 2025-12-05 11:04:51 +01:00
Alex Rønne Petersen 34f88722cd compiler: support --dependency-file linker option
closes https://github.com/ziglang/zig/issues/22213
2025-12-05 11:04:48 +01:00
Alex Rønne Petersen 4724774433 ci: apply workaround for #22213 to x86_64-linux scripts
This should be reverted on the next CI tarballs update.
2025-12-05 07:32:43 +01:00
Alex Rønne Petersen c166bb36f6 ci: reduce x86_64-linux timeouts
These excessive timeouts should no longer be necessary with the recent tuning of
job capacity and maxrss on these machines.
2025-12-04 20:52:34 +01:00
Alex Rønne Petersen 78cba86928 ci: set maxrss from $ZSF_MAX_RSS if provided by the runner
All of our runners now define this. When running a CI script locally, this will
not be set, so we default to 0, aka "all available system memory".
2025-12-04 20:06:48 +01:00
Alex Rønne Petersen 2728eb5d5e build: adjust max_rss on a per-CI-host basis
This avoids pessimizing concurrency on all machines due to e.g. the macOS
machine having high memory usage across the board due to 16K page size.

This also adds max_rss to test-unit and test-c-abi since those tend to eat a
decent chunk of memory too.
2025-12-04 20:06:12 +01:00
Alex Rønne Petersen 44543800a5 std.process.Child: enable rusage collection for dragonfly, netbsd, openbsd 2025-12-04 03:46:36 +01:00
Alex Rønne Petersen 2659fadb95 std.c: add rusage for dragonfly, netbsd, openbsd 2025-12-04 03:46:36 +01:00
Alex Rønne Petersen 9eed87f93e std.process.Child: enable rusage collection for freebsd, illumos, serenity 2025-12-04 03:46:36 +01:00
Alex Rønne Petersen e270c97ed1 ci: don't skip release mode tests on x86_64-windows-debug
pulsar is much faster than george so we don't need to do this anymore.
2025-12-04 03:46:36 +01:00
Alex Rønne Petersen c21ce53494 ci: skip spirv and wasm tests on x86_64-freebsd
These are already built and run on x86_64-linux.
2025-12-04 03:46:36 +01:00
Alex Rønne Petersen e2a9e568b4 build: add -Dskip-spirv and -Dskip-wasm options 2025-12-04 03:46:35 +01:00
Alex Rønne Petersen ad9a5187ac build: add some missing darwin tags 2025-12-04 03:46:35 +01:00
jedisct1 d73fbcc3ae Merge pull request 'Argon2: use the std.Io interface' (#30084) from jedisct1/zig:argon2 into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/30084
2025-12-03 12:18:09 +01:00
Zihad cb115cf73a std.process.ArgIteratorWasi: fix no-args deinit 2025-12-03 08:35:24 +01:00
Alex Rønne Petersen be9649f4ea ci: set a sensible maxrss in x86_64-windows scripts 2025-12-03 00:24:58 +01:00
Frank Denis 6fe95c28cf Argon2: use the std.Io interface
Also reduce the memory required by tests.

4GB for every test is way too much and doesn't provide much benefits
in testing the algorithms.
2025-12-02 23:03:52 +01:00
Andrew Kelley 52ad126bb4 Merge pull request 'std.Io.Threaded: rework cancellation' (#30033) from cancellation into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/30033
2025-12-02 17:58:29 +01:00
Andrew Kelley bb3f56d5d5 std.Io.Threaded: separate out ECANCELED handling again
If ECANCELED occurs, it's from pthread_cancel which will *permanently*
set that thread to be in a "canceling" state, which means the cancel
cannot be ignored. That means it cannot be retried, like EINTR. It must
be acknowledged.
2025-12-01 19:17:52 -08:00
Andrew Kelley cf82064ebc std.Io.Threaded: don't use pthread_cancel with musl
It doesn't support setting the "canceled" status to false, so once a
thread has been canceled, all operations on the thread start permanently
failing.
2025-12-01 19:17:52 -08:00
Andrew Kelley bf0ffc45b9 std.Io.Threaded: musl: handle ECANCELED same as EINTR
Otherwise the pthread_cancel can affect unrelated tasks.
2025-12-01 19:17:52 -08:00
Andrew Kelley 54a84964f8 std.os.linux: SIG enum is non-exhaustive 2025-12-01 19:17:52 -08:00
Andrew Kelley 57f5de5b77 std.Io.Threaded: use the correct mmsghdr struct 2025-12-01 19:17:52 -08:00
Andrew Kelley 103467fa6c std.Io.Threaded: make is_musl linux-only 2025-12-01 19:17:52 -08:00
David Rubin 85053a6a36 link.Elf: implement aarch64 relocation 2025-12-01 19:17:52 -08:00
Andrew Kelley c4f5dda135 std.Io.Threaded: re-introduce retry logic behind config 2025-12-01 19:17:52 -08:00
Andrew Kelley de87bad4c3 std.Io.Threaded: don't solve the cancel race after all
Unfortunately, trying again until the cancellation request is
acknowledged has been observed to incur a large amount of overhead,
and usually strong cancellation guarantees are not needed, so the
race condition is not handled here. Users who want to avoid this
have this menu of options instead:
* Use no libc, in which case Zig std lib can avoid the race (tracking
  issue: https://codeberg.org/ziglang/zig/issues/30049)
* Use musl libc
* Use `std.Io.Evented`. But this is not implemented yet. Tracked by
  - https://codeberg.org/ziglang/zig/issues/30050
  - https://codeberg.org/ziglang/zig/issues/30051

glibc + threaded is the only problematic combination.
2025-12-01 19:17:52 -08:00
Andrew Kelley 144206856e std.Io.Threaded: fix compilation for riscv32-linux 2025-12-01 19:17:52 -08:00
Andrew Kelley 9e981c3ae5 std.os.linux: delete unnecessary @compileError
Without this, it already fails to compile with a sufficiently helpful
error message.
2025-12-01 19:17:52 -08:00
Andrew Kelley 39ac40209b std.Io.Threaded: use musl's beautiful pthread_cancel semantics 2025-12-01 19:17:52 -08:00
Andrew Kelley d60760d61e std.Io.Threaded: tune requestCancel
On a heavily loaded Linux 6.17.5, I observed a maximum of 20 attempts
not acknowledged before the timeout (including exponential backoff) was
sufficient, despite the heavy load.

The time wasted here sleeping is mitigated by the fact that, later on,
the system will likely wait for the canceled task, causing it to
indefinitely yield until the canceled task finishes, and the task must
acknowledge the cancel before it proceeds to that point.
2025-12-01 19:17:52 -08:00