Commit graph

37274 commits

Author SHA1 Message Date
Andrew Kelley
64dc1cdad8 fetch: download to local zig-pkg directory
rather than global cache p/ directory.

closes #14283

does not recompress packages into global cache yet
2026-02-05 16:50:41 -08:00
Andrew Kelley
76d275b20f std.Io.Threaded: flatten some switch cases 2026-02-05 16:30:33 -08:00
Andrew Kelley
387d550b6c compiler: remove btrfs workaround functionality
has been fixed in the kernel code for a while now
2026-02-05 16:30:33 -08:00
bgthompson
076f7e5bd5 removed reduntant @as() from switch in getDaysInMonth 2026-02-05 21:58:35 +01:00
Pivok
d0b39c7f2b libzigc: hypot (#31104)
First time contribution.

Implements hypot for libzigc #30978.

Commands i run:
```
$ stage3/bin/zig build -p stage4 -Denable-llvm -Dno-lib

$ stage4/bin/zig build test-libc -Dlibc-test-path=../../libc-test -Dtest-filter=hypot --summary line -fqemu -fwasmtime
Build Summary: 725/737 steps succeeded (12 skipped)
```

I also changed std.math.hypot becuase some libc-tests raised fp exceptions. Example:
```
../../libc-test/src/math/special/hypot.h:8: bad fp exception: RN hypot(0x1p-1074,0x0p+0)=0x1p-1074, want 0 got INEXACT|UNDERFLOW
../../libc-test/src/math/special/hypot.h:9: bad fp exception: RN hypot(0x1p-1074,-0x0p+0)=0x1p-1074, want 0 got INEXACT|UNDERFLOW
```

I also run this command as a quick sanity check:
```
$ stage4/bin/zig build test-std -Dtest-filter=hypot -Dtest-target-filter=x86_64-linux-musl --summary line
Build Summary: 5/5 steps succeeded; 136/136 tests passed
```

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31104
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
Co-authored-by: Pivok <pivoc@protonmail.com>
Co-committed-by: Pivok <pivoc@protonmail.com>
2026-02-05 21:57:32 +01:00
brickmonster
c38f9336a3 std.os.linux: fix test not building 2026-02-05 21:15:54 +01:00
Ryan Liptak
bcb5218a2b Environ: reinstate null return on = in environment variable keys
Changes an assert back into a conditional to match the behavior of `getPosix`, see https://codeberg.org/ziglang/zig/pulls/31113#issuecomment-10371698 and https://github.com/ziglang/zig/issues/23331.
Note: the conditional has been updated to also return null early on 0-length key lookups, since there's no need to iterate the block in that case.

For `Environ.Map`, validation of keys has been split into two categories: 'put' and 'fetch', each of which are tailored to the constraints that the implementation actually relies upon. Specifically:
- Hashing (fetching) requires the keys to be valid WTF-8 on Windows, but does not rely on any other properties of the keys (attempting to fetch `F\x00=` is not a problem, it just won't be found)
- `create{Posix,Windows}Block` relies on the Map to always have fully valid keys (no NUL, no `=` in an invalid location, no zero-length keys), which means that the 'put' APIs need to validate that incoming keys adhere to those properties.
The relevant assertions are now documented on each of the Map functions.

Also reinstates some test cases in the `env_vars` standalone test. Some of the reinstated tests are effectively just testing the Environ.Map implementation due to how `Environ.contains`, `Environ.getAlloc`, etc are implemented, but that is not inherent to those functions so the tests are still potentially relevant if e.g. `contains` is implemented in terms of `getPosix`/`getWindows` in the future (which is totally possible and maybe a good idea since constructing the whole map is not necessary for looking up one key).
2026-02-05 20:24:31 +01:00
Ivel
fa3228ae42 libc: reimplement swab in Zig (#31130)
This PR replaces the bundled musl swab() implementation with zig's one.

Contributes towards #30978.

It looks like there are not test cases for swab() in test-libc.

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31130
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
Co-authored-by: Ivel <ivel.santos@proton.me>
Co-committed-by: Ivel <ivel.santos@proton.me>
2026-02-05 20:21:41 +01:00
Jacob Young
c77e7146f5 std.Threaded: replace console kernel32 functions with ntdll 2026-02-05 07:41:25 -05:00
Alex Rønne Petersen
f150759953 Merge pull request 'ci: run test-libc on x86_64-linux-release' (#30221) from alexrp/zig:ci-libc-test into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/30221
2026-02-05 13:35:49 +01:00
Andrew Kelley
4c35d53b9a Merge pull request 'std.os.windows: move OpenFile and GetFinalPathNameByHandle into Io.Threaded' (#31111) from windows-open-file-again into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31111
2026-02-05 06:25:38 +01:00
Andrew Kelley
3078a3197b std.Io.Threaded.dirCreateDirWindows: remove unexpected error handling 2026-02-04 16:30:19 -08:00
Andrew Kelley
0e7d00776e std.Io.Threaded: inline OpenFile into dirCreateDirWindows 2026-02-04 16:30:19 -08:00
Andrew Kelley
3a5fff45ec std: move os.windows.OpenFile into Io.Threaded
it needs cancelation integration
2026-02-04 16:30:17 -08:00
Andrew Kelley
2a193a3987 std: move GetFinalPathNameByHandle to Io.Threaded
unfortunately this function calls NtCreateFile so it has to participate
in cancelation
2026-02-04 16:27:13 -08:00
Andrew Kelley
b49dc5eb70 build: bump max_rss for C ABI tests on Windows 2026-02-04 16:24:48 -08:00
Andrew Kelley
fcef9905ae Merge pull request 'std.Progress: implement inter-process progress reporting for windows' (#31113) from threaded-win-cleanup into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31113
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-02-05 01:24:18 +01:00
Jacob Young
71156aff80 std.Progress: implement ipc resource cleanup 2026-02-04 15:20:10 -05:00
Alex Rønne Petersen
c3edf0ba64
Merge branch 'netbsd-ci' 2026-02-04 20:44:45 +01:00
Alex Rønne Petersen
012be3efd7
Revert "ci: temporarily disable x86_64-netbsd while I investigate failures"
This reverts commit 99ec1ee353.
2026-02-04 20:44:37 +01:00
Alex Rønne Petersen
06879041ac
link.Lld: disable parallel linking on NetBSD host
To work around NetBSD 10.1 malloc bugs.
2026-02-04 20:44:37 +01:00
Matthew Lugg
a816f9e245
std.Io.Threaded: use _lwp_park correctly for real this time? 2026-02-04 20:44:37 +01:00
Matthew Lugg
fcdde3e4c7
std.Io.Threaded: gracefully handle race leading to ESRCH in unpark() 2026-02-04 20:44:37 +01:00
Jacob Young
ffc6da29e3 std.Io.Threaded: implement and cleanup windows codepaths 2026-02-04 14:15:41 -05:00
Alex Rønne Petersen
fce7878a91
test: disable hexagon-linux-musl C ABI tests for now
https://gitlab.com/qemu-project/qemu/-/issues/3291
2026-02-04 11:11:39 +01:00
Andrew Kelley
d45f9aca14 std.Thread: delete Mutex.Recursive
Replaced by the lockStderr functions of std.Io. Trying to make
`std.process.stderr_thread_mutex` be a bridge across different Io
implementations didn't work in practice.
2026-02-03 20:46:25 -08:00
Andrew Kelley
d1e01e9431 Merge pull request 'std.Io.Threaded: Windows *cannot* spuriously unpark, and introduce ParkingMutex' (#31102) from parking-futex-parking-mutex into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31102
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-02-04 05:06:17 +01:00
Matthew Lugg
6d6532dd9e
Io.Threaded: add ParkingMutex, and deal with spurious unparks on NetBSD
We can't use Io.Mutex in parking_futex; instead, we need a simple
parking-based mutex implementation. That's fairly simple to do.

Also deal with spurious unparks on NetBSD, where they *can* happen (as
opposed to Windows, where they cannot).
2026-02-03 22:50:35 +00:00
Matthew Lugg
7c08f77efa
Revert "std.Io.Threaded: spurious unparks are possible"
It turns out that at least on Windows, spurious unparks are *not*
possible, and in fact triggering them breaks some RTL synchronization
primitives. For instance, if you have a pending unpark going into a
contended `RtlEnterCriticalSection` call, it will never unblock. In
other words, the Windows API worked exactly how I thought it did, and
it's only the NetBSD/Illumos one which is dumb. This is actually exactly
why Windows 8 introduced the parking API despite alertable sleeps being
a thing!

This commit doesn't yet deal with making NetBSD work, nor does it even
compile I imagine. The next commit will fix everything back up.

This reverts commit c518593e97.
2026-02-03 22:47:19 +00:00
Matthew Lugg
56a43fb86f
Revert "std.Io.Threaded: work around parking futex bug"
This reverts commit 5312063138.
2026-02-03 22:38:28 +00:00
Andrew Kelley
1ab5a58474 std.Io.Threaded: handle errors from clockResolution 2026-02-03 12:00:14 -08:00
rpkak
184c8f9545 std.heap.PageAllocator: align hint 2026-02-03 20:27:28 +01:00
Alex Rønne Petersen
e9b442db5a llvm: fix C ABI integer promotion for more targets
Also stop pretending that this function handles _BitInt types correctly.

Handling 32-bit integers on MIPS properly is blocked on: https://github.com/llvm/llvm-project/issues/179088
2026-02-03 20:21:52 +01:00
Alex Rønne Petersen
2fce12b42a test: improve logic for generating stack trace test combinations 2026-02-03 20:19:15 +01:00
Andrew Kelley
e5e4602b18 Merge pull request 'std: finish moving time to Io interface' (#31086) from time into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31086
2026-02-03 20:16:18 +01:00
Ivel
7aae7dd3f4 libzigc: pow 2026-02-03 20:14:22 +01:00
Alex Rønne Petersen
6ce0dd1a81
ci: run test-libc on x86_64-linux-debug-llvm and x86_64-linux-release 2026-02-03 17:19:16 +01:00
Alex Rønne Petersen
02599bccb5
build: bump test-libc max_rss to 3_500_000_000
error: memory usage peaked at 3.11GB (3105054720 bytes), exceeding the declared upper bound of 2.90GB (2900000000 bytes)
2026-02-03 17:19:03 +01:00
Andrew Kelley
fe5da36aa3 std.Io make Clock.resolution fallible 2026-02-03 01:02:48 -08:00
Andrew Kelley
11476d83c9 stage1: add wasi_snapshot_preview1_clock_res_get to wasi.c 2026-02-02 23:14:06 -08:00
Andrew Kelley
922ab8b8bc std: finish moving time to Io interface
Importantly, adds ability to get Clock resolution, which may be zero.
This allows error.Unexpected and error.ClockUnsupported to be removed
from timeout and clock reading error sets.
2026-02-02 23:02:31 -08:00
Andrew Kelley
e7e700334d Merge pull request 'std.Thread sync primitives roundup' (#31084) from sync-cleanup into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31084
2026-02-03 07:52:02 +01:00
Andrew Kelley
4c4e9d054e std.Io: add RwLock and Semaphore sync primitives
and restore usage by std.debug.SelfInfo.Elf
2026-02-02 20:18:14 -08:00
Andrew Kelley
550da1b676 std: migrate remaining sync primitives to Io
- delete std.Thread.Futex
- delete std.Thread.Mutex
- delete std.Thread.Semaphore
- delete std.Thread.Condition
- delete std.Thread.RwLock
- delete std.once

std.Thread.Mutex.Recursive remains... for now. it will be replaced with
a special purpose mechanism used only by panic logic.

std.Io.Threaded exposes mutexLock and mutexUnlock for the advanced case
when you need to call them directly.
2026-02-02 18:57:17 -08:00
Andrew Kelley
255aeb57b2 std: introduce atomic.Mutex and use it in heap.SmpAllocator
This allocator implementation uses only lock-free operations.
2026-02-02 18:36:40 -08:00
Andrew Kelley
e9eadee006 Merge pull request 'std.Io.Threaded: sever dependency on std.Thread Mutex and Condition' (#31096) from severance into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31096
2026-02-03 03:30:42 +01:00
Andrew Kelley
5312063138 std.Io.Threaded: work around parking futex bug
This commit should be reverted - it's testing a hypothesis that Windows
is deadlocking due to bug in the implementation of
std.Io.Threaded.parking_futex
2026-02-02 14:25:27 -08:00
Andrew Kelley
eb74e23e7b std.Io.Threaded: sever dependency on std.Thread Mutex and Condition 2026-02-02 14:18:04 -08:00
Andrew Kelley
c2d4806d65 Merge pull request 'std.Thread: remove redundant sync APIs ResetEvent and WaitGroup' (#31088) from sync-cleanup-smaller into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31088
2026-02-02 23:14:05 +01:00
Krzysztof Antonowski
1cd3af43fd std.Io.Threaded: implement CPU-based clocks on Windows (#31093)
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31093
Co-authored-by: Krzysztof Antonowski <krzysztofantonowski@proton.me>
Co-committed-by: Krzysztof Antonowski <krzysztofantonowski@proton.me>
2026-02-02 22:19:19 +01:00