2024-03-10 18:10:51 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-15 21:04:00 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-02-23 16:18:43 -07:00
|
|
|
|
2023-02-28 16:52:35 -07:00
|
|
|
|
|
|
|
|
|
2019-03-02 16:46:04 -05:00
|
|
|
|
|
|
|
|
|
stage2: *WIP*: rework ZIR memory layout; overhaul source locations
The memory layout for ZIR instructions is completely reworked. See
zir.zig for those changes. Some new types:
* `zir.Code`: a "finished" set of ZIR instructions. Instead of allocating
each instruction independently, there is now a Tag and 8 bytes of
data available for all ZIR instructions. Small instructions fit
within these 8 bytes; larger ones use 4 bytes for an index into
`extra`. There is also `string_bytes` so that we can have 4 byte
references to strings. `zir.Inst.Tag` describes how to interpret
those 8 bytes of data.
- This is shared by all `Block` scopes.
* `Module.WipZirCode`: represents an in-progress `zir.Code`. In this
structure, the arrays are mutable, and get resized as we add/delete
things. There is extra state to keep track of things. This struct is
stored on the stack. Once it is finished, it produces an immutable
`zir.Code`, which will remain on the heap for the duration of a
function's existence.
- This is shared by all `GenZir` scopes.
* `Sema`: represents in-progress semantic analysis of a `zir.Code`.
This data is stored on the stack and is shared among all `Block`
scopes. It is now the main "self" argument to everything in the file
that was previously named `zir_sema.zig`.
Additionally, I moved some logic that was in `Module` into here.
`Module.Fn` now stores its parameter names inside the `zir.Code`,
instead of inside ZIR instructions. When the TZIR memory layout
reworking time comes, codegen will be able to reference this data
directly instead of duplicating it.
astgen.zig is (so far) almost entirely untouched, but nearly all of it
will need to be reworked to adhere to this new memory layout structure.
I have no benchmarks to report yet, as I am still working through
compile errors and fixing various things that I broke in this branch.
Overhaul of Source Locations:
Previously we used `usize` everywhere to mean byte offset, but sometimes
also mean other stuff. This was error prone and also made us do
unnecessary work, and store unnecessary bytes in memory.
Now there are more types involved into source locations, and more ways
to describe a source location.
* AllErrors.Message: embrace the assumption that files always have less
than 2 << 32 bytes.
* SrcLoc gets more complicated, to model more complicated source
locations.
* Introduce LazySrcLoc, which can model interesting source locations
with very little stored state. Useful for avoiding doing unnecessary
work when no compile errors occur.
Also, previously, we had `src: usize` on every ZIR instruction. This is
no longer the case. Each instruction now determines whether it even cares
about source location, and if so, how that source location is stored.
This requires more careful work inside `Sema`, but it results in fewer
bytes stored on the heap, without compromising accuracy and power of
compile error messages.
Miscellaneous:
* std.zig: string literals have more helpful result values for
reporting errors. There is now a lower level API and a higher level
API.
- side note: I noticed that the string literal logic needs some love.
There is some unnecessarily hacky code there.
* cut & pasted some TZIR logic that was in zir.zig to ir.zig. This
probably broke stuff and needs to get fixed.
* Removed type/Enum.zig, type/Union.zig, and type/Struct.zig. I don't
think this quite how this code will be organized. Need some more
careful planning about how to implement structs, unions, enums. They
need to be independent Decls, just like a top level function.
2021-03-15 23:38:38 -07:00
|
|
|
|
2022-08-31 13:36:48 +03:00
|
|
|
|
2022-10-29 00:14:51 -07:00
|
|
|
|
2024-02-13 18:30:22 +01:00
|
|
|
|
2021-08-30 19:22:04 -07:00
|
|
|
|
2024-02-26 21:51:19 -07:00
|
|
|
|
2024-02-26 20:58:10 -07:00
|
|
|
|
compiler: introduce ZonGen and make `ast-check` run it for ZON inputs
Currently, `zig ast-check` fails on ZON files, because it tries to
interpret the file as Zig source code. This commit introduces a new
verification pass, `std.zig.ZonGen`, which applies to an AST in ZON
mode.
Like `AstGen`, this pass also converts the AST into a more helpful
format. Rather than a sequence of instructions like `Zir`, the output
format of `ZonGen` is a new datastructure called `Zoir`. This type is
essentially a simpler form of AST, containing only the information
required for consumers of ZON. It is also far more compact than
`std.zig.Ast`, with the size generally being comparable to the size of
the well-formatted source file.
The emitted `Zoir` is currently not used aside from the `-t` option to
`ast-check` which causes it to be dumped to stdout. However, in future,
it can be used for comptime `@import` of ZON files, as well as for
simpler handling of files like `build.zig.zon`, and even by other parts
of the Zig Standard Library.
Resolves: #22078
2024-12-16 00:49:59 +00:00
|
|
|
|
|
|
|
|
|
2020-02-19 01:24:34 -05:00
|
|
|
|
2023-11-24 17:04:52 -08:00
|
|
|
|
2023-11-24 17:09:08 -08:00
|
|
|
|
2024-02-27 17:12:53 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-02-24 12:35:40 +01:00
|
|
|
|
2019-03-02 16:46:04 -05:00
|
|
|
|
2022-03-01 20:51:01 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-08-31 13:36:48 +03:00
|
|
|
|
2022-03-01 20:51:01 -07:00
|
|
|
|
2025-07-18 11:49:22 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-12 21:30:36 +03:00
|
|
|
|
2024-02-03 01:22:56 +00:00
|
|
|
|
2020-06-11 01:22:07 -04:00
|
|
|
|
|
|
|
|
|
2024-02-26 22:26:19 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-08-27 21:20:18 -07:00
|
|
|
|
2024-02-26 22:26:19 -07:00
|
|
|
|
2025-08-27 21:20:18 -07:00
|
|
|
|
2024-02-26 22:26:19 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-01-30 13:02:06 +01:00
|
|
|
|
2024-02-26 22:26:19 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-06-11 01:22:07 -04:00
|
|
|
|
|
|
|
|
|
2024-02-03 01:22:56 +00:00
|
|
|
|
2021-04-08 19:05:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-04-26 20:41:07 -07:00
|
|
|
|
2023-06-22 18:46:56 +01:00
|
|
|
|
2021-04-26 20:41:07 -07:00
|
|
|
|
|
|
|
|
|
2021-04-08 19:05:05 -07:00
|
|
|
|
|
|
|
|
|
2024-02-03 01:22:56 +00:00
|
|
|
|
2021-04-08 19:05:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-06-11 01:22:07 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-04-09 00:19:44 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-07-10 16:58:25 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-04-09 00:19:44 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-04-27 18:26:59 -04:00
|
|
|
|
|
|
|
|
|
2021-04-09 00:19:44 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-04-27 18:26:59 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-04-09 00:19:44 -07:00
|
|
|
|
2020-04-27 18:26:59 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-04-09 00:19:44 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-04-27 18:26:59 -04:00
|
|
|
|
|
|
|
|
|
2020-08-03 21:01:06 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 21:28:06 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-09-24 23:50:15 -07:00
|
|
|
|
2020-06-24 21:28:42 -04:00
|
|
|
|
2025-06-13 04:46:30 -04:00
|
|
|
|
2020-06-24 21:28:42 -04:00
|
|
|
|
2020-09-24 23:50:15 -07:00
|
|
|
|
2023-02-21 18:39:22 +01:00
|
|
|
|
2020-09-24 23:50:15 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-12-04 20:30:32 -07:00
|
|
|
|
2020-09-24 23:50:15 -07:00
|
|
|
|
2024-02-27 17:12:53 -07:00
|
|
|
|
|
|
|
|
|
2021-07-21 12:45:32 -07:00
|
|
|
|
2024-02-27 17:12:53 -07:00
|
|
|
|
2020-09-08 01:11:10 -07:00
|
|
|
|
2024-02-18 20:34:32 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-09-08 01:11:10 -07:00
|
|
|
|
2020-09-29 14:46:40 -07:00
|
|
|
|
2020-09-08 01:11:10 -07:00
|
|
|
|
2021-07-22 14:44:06 -07:00
|
|
|
|
2020-06-24 21:28:42 -04:00
|
|
|
|
2024-08-11 22:11:35 +02:00
|
|
|
|
2020-09-08 01:11:10 -07:00
|
|
|
|
|
|
|
|
|
2024-02-18 20:34:32 -08:00
|
|
|
|
|
|
|
|
|
2024-02-27 17:12:53 -07:00
|
|
|
|
2020-09-24 23:50:15 -07:00
|
|
|
|
2024-02-18 20:34:32 -08:00
|
|
|
|
2020-09-24 23:50:15 -07:00
|
|
|
|
2020-09-29 14:46:40 -07:00
|
|
|
|
2024-02-27 17:12:53 -07:00
|
|
|
|
2020-09-24 23:50:15 -07:00
|
|
|
|
|
|
|
|
|
2020-09-30 00:36:20 -07:00
|
|
|
|
2024-02-27 17:12:53 -07:00
|
|
|
|
2020-09-30 00:36:20 -07:00
|
|
|
|
2020-09-24 23:50:15 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-09-08 01:11:10 -07:00
|
|
|
|
2021-07-22 14:44:06 -07:00
|
|
|
|
2020-09-08 01:11:10 -07:00
|
|
|
|
2020-09-24 23:50:15 -07:00
|
|
|
|
2020-09-08 01:11:10 -07:00
|
|
|
|
|
|
|
|
|
2024-02-18 20:34:32 -08:00
|
|
|
|
|
|
|
|
|
2024-02-27 17:12:53 -07:00
|
|
|
|
2020-09-30 00:36:20 -07:00
|
|
|
|
2024-02-18 20:34:32 -08:00
|
|
|
|
2020-09-30 00:36:20 -07:00
|
|
|
|
2020-09-30 00:53:55 -07:00
|
|
|
|
2024-02-27 17:12:53 -07:00
|
|
|
|
2020-09-30 00:36:20 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-27 17:12:53 -07:00
|
|
|
|
2020-09-30 00:36:20 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-09-08 01:11:10 -07:00
|
|
|
|
2021-07-22 14:44:06 -07:00
|
|
|
|
2020-09-29 16:59:35 -07:00
|
|
|
|
|
|
|
|
|
2024-02-27 17:12:53 -07:00
|
|
|
|
2021-05-19 21:59:21 +02:00
|
|
|
|
2024-02-18 20:34:32 -08:00
|
|
|
|
|
|
|
|
|
2024-02-27 17:12:53 -07:00
|
|
|
|
2021-05-19 21:59:21 +02:00
|
|
|
|
2024-02-18 20:34:32 -08:00
|
|
|
|
2021-05-19 21:59:21 +02:00
|
|
|
|
|
|
|
|
|
2021-07-22 14:44:06 -07:00
|
|
|
|
2020-09-08 01:11:10 -07:00
|
|
|
|
2020-09-29 14:46:40 -07:00
|
|
|
|
2021-01-17 16:18:00 +01:00
|
|
|
|
2020-09-29 14:46:40 -07:00
|
|
|
|
|
|
|
|
|
2021-09-02 15:51:49 -04:00
|
|
|
|
|
|
|
|
|
2022-08-18 18:58:28 -07:00
|
|
|
|
2024-02-27 17:12:53 -07:00
|
|
|
|
2022-08-18 18:58:28 -07:00
|
|
|
|
|
|
|
|
|
2024-02-27 17:12:53 -07:00
|
|
|
|
2022-08-18 18:58:28 -07:00
|
|
|
|
2021-09-02 15:51:49 -04:00
|
|
|
|
2020-06-24 21:28:42 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-16 02:44:55 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
zig build system: change target, compilation, and module APIs
Introduce the concept of "target query" and "resolved target". A target
query is what the user specifies, with some things left to default. A
resolved target has the default things discovered and populated.
In the future, std.zig.CrossTarget will be rename to std.Target.Query.
Introduces `std.Build.resolveTargetQuery` to get from one to the other.
The concept of `main_mod_path` is gone, no longer supported. You have to
put the root source file at the module root now.
* remove deprecated API
* update build.zig for the breaking API changes in this branch
* move std.Build.Step.Compile.BuildId to std.zig.BuildId
* add more options to std.Build.ExecutableOptions, std.Build.ObjectOptions,
std.Build.SharedLibraryOptions, std.Build.StaticLibraryOptions, and
std.Build.TestOptions.
* remove `std.Build.constructCMacro`. There is no use for this API.
* deprecate `std.Build.Step.Compile.defineCMacro`. Instead,
`std.Build.Module.addCMacro` is provided.
- remove `std.Build.Step.Compile.defineCMacroRaw`.
* deprecate `std.Build.Step.Compile.linkFrameworkNeeded`
- use `std.Build.Module.linkFramework`
* deprecate `std.Build.Step.Compile.linkFrameworkWeak`
- use `std.Build.Module.linkFramework`
* move more logic into `std.Build.Module`
* allow `target` and `optimize` to be `null` when creating a Module.
Along with other fields, those unspecified options will be inherited
from parent `Module` when inserted into an import table.
* the `target` field of `addExecutable` is now required. pass `b.host`
to get the host target.
2023-12-02 21:51:34 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-08-28 02:35:53 +01:00
|
|
|
|
zig build system: change target, compilation, and module APIs
Introduce the concept of "target query" and "resolved target". A target
query is what the user specifies, with some things left to default. A
resolved target has the default things discovered and populated.
In the future, std.zig.CrossTarget will be rename to std.Target.Query.
Introduces `std.Build.resolveTargetQuery` to get from one to the other.
The concept of `main_mod_path` is gone, no longer supported. You have to
put the root source file at the module root now.
* remove deprecated API
* update build.zig for the breaking API changes in this branch
* move std.Build.Step.Compile.BuildId to std.zig.BuildId
* add more options to std.Build.ExecutableOptions, std.Build.ObjectOptions,
std.Build.SharedLibraryOptions, std.Build.StaticLibraryOptions, and
std.Build.TestOptions.
* remove `std.Build.constructCMacro`. There is no use for this API.
* deprecate `std.Build.Step.Compile.defineCMacro`. Instead,
`std.Build.Module.addCMacro` is provided.
- remove `std.Build.Step.Compile.defineCMacroRaw`.
* deprecate `std.Build.Step.Compile.linkFrameworkNeeded`
- use `std.Build.Module.linkFramework`
* deprecate `std.Build.Step.Compile.linkFrameworkWeak`
- use `std.Build.Module.linkFramework`
* move more logic into `std.Build.Module`
* allow `target` and `optimize` to be `null` when creating a Module.
Along with other fields, those unspecified options will be inherited
from parent `Module` when inserted into an import table.
* the `target` field of `addExecutable` is now required. pass `b.host`
to get the host target.
2023-12-02 21:51:34 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-24 14:25:47 +01:00
|
|
|
|
2025-08-27 21:20:18 -07:00
|
|
|
|
2025-03-24 14:25:47 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
zig build system: change target, compilation, and module APIs
Introduce the concept of "target query" and "resolved target". A target
query is what the user specifies, with some things left to default. A
resolved target has the default things discovered and populated.
In the future, std.zig.CrossTarget will be rename to std.Target.Query.
Introduces `std.Build.resolveTargetQuery` to get from one to the other.
The concept of `main_mod_path` is gone, no longer supported. You have to
put the root source file at the module root now.
* remove deprecated API
* update build.zig for the breaking API changes in this branch
* move std.Build.Step.Compile.BuildId to std.zig.BuildId
* add more options to std.Build.ExecutableOptions, std.Build.ObjectOptions,
std.Build.SharedLibraryOptions, std.Build.StaticLibraryOptions, and
std.Build.TestOptions.
* remove `std.Build.constructCMacro`. There is no use for this API.
* deprecate `std.Build.Step.Compile.defineCMacro`. Instead,
`std.Build.Module.addCMacro` is provided.
- remove `std.Build.Step.Compile.defineCMacroRaw`.
* deprecate `std.Build.Step.Compile.linkFrameworkNeeded`
- use `std.Build.Module.linkFramework`
* deprecate `std.Build.Step.Compile.linkFrameworkWeak`
- use `std.Build.Module.linkFramework`
* move more logic into `std.Build.Module`
* allow `target` and `optimize` to be `null` when creating a Module.
Along with other fields, those unspecified options will be inherited
from parent `Module` when inserted into an import table.
* the `target` field of `addExecutable` is now required. pass `b.host`
to get the host target.
2023-12-02 21:51:34 -07:00
|
|
|
|
|
|
|
|
|
2025-04-09 16:16:36 +11:00
|
|
|
|
|
|
|
|
|
2023-12-04 20:30:32 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-31 21:54:07 -07:00
|
|
|
|
2023-12-04 20:30:32 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-31 21:54:07 -07:00
|
|
|
|
2023-12-04 20:30:32 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-13 18:30:22 +01:00
|
|
|
|
|
|
|
|
|
2025-06-27 20:05:22 -07:00
|
|
|
|
2025-07-26 10:32:17 -05:00
|
|
|
|
|
|
|
|
|
2025-06-27 20:05:22 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-13 18:30:22 +01:00
|
|
|
|
2025-06-27 20:05:22 -07:00
|
|
|
|
2025-07-26 10:32:17 -05:00
|
|
|
|
|
|
|
|
|
2025-06-27 20:05:22 -07:00
|
|
|
|
|
|
|
|
|
2025-07-26 10:32:17 -05:00
|
|
|
|
|
|
|
|
|
2025-06-27 20:05:22 -07:00
|
|
|
|
|
|
|
|
|
2025-07-26 10:32:17 -05:00
|
|
|
|
|
|
|
|
|
2024-02-26 18:55:23 -07:00
|
|
|
|
|
|
|
|
|
2024-02-13 18:30:22 +01:00
|
|
|
|
|
|
|
|
|
2025-06-27 20:05:22 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-13 18:30:22 +01:00
|
|
|
|
2025-06-27 20:05:22 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-13 18:30:22 +01:00
|
|
|
|
2025-06-27 20:05:22 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-13 18:30:22 +01:00
|
|
|
|
2025-06-27 20:05:22 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-13 18:30:22 +01:00
|
|
|
|
2025-06-27 20:05:22 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-13 18:30:22 +01:00
|
|
|
|
|
|
|
|
|
2025-06-27 20:05:22 -07:00
|
|
|
|
|
|
|
|
|
2024-02-13 18:30:22 +01:00
|
|
|
|
|
|
|
|
|
2025-06-27 20:05:22 -07:00
|
|
|
|
2024-02-26 18:55:23 -07:00
|
|
|
|
2025-06-27 20:05:22 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-13 18:30:22 +01:00
|
|
|
|
|
|
|
|
|
2025-06-27 20:05:22 -07:00
|
|
|
|
2025-07-26 10:32:17 -05:00
|
|
|
|
2025-06-27 20:05:22 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-26 18:55:23 -07:00
|
|
|
|
2025-06-27 20:05:22 -07:00
|
|
|
|
2024-02-26 18:55:23 -07:00
|
|
|
|
2025-06-27 20:05:22 -07:00
|
|
|
|
2025-08-30 14:50:33 -07:00
|
|
|
|
2024-02-26 18:55:23 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-27 20:05:22 -07:00
|
|
|
|
2025-08-30 14:50:33 -07:00
|
|
|
|
2025-07-19 16:59:16 -07:00
|
|
|
|
2024-02-26 18:55:23 -07:00
|
|
|
|
|
|
|
|
|
2025-06-27 20:05:22 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-19 16:59:16 -07:00
|
|
|
|
2025-06-27 20:05:22 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-15 21:04:00 -07:00
|
|
|
|
2024-02-26 18:55:23 -07:00
|
|
|
|
2025-06-27 20:05:22 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-26 18:55:23 -07:00
|
|
|
|
2025-06-27 20:05:22 -07:00
|
|
|
|
2025-07-06 15:51:44 -07:00
|
|
|
|
2025-06-27 20:05:22 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-19 16:59:16 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-27 20:05:22 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-19 16:59:16 -07:00
|
|
|
|
2025-06-27 20:05:22 -07:00
|
|
|
|
2025-07-19 16:59:16 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-26 18:55:23 -07:00
|
|
|
|
2025-07-19 16:59:16 -07:00
|
|
|
|
2024-02-26 18:55:23 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-13 18:30:22 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-08-14 20:34:44 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-15 23:38:18 -07:00
|
|
|
|
2025-08-14 20:34:44 -07:00
|
|
|
|
2025-07-15 21:04:00 -07:00
|
|
|
|
|
|
|
|
|
2025-07-16 13:39:42 -07:00
|
|
|
|
|
|
|
|
|
2025-07-17 09:33:25 -07:00
|
|
|
|
|
|
|
|
|
2025-07-16 13:39:42 -07:00
|
|
|
|
|
|
|
|
|
2025-08-14 20:34:44 -07:00
|
|
|
|
2024-02-26 22:26:19 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-15 21:04:00 -07:00
|
|
|
|
2024-02-26 22:26:19 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-15 21:04:00 -07:00
|
|
|
|
|
|
|
|
|
2025-08-14 20:34:44 -07:00
|
|
|
|
2024-02-26 22:26:19 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-15 21:04:00 -07:00
|
|
|
|
2024-02-26 22:26:19 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-27 17:12:53 -07:00
|
|
|
|
|
|
|
|
|
2025-03-05 03:17:54 +00:00
|
|
|
|
2024-02-27 17:12:53 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-31 21:54:07 -07:00
|
|
|
|
2024-02-27 17:12:53 -07:00
|
|
|
|
|
|
|
|
|
2025-07-15 21:04:00 -07:00
|
|
|
|
2024-02-27 17:12:53 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-05 03:17:54 +00:00
|
|
|
|
2024-02-27 17:12:53 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-31 21:54:07 -07:00
|
|
|
|
2024-02-27 17:12:53 -07:00
|
|
|
|
|
|
|
|
|
2025-07-15 21:04:00 -07:00
|
|
|
|
2024-02-27 17:12:53 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-05 03:17:54 +00:00
|
|
|
|
2024-02-27 17:12:53 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-31 21:54:07 -07:00
|
|
|
|
2024-02-27 17:12:53 -07:00
|
|
|
|
2024-08-28 02:35:53 +01:00
|
|
|
|
2025-07-15 21:04:00 -07:00
|
|
|
|
2024-02-27 17:12:53 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-05 03:17:54 +00:00
|
|
|
|
2024-02-27 17:12:53 -07:00
|
|
|
|
2024-11-05 19:38:01 -08:00
|
|
|
|
|
|
|
|
|
2025-07-31 21:54:07 -07:00
|
|
|
|
2024-11-05 19:38:01 -08:00
|
|
|
|
|
|
|
|
|
2025-07-15 21:04:00 -07:00
|
|
|
|
2024-11-05 19:38:01 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-05 03:17:54 +00:00
|
|
|
|
2024-11-05 19:38:01 -08:00
|
|
|
|
2025-03-05 03:17:54 +00:00
|
|
|
|
2024-02-27 17:12:53 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-01-22 04:16:16 +00:00
|
|
|
|
2024-12-29 16:24:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
compiler: rework emit paths and cache modes
Previously, various doc comments heavily disagreed with the
implementation on both what lives where on the filesystem at what time,
and how that was represented in code. Notably, the combination of emit
paths outside the cache and `disable_lld_caching` created a kind of
ad-hoc "cache disable" mechanism -- which didn't actually *work* very
well, 'most everything still ended up in this cache. There was also a
long-standing issue where building using the LLVM backend would put a
random object file in your cwd.
This commit reworks how emit paths are specified in
`Compilation.CreateOptions`, how they are represented internally, and
how the cache usage is specified.
There are now 3 options for `Compilation.CacheMode`:
* `.none`: do not use the cache. The paths we have to emit to are
relative to the compiler cwd (they're either user-specified, or
defaults inferred from the root name). If we create any temporary
files (e.g. the ZCU object when using the LLVM backend) they are
emitted to a directory in `local_cache/tmp/`, which is deleted once
the update finishes.
* `.whole`: cache the compilation based on all inputs, including file
contents. All emit paths are computed by the compiler (and will be
stored as relative to the local cache directory); it is a CLI error to
specify an explicit emit path. Artifacts (including temporary files)
are written to a directory under `local_cache/tmp/`, which is later
renamed to an appropriate `local_cache/o/`. The caller (who is using
`--listen`; e.g. the build system) learns the name of this directory,
and can get the artifacts from it.
* `.incremental`: similar to `.whole`, but Zig source file contents, and
anything else which incremental compilation can handle changes for, is
not included in the cache manifest. We don't need to do the dance
where the output directory is initially in `tmp/`, because our digest
is computed entirely from CLI inputs.
To be clear, the difference between `CacheMode.whole` and
`CacheMode.incremental` is unchanged. `CacheMode.none` is new
(previously it was sort of poorly imitated with `CacheMode.whole`). The
defined behavior for temporary/intermediate files is new.
`.none` is used for direct CLI invocations like `zig build-exe foo.zig`.
The other cache modes are reserved for `--listen`, and the cache mode in
use is currently just based on the presence of the `-fincremental` flag.
There are two cases in which `CacheMode.whole` is used despite there
being no `--listen` flag: `zig test` and `zig run`. Unless an explicit
`-femit-bin=xxx` argument is passed on the CLI, these subcommands will
use `CacheMode.whole`, so that they can put the output somewhere without
polluting the cwd (plus, caching is potentially more useful for direct
usage of these subcommands).
Users of `--listen` (such as the build system) can now use
`std.zig.EmitArtifact.cacheName` to find out what an output will be
named. This avoids having to synchronize logic between the compiler and
all users of `--listen`.
2025-06-06 20:16:26 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-01-22 15:45:28 +01:00
|
|
|
|
2024-02-26 18:55:23 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-27 17:12:53 -07:00
|
|
|
|
|
|
|
|
|
2024-02-26 18:55:23 -07:00
|
|
|
|
2024-02-27 17:12:53 -07:00
|
|
|
|
2024-02-26 18:55:23 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-27 17:12:53 -07:00
|
|
|
|
2024-03-19 12:46:38 +01:00
|
|
|
|
2025-07-16 19:47:58 -07:00
|
|
|
|
2019-03-02 16:46:04 -05:00
|
|
|
|