Commit graph

28475 commits

Author SHA1 Message Date
Matthew Lugg
8775d8bbce
Merge pull request #19062 from mlugg/dbg-var-blocks
compiler: decide dbg_var scoping based on AIR blocks
2024-02-27 03:25:04 +00:00
John Schmidt
f803761e13 Fix tuple default values
- Add default values to the list of comptime-known elements in
  `zirValidatePtrArrayInit`
- In `structFieldValueComptime`, only assert `haveFieldInits` if we
  enter the`fieldIsComptime` branch (otherwise they are not needed).
2024-02-26 17:03:20 -08:00
John Schmidt
7a045ede7c Check for inactive union field when calling fn at comptime
Reuse `unionFieldPtr` here to ensure that all the safety checks are
included.

Closes https://github.com/ziglang/zig/issues/18546.
2024-02-26 16:55:17 -08:00
Andrew Kelley
3e79c0f18c
Merge pull request #18859 from schmee/switch-union-capture-align
Sema: preserve field alignment in union pointer captures
2024-02-26 16:52:39 -08:00
John Schmidt
00ff123b1e Sema: fix compile error for switching on undefined union
Before this fix, passing an undefined union value to `Sema.switchCond`
returned an undefined value of the union type, not the tag type, since
`Value.unionTag` forwards undefined values unchanged.
This leads us into the `.Union` branch in `Sema.zirSwitchBlock` which is
unreachable, now we take the `.Enum` branch instead.
2024-02-26 16:51:37 -08:00
John Schmidt
8bd94759bf Sema: evaluate generic instantiations in fn decls capture scope
The generic call `S.foo()` was evaluated with the
capture scope of the owner decl (i.e the `test` block), when it should
use the capture scope of the function declaration.
2024-02-26 16:50:00 -08:00
Ryan Liptak
726a1149e0 Change many test blocks to doctests/decltests 2024-02-26 15:18:31 -08:00
Ryan Liptak
16b3d1004e Remove redundant test name prefixes now that test names are fully qualified
Follow up to #19079, which made test names fully qualified.

This fixes tests that now-redundant information in their test names. For example here's a fully qualified test name before the changes in this commit:

"priority_queue.test.std.PriorityQueue: shrinkAndFree"

and the same test's name after the changes in this commit:

"priority_queue.test.shrinkAndFree"
2024-02-26 15:18:31 -08:00
Andrew Kelley
1b79a42da0 std.http.Server: fix use case of streaming both reading and writing 2024-02-26 13:42:01 -08:00
Andrew Kelley
81aa74e7e1
Merge pull request #19081 from ianic/tar_case_sensitive
std.tar don't overwrite files on unpack
2024-02-26 12:23:22 -08:00
Andrew Kelley
d51aa9748f change default WASI stack size
to match the other operating systems. 16 MiB

closes #18885
2024-02-26 10:33:17 -08:00
mlugg
59447e5305
compiler: decide dbg_var scoping based on AIR blocks
This commit eliminates the `dbg_block_{begin,end}` instructions from
both ZIR and AIR. Instead, lexical scoping of `dbg_var_{ptr,val}`
instructions is decided based on the AIR block they exist within. This
is a much more robust system, and also results in a huge drop in ZIR
bytes - around 7% for Sema.zig.

This required some enhancements to Sema to prevent elision of blocks
when they are required for debug variable scoping. This can be observed
by looking at the AIR for the following simple test program with and
without `-fstrip`:

```zig
export fn f() void {
    {
        var a: u32 = 0;
        _ = &a;
    }
    {
        var a: u32 = 0;
        _ = &a;
    }
}
```

When `-fstrip` is passed, no AIR blocks are generated. When `-fno-strip`
is passed, the ZIR blocks are lowered to true AIR blocks to give correct
lexical scoping to the debug vars.

The changes here incidentally reolve #19060. A corresponding behavior
test has been added.

Resolves: #19060
2024-02-26 13:20:45 +00:00
Andrew Kelley
031f23117d
Merge pull request #19083 from antlilja/llvm-blockinfo
LLVM reduce size of emitted bitcode
2024-02-26 04:03:40 -08:00
Andrew Kelley
032c2ee9bc std.http.Client: fix UAF when handling redirects
closes #19071
2024-02-26 01:01:16 -08:00
John Schmidt
723d13f831 AstGen: fix OoB crash on ast-check -t
The `decl_node` was offset from the wrong source node.
2024-02-26 07:01:32 +00:00
Andrew Kelley
9dda2eb1ab
Merge pull request #19080 from jacobly0/llvm-per-mod-strip
llvm: implement per-module stripping
2024-02-25 21:44:10 -08:00
Andrew Kelley
91fb211faa
Merge pull request #18906 from jacobly0/x86_64-tests
x86_64: pass more tests
2024-02-25 21:43:20 -08:00
Jacob Young
d656c2a7ab test: rework how filtering works
* make test names contain the fully qualified name
 * make test filters match the fully qualified name
 * allow multiple test filters, where a test is skipped if it does not
   match any of the specified filters
