16273 Commits

Author SHA1 Message Date
Michael Lynch
cb5547e3de
Expand zig fetch usage help doc to explain URL (#22850)
The current zig fetch help docs tell the user to specify a package's URL, but it's unclear what the URL should be.

This change expands the help output to explain what URLs the zig fetch command can handle and provides examples of valid URLs.

Related: #20096

A git bundle file seems to be the more accurate term, as it's what git uses in its documentation: https://git-scm.com/docs/git-bundle
2025-02-13 13:06:10 -08:00
Jacob Young
13ca87e204 x86_64: implement conversions between float and int vectors 2025-02-12 10:11:54 -05:00
Andrew Kelley
58f928814d
Merge pull request #22862 from ziglang/fuzz
fuzzer: write inputs to shared memory before running
2025-02-11 23:36:53 -08:00
Andrew Kelley
5c39ccddda Compilation: disable error return tracing in rt libs 2025-02-11 12:42:17 -08:00
David Rubin
914f822025 link.Elf: implement non-alloc {SET,SUB}_ULEB128 2025-02-11 20:41:52 +01:00
Andrew Kelley
31c1320818 ZigLLVMTargetMachineEmitToFile: schedule sancov pass depending on mode
In debug mode, schedule it early. In release modes, schedule it late.
2025-02-11 11:13:41 -08:00
Jacob Young
8d078f1ba2 cbe: fix incomplete array element types
Can't imagine this working, but might as well try until I remember why.

Closes #21439
2025-02-10 17:21:32 -08:00
Jacob Young
74fbcd22e6 cbe: fix crash rendering argument names in lazy functions
Closes #19905
2025-02-10 17:20:52 -08:00
Jacob Young
eb7963e4c7 cbe: emit linksection for @export
Closes #21490
2025-02-10 17:20:09 -08:00
Meghan Denny
9142482372
std.ArrayList: popOrNull() -> pop() [v2] (#22720) 2025-02-10 04:21:31 +00:00
Jacob Young
4e4775d6bd x86_64: implement conversions between scalar floats and ints
Closes #22797
2025-02-09 00:42:55 -08:00
Andrew Kelley
ea1ce2df9b
Merge pull request #22808 from ziglang/fast-gpa
introduce std.heap.SmpAllocator
2025-02-08 04:54:38 -08:00
Jacob Young
ba5e64ff6b x86_64: fix backend assertion failures
Fixes the backend portion of #22798
2025-02-07 23:30:35 -08:00
Meghan Denny
a8af36ab10 std.ArrayHashMap: popOrNul() -> pop() 2025-02-07 17:52:19 -08:00
Andrew Kelley
7360be19a4 compiler: use std.heap.smp_allocator
In main, now this allocator is chosen by default when compiling without
libc in ReleaseFast or ReleaseSmall, and not targeting WebAssembly.
2025-02-07 14:41:49 -08:00
Andrew Kelley
6a6e72fff8
Merge pull request #20511 from archbirdplus
runtime page size detection
rework GeneralPurposeAllocator to reduce active mapping count
Allocator VTable API update
2025-02-07 06:21:51 -08:00
Andrew Kelley
2d4954ad63
Merge pull request #22717 from jacobly0/x86_64-rewrite
x86_64: rewrite `@truncate`
2025-02-07 04:06:50 -08:00
Jacob Young
043e3b29ce x86_64: fix calling convention typos 2025-02-07 07:20:53 +01:00
Isaac Freund
b3c63e5de0 Dwarf: fix cross_section_relocs capacity
This ensure capacity call does not match the number of
appendAssumeCapacity() calls that follow it. Fix this.

This was discovered due to hitting the assertion failure in
appendAssumeCapacity() while building river.

I'm not sure how to isolate a minimal reproducer for a test.
2025-02-07 07:20:13 +01:00
Andrew Kelley
284de7d957 adjust runtime page size APIs
* fix merge conflicts
* rename the declarations
* reword documentation
* extract FixedBufferAllocator to separate file
* take advantage of locals
* remove the assertion about max alignment in Allocator API, leaving it
  Allocator implementation defined
* fix non-inline function call in start logic

The GeneralPurposeAllocator implementation is totally broken because it
uses global state but I didn't address that in this commit.
2025-02-06 14:23:23 -08:00
Archbirdplus
439667be04 runtime page size detection
heap.zig: define new default page sizes
heap.zig: add min/max_page_size and their options
lib/std/c: add miscellaneous declarations
heap.zig: add pageSize() and its options
switch to new page sizes, especially in GPA/stdlib
mem.zig: remove page_size
2025-02-06 14:23:23 -08:00
Matthew Lugg
43e52ec5c5
Merge pull request #22777 from mlugg/some-bugs
Fix a bunch of frontend bugs
2025-02-06 22:19:25 +00:00
Jacob Young
c2718c4803 x86_64: rewrite float @mod 2025-02-06 16:14:53 -05:00
Jacob Young
288d3062d0 x86_64: avoid comparing different transcendental function impls 2025-02-06 16:14:53 -05:00
Jacob Young
96ed1a2b46 x86_64: remove cases that are impossible to lower 2025-02-06 16:14:53 -05:00
Jacob Young
fa9b0fa6d3 x86_64: rewrite most of the remaining float ops 2025-02-06 16:14:53 -05:00
Jacob Young
39119088f9 x86_64: rewrite vector @truncate 2025-02-06 16:14:53 -05:00
Jacob Young
c58e60a042 x86_64: rewrite scalar @truncate 2025-02-06 16:14:53 -05:00
John Benediktsson
1c07eacc7f std.process: adding hasNonEmptyEnvVar() and using for NO_COLOR 2025-02-06 15:00:48 +01:00
mlugg
62e251dcaa incremental: codegen types which are recreated
Unfortunately, I can't easily add a test for this, because the repro
depends on some details of DWARF layout; but I've confirmed that it
fixes a bug repro on another branch.
2025-02-06 08:21:19 +00:00
mlugg
75ec7d863e
Sema: add missing validateRuntimeValue calls
Resolves: #13791
2025-02-06 01:11:10 +00:00
Alex Rønne Petersen
1a1389c513
Merge pull request #19614 from jedisct1/wasi-libc-update
Update wasi-libc to d03829489904d38c624f6de9983190f1e5e7c9c5
2025-02-06 02:10:08 +01:00
mlugg
b21becb2a6
incremental: fix crash when introducing syntax error
Clearing the analysis roots was very clever and all, but not actually
valid. We need to avoid *any* reference to the analysis errors if there
were any fatal files, and that includes sorting the errors!

Resolves: #22774
2025-02-05 22:00:55 +00:00
mlugg
3031d81387
Sema: fix @typeInfo of function with generic return type and IES
Resolves: #20088
2025-02-05 21:26:04 +00:00
mlugg
5317d88414
Sema: fix @errorCast with error unions
Resolves: #20169
2025-02-05 21:17:40 +00:00
mlugg
fbbf34e563
Sema: disable runtime safety checks in comptime blocks
Sometimes we emit runtime instructions in comptime scopes. These
instructions will be discarded, but they allow comptime blocks to
contain intermediate runtime-known values, which is necessary for
expressions like `runtime_array.len` to work.

Since we will always throw away these runtime instructions, including
safety checks is a time waste at best and trips an assertion at worst!

Resolves: #20064
2025-02-05 21:17:40 +00:00
mlugg
cac814cf58
Sema: fix comparison between error set and comptime-known error union
Resolves: #20613
2025-02-05 20:13:56 +00:00
mlugg
9ba9f457be
Sema: add fast path to PTR when all types are the same
I have no idea why I didn't add this when I first implemented this PTR
logic.
2025-02-05 19:56:43 +00:00
mlugg
fbe0ae4fd4
Sema: fix PTR of slice of sentinel-terminated array
Resolves: #20901
2025-02-05 19:53:12 +00:00
mlugg
0f38558435
compiler: provide result type to sentinel expression in slice operation
Resolves: #21867
2025-02-05 19:36:14 +00:00
mlugg
456f3c026b
Sema: fix crash on @tagName of undefined enum literal
Resolves: #20826
2025-02-05 19:08:05 +00:00
mlugg
3ce857d054
Sema: fix incorrectly succeeding type resolution
Resolves: #21436
2025-02-05 18:31:39 +00:00
mlugg
fb481d0bf8
Zcu: fix bug clearing compile errors
And add an assertion in safe builds that our initial check is actually
correct.
2025-02-04 16:20:30 +00:00
mlugg
3ca588bcc6
compiler: integrate importing ZON with incremental compilation
The changes from a few commits earlier, where semantic analysis no
longer occurs if any Zig files failed to lower to ZIR, mean `file`
dependencies are no longer necessary! However, we now need them for ZON
files, to be invalidated whenever a ZON file changes.
2025-02-04 16:20:29 +00:00
mlugg
55a2e535fd
compiler: integrate ZON with the ZIR caching system
This came with a big cleanup to `Zcu.PerThread.updateFile` (formerly
`astGenFile`).

Also, change how the cache manifest works for files in the import table.
Instead of being added to the manifest when we call `semaFile` on them,
we iterate the import table after running the AstGen workers and add all
the files to the cache manifest then.

The downside is that this is a bit more eager to include files in the
manifest; in particular, files which are imported but not actually
referenced are now included in analysis. So, for instance, modifying any
standard library file will invalidate all Zig compilations using that
standard library, even if they don't use that file.

The original motivation here was simply that the old logic in `semaFile`
didn't translate nicely to ZON. However, it turns out to actually be
necessary for correctness. Because `@import("foo.zig")` is an
AstGen-level error if `foo.zig` does not exist, we need to invalidate
the cache when an imported but unreferenced file is removed to make sure
this error is triggered when it needs to be.

Resolves: #22746
2025-02-04 16:20:29 +00:00
mlugg
0907432fff
compiler: a few renames
This is mainly in preparation for integrating ZonGen into the pipeline
properly, although these names are better because `astGenFile` isn't
*necessarily* running AstGen; it may determine that the current ZIR is
up-to-date, or load cached ZIR.
2025-02-04 16:20:29 +00:00
mlugg
a8e53801d0
compiler: don't perform semantic analysis if there are files without ZIR 2025-02-04 16:20:29 +00:00
mlugg
5e20a47469
Zcu: remove unused parse_failure field from File.Status
These are reported as `astgen_failure` instead.
2025-02-04 16:20:29 +00:00
mlugg
d3ca10d5d8
Zcu: remove *_loaded fields on File
Instead, `source`, `tree`, and `zir` should all be optional. This is
precisely what we're actually trying to model here; and `File` isn't
optimized for memory consumption or serializability anyway, so it's fine
to use a couple of extra bytes on actual optionals here.
2025-02-04 16:20:29 +00:00
Mason Remaley
13c6eb0d71
compiler,std: implement ZON support
This commit allows using ZON (Zig Object Notation) in a few ways.

* `@import` can be used to load ZON at comptime and convert it to a
  normal Zig value. In this case, `@import` must have a result type.
* `std.zon.parse` can be used to parse ZON at runtime, akin to the
  parsing logic in `std.json`.
* `std.zon.stringify` can be used to convert arbitrary data structures
  to ZON at runtime, again akin to `std.json`.
2025-02-03 09:14:37 +00:00