Commit Graph

576 Commits

Author SHA1 Message Date
Andrew Kelley 5c7343bdbf configurer: fix bad serialization of strings in run args 2026-04-19 12:45:35 -07:00
Andrew Kelley 05ae86bc6b fix compilation errors from rebase conflicts 2026-04-19 10:56:47 -07:00
Andrew Kelley 7c2161b372 maker: upgrade some of the run step logic 2026-04-19 10:56:47 -07:00
Andrew Kelley b4d6f44704 configurer: serialize all data from run steps 2026-04-19 10:56:47 -07:00
Andrew Kelley 11c770c570 configurer: make string duplication also intern
I had this idea to make b.dupe() also intern the strings since they will
be ultimately serialized to Configuration. Unfortunately the idea does
not work, because although a process-lived arena is used for the
string_bytes ArrayList of the Configuration.Wip, when the ArrayList is
resized, Allocator.free() memsets the freed memory to undefined, even
though it still technically lives due to being in a process-scoped
arena. So this commit will need to be partially reverted. However, I
kept it for posterity, and there are some more changes which I will now
note below.

- dupePaths: don't rewrite backslashes to forward slashes. backslashes
  are valid in filenames on non-windows systems.
- always compile configurer in single-threaded mode
- use arena allocator for everything, no gpa for anything
- construct the Configuration.Wip instance earlier, so some stuff can be
  prepopulated as desired.
- don't forget to flush
2026-04-19 10:56:47 -07:00
Andrew Kelley 4e75f97040 maker: implement TopLevel step 2026-04-19 10:56:47 -07:00
Andrew Kelley 7bf2e396f6 maker: implement InstallArtifact and InstallFile 2026-04-19 10:56:47 -07:00
Andrew Kelley 52d220298d maker: finish migrating compile step make logic 2026-04-19 10:56:47 -07:00
Andrew Kelley c2e2c7f5e4 maker: finish lowering compile step CLI args 2026-04-19 10:56:47 -07:00
Andrew Kelley b10adca787 Configuration: fix bad serialization of PrefixedList and MultiList
Length zero is still serialized because there is no flag bit to hide the
length.
2026-04-19 10:56:47 -07:00
Andrew Kelley f741ecadb1 maker: finish migrating most of CLI lowering code 2026-04-19 10:56:47 -07:00
Andrew Kelley 059d9924ab maker: progress towards lowering zig cli args 2026-04-19 10:56:47 -07:00
Andrew Kelley a1a670d6b4 zig build: add --debug-maker CLI flag
for changing the optimization mode of the maker executable
2026-04-19 10:56:47 -07:00
Andrew Kelley e5c7c510ae build system: implement LazyPath
Number of generated files is recorded in serialized Configuration. Maker
preallocates array of generated files so that loads and stores can be
synchronization-free (protected by the dependency tree ordering).

More progress on Compile Step Zig CLI lowering.
2026-04-19 10:56:47 -07:00
Andrew Kelley 9c1219f96f maker: progress towards lowering Compile Step CLI args
next thing to do is figure out how LazyPath is supposed to work now.
something like this:
* each Step that provides LazyPath objects has a setLazyPath and
  getLazyPath function which takes a tagged union identifying which one
  to access
* steps that fulfill LazyPath objects can freely call setLazyPath
  without obtaining a lock because the dependency graph prevents
  simultaneous access.
* similarly, steps that access LazyPath results can freely call
  getLazyPath without obtaining a lock, because after modification,
  there may be simultaneous reads from dependencies but they will all be
  read-only