2024-02-25 19:12:08 -08:00
Jakub Konka
429e542f3f macho: count rebases for synthetic __objc_selrefs 2024-02-26 02:22:36 +01:00
Jakub Konka
2901026425 macho: fix section to segment mapping 2024-02-26 02:22:36 +01:00
Jakub Konka
d7276c1527 macho: actually set SG_READ_ONLY on __DATA_CONST segment 2024-02-26 02:22:36 +01:00
antlilja
73a16d440b Builder: Reduce size of DebugLoc abbrev 2024-02-26 01:02:16 +01:00
antlilja
9754d6d0a0 Builder: Use BlockInfo block to reduce size of bitcode 2024-02-26 01:00:58 +01:00
Andrew Kelley
aa39e98d90
Merge pull request #19077 from Techatrix/http-header-parse
http: check for empty header name instead of value
2024-02-25 15:27:12 -08:00
Igor Anić
65e5c46d61 std.tar fix refactored function
It was not returning error in all cases. Bug in refactoring.
2024-02-26 00:24:23 +01:00
Jae B
b2374c4d75 fix crash when calling StackIterator.isValidMemory with emscripten 2024-02-25 12:39:05 -08:00
Marc Tiehuis
ff3bf98345 fix large f128 values being incorrectly parsed as inf
Found while fuzzing. Previously 1.1897314953572317650857593266280070162E4932
was parsed as +inf, which caused issues for round-trip serialization of
floats. Only f128 had issues, but have added other tests for all
floating point large normals.

The max_exponent for f128 was wrong, it is subtly different in the
decimal code-path as it is based on where the decimal digit should go.
This needs to be 2 greater than the max exponent (e.g. 308 or 4932) to
work correctly (greater by 1, then we use a >= comparision).

In addition, I've removed the redundant `optimize` constant which was only
use for testing the slow path locally.
2024-02-25 12:37:03 -08:00
Andrew Kelley
08e886b8fe package management: fix regression of printing expected hash
Regressed in ed4ccea7ba. The early exit
path was only supposed to happen in case of --system mode.
2024-02-25 09:27:39 -08:00
Jacob Young
ed026b5dff llvm: free llvm data before running llvm optimizations
This reduces the max memory usage.
2024-02-25 17:37:27 +01:00
Jacob Young
1e1598950a llvm: implement per-module stripping
This avoids llvm module verification errors when the strip option
is different across modules.
2024-02-25 17:37:27 +01:00
Jacob Young
661137ac92
Merge pull request #19074 from antlilja/llvm-debug-loc
Rework LLVM debug locations to not emit them twice
2024-02-25 17:03:45 +01:00
Igor Anić
f086ea856c std.tar skip test on windows
Or other platform which don't support symlinks.
2024-02-25 15:57:20 +01:00
Andrew Kelley
9d7082972e std.heap.raw_c_allocator: use malloc_size for resize
std.heap.c_allocator was already doing this, however,
std.heap.raw_c_allocator, which asserts no allocations more than 16
bytes aligned, was not.

The zig compiler uses std.heap.raw_c_allocator, so it is affected by
this.
2024-02-25 05:38:28 -08:00
Jacob Young
f6af773578 llvm: remork memory management in emit 2024-02-25 03:58:06 -08:00
Techatrix
a07218cc43 http: handle header fields with empty value 2024-02-25 12:07:13 +01:00
Techatrix
9727931fda fix integer overflow in indexOfPosLinear when needle.len > haystack.len 2024-02-25 12:07:12 +01:00
Igor Anić
30a319be6d std.tar improve error reporting
Report file name which failed to create in all cases.
2024-02-25 12:03:23 +01:00
Jacob Young
4fcc750ba5 x86_64: implement more shuffles 2024-02-25 11:22:10 +01:00
Jacob Young
e5c439a16d x86_64: implement optional comparisons
Closes #18959
2024-02-25 11:22:10 +01:00
Jacob Young
a76d8ca29b x86_64: fix alignment of bool vectors 2024-02-25 11:22:10 +01:00
Jacob Young
513c4c145e x86_64: fix avx2 @truncacte 2024-02-25 11:22:10 +01:00
Jacob Young
2fcb2f5975 Sema: implement vector coercions
These used to be lowered elementwise in air, and now are a single air
instruction that can be lowered elementwise in the backend if necessary.
2024-02-25 11:22:10 +01:00
Jacob Young
2fdc9e6ae8 x86_64: implement @shuffle 2024-02-25 11:22:10 +01:00
Jacob Young
defef3f1a1 x86_64: fix inline asm match constraints 2024-02-25 11:22:10 +01:00
Jacob Young
88d0fef92d x86_64: implement @select 2024-02-25 11:22:10 +01:00
Jacob Young
ab6f9e3d10 x86_64: fix incorrect mnemonic selection 2024-02-25 11:22:10 +01:00
SuperAuguste
55f437b92b Add pollTimeout for non-blocking/timeout-having polls 2024-02-25 01:41:56 -08:00
Igor Anić
96e4d56819 std.tar add case sensitive file name test
Like in issue #18089, this tar contains, same file name in two case
sensitive name version. Unpack should fail on case insensitive file
systems and succeed on case sensitive.

$ tar tvf 18089.tar
    18089/
    18089/alacritty/
    18089/alacritty/darkermatrix.yml
    18089/alacritty/Darkermatrix.yml
2024-02-25 10:35:18 +01:00
Andrew Kelley
6c2eb0f131
Merge pull request #19005 from squeek502/wtf
Fix handling of Windows (WTF-16) and WASI (UTF-8) paths, etc
2024-02-25 01:00:25 -08:00
Michael Dusan
63ea3e172e std: re-enable most of setrlimit test on macos
- skip only RLIMIT_STACK test on macos

closes #18395
2024-02-24 21:31:48 -08:00