Commit graph

35735 commits

Author SHA1 Message Date
Alex Rønne Petersen
a54906b46e
std.debug.cpu_context: make arch-specific implementations private 2025-10-07 19:18:46 +02:00
achan1989
27aba2d776 Fix infinite loop in Reader.Limited 2025-10-07 09:53:34 -07:00
Henry John Kupty
163ebe044b
std.mem.countScalar: rework to benefit from simd (#25477)
`findScalarPos` might do repetitive work, even if using simd. For
example, when searching the string `/abcde/fghijk/lm` for the character
`/`, a 16-byte wide search would yield `1000001000000100` but would only
count the first `1` and re-search the remaining of the string.

When testing locally, the difference was quite significative:
```
count scalar
  5737 iterations       522.83us per iterations
  0 bytes per iteration
  worst: 2370us median: 512us   stddev: 107.64us

count v2
  38333 iterations      78.03us per iterations
  0 bytes per iteration
  worst: 713us  median: 76us    stddev: 10.62us

count scalar v2
  99565 iterations      29.80us per iterations
  0 bytes per iteration
  worst: 41us   median: 29us    stddev: 1.04us
```

Note that `count v2` is a simpler string search, similar to the
remaining version of the simd approach:
```
pub fn countV2(comptime T: type, haystack: []const T, needle: T) usize {
    const n = haystack.len;
    if (n < 1) return 0;
    var count: usize = 0;
    for (haystack[0..n]) |item| {
        count += @intFromBool(item == needle);
    }

    return count;
}
```

Which implies the compiler yields some optimized code for a simpler loop
that is more performant than the `findScalarPos`-based approach, hence
the usage of iterative approach for the remaining of the haystack.

Co-authored-by: StAlKeR7779 <stalkek7779@yandex.ru>
2025-10-07 09:32:13 -07:00
Alex Rønne Petersen
a06db282c7
std.debug.SelfInfo.MachO: don't restore vector registers during unwinding
We know that these are unsupported and irrelevant for unwinding, so don't fail
the unwind attempt trying to read/write them for no ultimate purpose.
2025-10-07 17:13:58 +02:00
Alex Rønne Petersen
e4f0c62b5d
std.debug.Dwarf.expression: fix a test that assumes sp != fp
This does not hold on PowerPC.
2025-10-07 17:03:48 +02:00
Alex Rønne Petersen
7fdd5704ed
std.debug.cpu_context: map a bunch of known registers as unsupported instead of invalid 2025-10-07 16:47:57 +02:00
Alex Rønne Petersen
de3b22db4d
std.debug.cpu_context: remove support for s390x float registers
Let's for the moment assume that compilers haven't lost the plot.

Fingers crossed.
2025-10-07 16:47:57 +02:00
Alex Rønne Petersen
9cd37a0696
std.debug.Dwarf: use 66 as the (fake) MIPS PC register
32-63 conflict with the floating point registers. 64 and 65 are used for the
ac0 hi/lo registers.
2025-10-07 16:47:57 +02:00
Alex Rønne Petersen
f6403ed5ea
std.debug.Dwarf: use 67 as the (fake) PowerPC PC register
It's free real estate, as it turns out.
2025-10-07 16:47:57 +02:00
Alex Rønne Petersen
feba8a83a7
std.debug.Dwarf: use 65 as the (fake) RISC-V PC register
32-63 conflict with the floating point registers. 64 is the Alternate Frame
Return Column.
2025-10-07 16:47:57 +02:00
Alex Rønne Petersen
9a6fad2706
std.debug.Dwarf: use 64 as the (fake) LoongArch PC register
32-63 conflict with the floating point registers.
2025-10-07 16:47:57 +02:00
Alex Rønne Petersen
aa74eb505a
std.debug: add unwind support for powerpc*-linux 2025-10-07 16:47:57 +02:00
Alex Rønne Petersen
ca73d697b9
std.debug: add unwind support for mips*-linux 2025-10-07 16:47:57 +02:00
Alex Rønne Petersen
a5a9ffb90b
std.debug.cpu_context: check for architecture, i.e. register size, not bitness
We care about the hardware here, not the ABI.
2025-10-07 16:47:57 +02:00
Alex Rønne Petersen
081d6d12a1
std.debug.Dwarf.SelfUnwinder: add an s390x check missed in 95bdb0c1c6 2025-10-07 16:47:57 +02:00
Alex Rønne Petersen
fdd109420d
std.debug: add noinline to functions that capture the current stack trace
Fixes stack traces missing a frame depending on inlining decisions.

ref https://github.com/ziglang/zig/issues/25418
2025-10-07 16:47:57 +02:00
Alex Rønne Petersen
0b33891f4c
std.os.linux: add ucontext_t and mcontext_t for mips/mips64 2025-10-07 16:47:57 +02:00
Alex Rønne Petersen
98af7f34e9
std.os.linux: minor NFC corrections to hexagon ucontext_t and mcontext_t 2025-10-07 16:47:57 +02:00
Alex Rønne Petersen
9760068826 std.debug: prefer FP unwinding on targets where it is ideal
If the ABI requires a backchain pointer, FP unwinding is always possible, safe,
and fast, so there's really no reason not to use it.
2025-10-07 16:44:25 +02:00
Jacob Young
d28006153e llvm.Builder: allow Metadata to reference metadata strings
Closes #25486
2025-10-07 07:49:54 -04:00
xdBronch
2810e4b173 detect references to comptime var in default values and sentinels 2025-10-07 11:58:12 +01:00
Alex Rønne Petersen
c23a5ccd19
std.debug.Dwarf.SelfUnwinder: skip caching rules for unsupported registers
For unwinding purposes, we don't care about unsupported registers. Yet because
we added these rules to the cache entry, we'd later try to evaluate them and
thus fail the unwind attempt for no good reason. They'd also take up cache rule
slots that would be better spent on actually relevant registers.

Note that any attempt to read unsupported registers during unwinding will still
fail the unwind attempt as expected.
2025-10-07 09:28:43 +02:00
Andrew Kelley
6893e7feee
Merge pull request #25414 from squeek502/mingw-def-implib
Support generating import libraries from mingw .def files without LLVM
2025-10-06 13:38:07 -07:00
Zhenming Lin
9bfd4c3017
improve impl of __sqrth, sqrtf, sqrt, __sqrtx and sqrtq (#25416)
The previous version (ported from musl) used bit-by-bit calculations and was slow, but the current version (also ported from musl) uses lookup tables combined with Goldschmidt iterations to significantly improve the speed.
2025-10-06 11:45:51 -07:00
xdBronch
851ae9bb43 don't pass zero-length @memset to the backend 2025-10-06 11:28:56 -07:00
Jacob Young
969f2cff82 Elf2: implement virtual allocation
This allows segments to be moved around in the output file without
needing to reapply relocations until virtual address space is exhaused.
2025-10-06 11:27:39 -07:00
Alex Rønne Petersen
2962db333f
Merge pull request #25480 from alexrp/std-debug-hexagon
`std.debug`: add unwind support for `hexagon-linux`
2025-10-06 11:10:02 +02:00
xdBronch
ea9fb3ccfa fix read of undefined in http tests 2025-10-06 06:54:52 +02:00
Alex Rønne Petersen
7c87691a61
Merge pull request #25479 from alexrp/qemu-os-checks
`std.zig.system`: add OS checks for QEMU in `getExternalExecutor()`
2025-10-06 06:11:06 +02:00
Alex Rønne Petersen
ddc815e3d8 drop support for powerpc64 ELF v1
* ELF v1 on powerpc64 is only barely kept on life support in a couple of Linux
  distros. I don't anticipate that this will last much longer.
* Most of the Linux world has moved to powerpc64le which requires ELF v2.
* Some Linux distros have even started supporting powerpc64 with ELF v2.
* The BSD world has long since moved to ELF v2.
* We have no actual linking support for ELF v1.
* ELF v1 had confused DWARF register mappings which is becoming a problem in
  our DWARF code in std.debug.

It's clear that ELF v1 is on its way out, and we never fully supported it
anyway. So let's not waste any time or energy on it going forward.

closes #5927
2025-10-06 01:28:56 +02:00
Alex Rønne Petersen
9e61a64033
std.zig.system: add OS checks for QEMU in getExternalExecutor()
FreeBSD doesn't support the same number of platforms as Linux, and even then,
only has usermode emulation for a subset of its supported platforms.

NetBSD's usermode emulation support is apparently just broken at the moment.
2025-10-05 23:33:12 +02:00
Alex Rønne Petersen
a5ff376b8f
std.debug: add unwind support for hexagon-linux 2025-10-05 20:09:26 +02:00
Alex Rønne Petersen
26403fe3f9
std.os.linux: add mcontext_t and ucontext_t for hexagon 2025-10-05 20:08:55 +02:00
Alex Rønne Petersen
bd23e9a744
ci: bump x86_64-linux-release timeout to 8 hours on Forgejo Actions 2025-10-05 18:53:34 +02:00
Alex Rønne Petersen
5969d6180f
std.zig.system: handle or1k in getExternalExecutor() 2025-10-05 17:06:41 +02:00
Ryan Liptak
0a74d73459
Merge pull request #25320 from hkupty/walker2
std.fs.Dir: Add `walkSelectively` to provide more control over directory walking
2025-10-04 22:41:25 -07:00
Alex Rønne Petersen
e6e4792a58 std.debug: completely disable FP-based unwinding on mips 2025-10-05 07:18:50 +02:00
Alex Rønne Petersen
30f5258fe6 std.debug.SelfInfo.Elf: disable unwinding on mips n32 and x86 x32
The DWARF code can't handle these yet.

ref https://github.com/ziglang/zig/issues/25447
2025-10-05 07:18:50 +02:00
Jacob Young
906ce2ad7c InternPool: use sequential string indices instead of byte offsets
This allows more bytes to be referenced by a smaller index range.

Closes #22867
Closes #25297
Closes #25339
2025-10-05 00:25:21 -04:00
Alex Rønne Petersen
606c7bcc89
test: disable standalone tsan test
https://github.com/ziglang/zig/issues/25471
2025-10-05 02:13:21 +02:00
Alex Rønne Petersen
97fa0e3ebd
Merge pull request #25456 from alexrp/libcxx-cxx17-removed-functions
`libcxx`: stop defining `_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS`
2025-10-05 00:52:57 +02:00
Alex Rønne Petersen
73602f2a13
std.Target: baseline model for s390x-zos should be arch10, not arch8 2025-10-05 00:23:51 +02:00
Alex Rønne Petersen
ea46bd2772
test: move standalone/options/ to cli/options/
It's now used only by test-cli, so make that clear.
2025-10-04 21:55:39 +02:00
Alex Rønne Petersen
5bbbc8d299
Revert "test: remove standalone options test"
This reverts commit d9cd4d0876.

Turns out Jacob restored this test as part of test-cli in cdba1d5.
2025-10-04 21:46:55 +02:00
Alex Rønne Petersen
c4b7caa528
ci: run the docs step on loongarch64-linux 2025-10-04 21:02:43 +02:00
Alex Rønne Petersen
3539cad176
test: remove standalone sigpipe test
This should be restored, but there's no point keeping disabled code that's just
going to bitrot.

https://github.com/ziglang/zig/issues/25466
2025-10-04 20:53:19 +02:00
Alex Rønne Petersen
d9cd4d0876
test: remove standalone options test
This functionality is already load-bearing for the compiler's own build script
so this (disabled, possibly bitrotted?) doesn't really add value.
2025-10-04 20:51:07 +02:00
Alex Rønne Petersen
f6c1864abf
test: remove standalone issue_13970 test
It's been disabled for ages and has bitrotted. Someone can readd it later if
they feel like it actually adds value.
2025-10-04 20:51:07 +02:00
Alex Rønne Petersen
95417948d0
test: remove ad-hoc nvptx tests
These were just testing random things in the LLVM NVPTX backend. That's not
really our job.
2025-10-04 20:51:07 +02:00
Alex Rønne Petersen
c68f9bc207
test: remove some tests that are now covered well enough by test-stack-traces
The amount of cross compilation required for these tests was too time-consuming
for how much value they added. test-stack-traces now cover these well enough,
especially as we add more exotic machines to the CI fleet to run native tests.
2025-10-04 20:51:07 +02:00