* a fulfilled LazyPath object is a read-only std.Build.Cache.Path.
2026-04-19 10:56:47 -07:00
Andrew Kelley 8da1fad1df Configuration: serialize remaining CSourceFiles information 2026-04-19 10:56:47 -07:00
Andrew Kelley d8f174aa00 maker: implement module printing 2026-04-19 10:56:47 -07:00
Andrew Kelley 10e1fe282a Configuration: serialize remaining Module information
also handle properly Module circular references and introduce a general
deduplication mechanism.
2026-04-19 10:56:47 -07:00
Andrew Kelley 5a1e6d434b Configuration: complete serialization of Compile steps 2026-04-19 10:56:46 -07:00
Andrew Kelley 3962d87bb2 maker: progress towards updating zig CLI lowering 2026-04-19 10:56:46 -07:00
Andrew Kelley 56ec3614d9 Configuration: implement UnionList storage 2026-04-19 10:56:46 -07:00
Andrew Kelley 72f517a606 rename configure_runner to configurer 2026-04-19 10:56:46 -07:00
Andrew Kelley e525962631 configurer: serialize 3 more Module fields 2026-04-19 10:56:46 -07:00
Andrew Kelley 4a2c193179 Configuration: implement FlagLengthPrefixedList 2026-04-19 10:56:46 -07:00
Andrew Kelley 2bcacd2c88 Configuration: implement Storage.EnumOptional 2026-04-19 10:56:46 -07:00
Andrew Kelley e848b540a4 ScannedConfig: more general zon printing
it's almost all automated now
2026-04-19 10:56:46 -07:00
Andrew Kelley 518588e9fc Configuration: type safety for extended pattern 2026-04-19 10:56:46 -07:00
Andrew Kelley bb73f10e26 Maker: don't include non-root top level steps 2026-04-19 10:56:46 -07:00
Andrew Kelley cac086c26a ScannedConfig: print Step.TopLevel 2026-04-19 10:56:46 -07:00
Andrew Kelley cd3219d610 ScannedConfig: print Step header data 2026-04-19 10:56:46 -07:00
Andrew Kelley 3a55ea0fb8 Maker: move ScannedConfig to separate file 2026-04-19 10:56:46 -07:00
Andrew Kelley 46545d1f8d std.Build.Configure: implement FlagOptional serialization 2026-04-19 10:56:46 -07:00
Andrew Kelley 45aedaae94 zig build: make --error-limit globally configurable
still overridable by individual Compile steps
2026-04-19 10:56:46 -07:00
Andrew Kelley a349922261 Maker.Step.Compile: progress towards lowering zig args 2026-04-19 10:56:46 -07:00
Andrew Kelley 82e3f0d619 massage Step code into compiling 2026-04-19 10:56:46 -07:00
Andrew Kelley 7a9ec695b8 build maker: rename files to match type 2026-04-19 10:56:46 -07:00
Andrew Kelley e80d42af11 build maker: rename Run to Maker 2026-04-19 10:56:46 -07:00
Andrew Kelley fe759791ef make runner: execute step graph 2026-04-19 10:56:46 -07:00
Andrew Kelley 21d76c5bb5 make runner: prepare steps for execution 2026-04-19 10:56:46 -07:00
Andrew Kelley e88fdc72ee make runner gets compiled and run
and --print-configuration prints some deserialized stuff
2026-04-19 10:56:46 -07:00
Andrew Kelley 6b3d0cee1f configure runner: implement builderToPackage 2026-04-19 10:56:46 -07:00
Andrew Kelley cfa0b7cd95 configure runner: serialization of Module 2026-04-19 10:56:46 -07:00
Andrew Kelley 33428c6f1f configure runner: serialization of compile step 2026-04-19 10:56:46 -07:00
Andrew Kelley acf57b8244 configure runner: add Step.Run serialization 2026-04-19 10:56:46 -07:00
Andrew Kelley c3168cf25a configure runner: implement serialization of InstallArtifact 2026-04-19 10:56:46 -07:00
Andrew Kelley af30dbf9af zig build: configure runner basics implemented 2026-04-19 10:56:46 -07:00
Andrew Kelley a41ad3a702 configure/make phase process separation sketch
`zig build` CLI kicks off async task to compile optimized make runner
executable, does fetch, compiles configure process in debug mode, then
checks cache for the CLI options that affect configuration only. On hit,
skips building/running the configure script. On miss, runs it, saves
result in cache.

The cached artifact is a "configuration" file - a serialized build step
graph, which also includes unlazy package dependencies and additional
file system dependencies.

Next, awaits task for compiling optimized make runner executable, passes
configuration file to it. Make runner is responsible for the CLI after
that point.

For the use case of detecting when `git describe` needs to be rerun, we
can allow the configure process to manually add a file system mtime
dependencies, in this case it would be on `.git/index` and `.git/HEAD`.

This will enable two optimizations:

1. The bulk of the build system will not be rebuilt when user changes
   their configure script.

2. The user logic can be completely bypassed when the CLI options
   provided do not affect the configure phase - even if they affect the
   make phase.

Remaining tasks in the branch:

* some stuff in `zig build` CLI is `@panic("TODO")`.
* configure runner needs to implement serialization of build graph using
  std.zig.Configuration
* build runner needs to be transformed into make runner, consuming
  configuration file as input and deserializing the step graph.
* introduce depending only on a file's metadata and *not* its contents
  into the cache system, and add a std.Build API for using it.
2026-04-19 10:56:46 -07:00
Mason Remaley e2c3920fb1 Renames buffer first allocator in compiler and std 2026-04-18 14:51:49 -07:00
Mason Remaley 8c96487bb9 Updates all uses of StackFallbackAllocator 2026-04-18 14:51:49 -07:00
Sam Connelly 17e0afd0e5 feat: init eZ80 arch via CBE 2026-04-16 19:21:16 +02:00