120 Commits

Author SHA1 Message Date
pentuppup f4462c0cd7 fix enabling incremental on compile steps without global incremental 2026-06-19 16:09:09 +02:00
Manlio Perillo 369db8bd74 Maker/ScannedConfig: Fix alignment of -fincremental 2026-06-17 08:58:53 +02:00
David Senoner c91727108e Replace usages of ArrayHashMapUnmanaged with array_hash_map.Custom 2026-06-10 16:14:58 +02:00
David Senoner 37651eea89 Replace usages of AutoArrayHashMapUnmanaged with array_hash_map.Auto 2026-06-10 16:14:58 +02:00
David Senoner d23e22c416 Replace usages of StringArrayHashMapUnmanaged with array_hash_map.String 2026-06-10 16:14:53 +02:00
Mason Remaley 431092fa61 Adds a compile step option to toggle incremental compilation 2026-06-09 15:35:24 -07:00
Giuseppe Cesarano cd7ea62a05 Fix red-zone flag generation
Signed-off-by: Giuseppe Cesarano <PecoraInPannaCotta@gmail.com>
2026-06-07 05:09:54 +02:00
Mason Remaley 25e9d22807 Fixes the optimization mode passed to translate C 2026-05-31 05:34:24 +02:00
FalsePattern fee88b30d2 zig build: add CLI argument for printing the configuration cache file path 2026-05-29 19:12:32 +02:00
mlugg 3f1dead2fc Merge pull request 'Use struct-of-arrays style for std.lang.Type' (#35234) from Der_Teufel/zig:soa-builtin-type into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/35234
2026-05-28 09:45:54 +02:00
Andrew Kelley ba634c44ba Maker.Step.Run: fix not printing failed command
regressed in 349053e322

I added comments to help prevent this regression in the future.
2026-05-27 13:04:19 -07:00
Krzysztof Wolicki 9e80795623 all: update to use new std.lang.Type definitions 2026-05-27 10:03:51 +01:00
Alex Rønne Petersen 333724ff77 Maker.Step.Run: set WASMTIME_BACKTRACE_DETAILS=1 by default for Wasmtime
Similar in spirit to what we do with WINEDEBUG when using Wine, i.e. provide
more helpful defaults.
2026-05-27 07:52:49 +02:00
Andrew Kelley d0c6ed189b Maker: fix Target deserialization
more disciplined Target / Query separation even though they're both
serialized in the same struct
2026-05-27 03:04:31 +02:00
Andrew Kelley 4d56c66362 Merge pull request 'Maker: memory usage optimizations' (#35471) from build-runner-process into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/35471
2026-05-27 00:48:11 +02:00
Andrew Kelley fd63f57cd8 build system: update more usize to u64 for maxrss
makes the build system compile on 32 bit systems

bonus, also fix incorrectly passing advanced debug options to the maker
process which doesn't care about them
2026-05-26 09:50:48 -07:00
Sertonix 8455563ed8 Fix build script compilation when usize is u32
On 32-bit systems usize is not u64 but it was assumed in multiple places
of the build script.

Sometimes using u64 instead of usize since available and used memory can
exceed usize on 32-bit systems (just like totalSystemMemory)

Example errors:

lib/compiler/build_runner.zig:508:26: error: expected type 'usize', found 'u64'
        .available_rss = max_rss,
                         ^~~~~~~
lib/compiler/build_runner.zig:508:26: note: unsigned 32-bit int cannot represent all possible unsigned 64-bit values
referenced by:
    callMain [inlined]: lib/std/start.zig:699:88
    callMainWithArgs [inlined]: lib/std/start.zig:638:20
    posixCallMainAndExit: lib/std/start.zig:590:38
    2 reference(s) hidden; use '-freference-trace=5' to see all references
lib/std/Build/WebServer.zig:849:38: error: expected type 'usize', found 'u64'
    const buf = gpa.realloc(old_buf, new_len) catch @panic("out of memory");
                                     ^~~~~~~
lib/std/Build/WebServer.zig:849:38: note: unsigned 32-bit int cannot represent all possible unsigned 64-bit values
lib/std/mem/Allocator.zig:399:58: note: parameter type declared here
pub fn realloc(self: Allocator, old_mem: anytype, new_n: usize) Error!@TypeOf(old_mem) {
                                                         ^~~~~
build.zig:548:10: error: type 'usize' cannot represent integer value '9300000000'
        .max_rss = 9_300_000_000,
        ~^~~~~~~~~~~~~~~~~~~~~~~
build.zig:778:10: error: type 'usize' cannot represent integer value '8000000000'
        .max_rss = 8_000_000_000,
        ~^~~~~~~~~~~~~~~~~~~~~~~
2026-05-26 09:43:39 -07:00
Andrew Kelley 349053e322 Maker: memory usage optimizations
- choose smp_allocator depending on optimization mode
- organize the globals
- avoid pessimistically allocating failed command string
- recover the PkgConfig memory
- recover the memory from captureChildProcess
- make Step.result_stderr gpa-owned so it doesn't leak when a step that
  fails with stderr is re-run
- recover memory from evalZigTest and evalGeneric child process stdio
  streams
2026-05-26 09:03:34 -07:00
Andrew Kelley 1d750d7067 Maker.Step.Run: fix leak in evalGeneric 2026-05-25 20:34:44 -07:00
Andrew Kelley 5b022623cf Maker.Step.Compile: fix memory leak in checkCompileErrors 2026-05-25 20:17:41 -07:00
Andrew Kelley f3dd10d40f Maker: add --debug-maker-leaks flag and fix some leaks 2026-05-25 20:14:34 -07:00
Andrew Kelley 66f0564c3a Maker.Watch: clean up a couple error logs 2026-05-25 19:27:16 -07:00
Andrew Kelley cb1f3e0ac4 Maker.Step.Compile: leak into the global arena less 2026-05-25 19:27:16 -07:00
Andrew Kelley 198f35c98c Maker: restore commit: clear step inputs when resetting the step
I'm a bit confused because my understanding is that each step is
supposed to make its own decision about whether to clear its watch
inputs and start over, or retain them from the previous update. However,
without this fix in place, the problem from #35224 manifests itself
again.

Since this fix is in place in master branch, I'll leave it for now and
audit the file watching logic later.
2026-05-25 18:54:37 -07:00
Andrew Kelley 860d5ab9c4 Maker: implement relativePath with non-empty subpath for zig_exe 2026-05-25 18:54:36 -07:00
Andrew Kelley 35ee3747eb Maker.Step: avoid unnecessary compilation failure
On s390x the cache line size is 256 so this check was failing. That's
not useful, just check only for more common cache line sizes.
2026-05-25 18:54:36 -07:00
Andrew Kelley bd1b47733b zig build: remove --build-runner CLI parameter
There is no concept of a "build runner" any more; it has been split in two:
configurer and maker.

Users of this feature will likely want to no longer override any logic, and
instead consume the configuration file produced by configurer.

If overriding one or the other of these is desired, the feature will need to be
re-introduced (as --override-maker or --override-configurer).
2026-05-25 18:54:36 -07:00
Andrew Kelley 1aa65d094e Maker.Step.Run: leak into global arena less
There are still some uses:
- fuzzing
- generated paths (will require adjusting all step logic)
- Step.result_stderr
2026-05-25 18:54:36 -07:00
Andrew Kelley 9eb85c4e5e build system: track TODOs outside source code
related to #363
2026-05-25 18:54:36 -07:00
Andrew Kelley 65c96c4035 Maker.Step.Run: add missing PATH entries for DLLs 2026-05-25 18:54:36 -07:00
Andrew Kelley d1a4462032 Maker.Step.InstallArtifact: use gpa for fs walking 2026-05-25 18:54:36 -07:00
Andrew Kelley c5517102e7 Maker: delete ConfigHeader unit tests
these will work better as standalone tests that exercise the std.Build
API.
2026-05-25 18:54:36 -07:00
Andrew Kelley c0504a8fa8 fuzzer: get it working again 2026-05-25 18:54:36 -07:00
Andrew Kelley 0aa613d9bf Maker.Step.Run: fix passing -L to qemu 2026-05-25 18:54:36 -07:00
Andrew Kelley ed492ff51c Maker.Step.WriteFile: fix not creating dir entries 2026-05-25 18:54:36 -07:00
Andrew Kelley 9b6dd7ee5c zig build CLI: change --debug-maker to --maker-opt=[mode]
the --debug- prefixed args are reserved for compiler debugging flags.
2026-05-25 18:54:36 -07:00
Andrew Kelley bd84824d9f Maker: fix compilation on BSDs 2026-05-25 18:54:36 -07:00
Andrew Kelley fed031031d Maker: fix compilation on windows 2026-05-25 18:54:36 -07:00
Andrew Kelley b069a2eb21 Maker: update macos file watching code to new api 2026-05-25 18:54:36 -07:00
Andrew Kelley 05fbeb4ea7 Maker.Step.Run: fix wrong allocator used 2026-05-25 18:54:36 -07:00
Andrew Kelley 2edeeb5a64 zig build: add CLI usage for --print-configuration 2026-05-25 18:54:36 -07:00
Andrew Kelley 9989f72c61 Maker: implement ConfigHeader 2026-05-25 18:54:36 -07:00
Andrew Kelley e435299cfa Maker: progress towards ConfigHeader
however... why is this done in the make phase anyway? making a header
like this is typically done by the configure phase...
2026-05-25 18:54:36 -07:00
Andrew Kelley ed1f005826 Maker: finish implementing Step.Compile.appendIncludeDirFlags 2026-05-25 18:54:36 -07:00
Andrew Kelley 31c159c228 Maker: implement CheckFile 2026-05-25 18:54:36 -07:00
Andrew Kelley 92038675af zig build: implement findProgram (not lazy) 2026-05-25 18:54:36 -07:00
Andrew Kelley 1edc5d7d67 Maker: implement FindProgram (lazy) 2026-05-25 18:54:36 -07:00
Andrew Kelley 54bb8d2dd9 implement the concept of configure cache poisoning 2026-05-25 18:54:36 -07:00
Andrew Kelley df8aaad058 maker: extract some pkg-config logic into reusable API 2026-05-25 18:54:36 -07:00
Andrew Kelley a874e729df zig build: remove "cc args" from Run steps
Not sure what I was thinking. This is silly, translate-c package simply
needs to pass this data (link_libc and target) to the CLI application,
which can then do the appropriate behavior.
2026-05-25 18:54:36 -07:00