* introduce std.ArrayListUnmanaged for when you have the allocator
stored elsewhere
* move std.heap.ArenaAllocator implementation to its own file. extract
the main state into std.heap.ArenaAllocator.State, which can be
stored as an alternative to storing the entire ArenaAllocator, saving
24 bytes per ArenaAllocator on 64 bit targets.
* std.LinkedList.Node pointer field now defaults to being null
initialized.
* Rework self-hosted compiler Package API
* Delete almost all the bitrotted self-hosted compiler code. The only bit
rotted code left is in main.zig and compilation.zig
* Add call instruction to ZIR
* self-hosted compiler ir API and link API are reworked to support
a long-running compiler that incrementally updates declarations
* Introduce the concept of scopes to ZIR semantic analysis
* ZIR text format supports referencing named decls that are declared
later in the file
* Figure out how memory management works for the long-running compiler
and incremental compilation. The main roots are top level
declarations. There is a table of decls. The key is a cryptographic
hash of the fully qualified decl name. Each decl has an arena
allocator where all of the memory related to that decl is stored.
Each code block has its own arena allocator for the lifetime of
the block. Values that want to survive when going out of scope in
a block must get copied into the outer block. Finally, values must
get copied into the Decl arena to be long-lived.
* Delete the unused MemoryCell struct. Instead, comptime pointers are
based on references to Decl structs.
* Figure out how caching works. Each Decl will store a set of other
Decls which must be recompiled when it changes.
This branch is still work-in-progress; this commit breaks the build.
This new name (and the fact that it is a function returning a type) will
make it more clear which use cases are better suited for ArrayList and
which are better suited for ArrayListSentineled.
Also for consistency with ArrayList,
* `append` => `appendSlice`
* `appendByte` => `append`
Thanks daurnimator for pointing out the confusion of std.Buffer.
Previously, the compiler had special logic to determine whether to
include the startup code, which was in `std/special/start.zig`. Now,
the file is moved to `std/start.zig`, and there is no special logic
in the compiler. Instead, the standard library unconditionally imports
the `start.zig` file, which then has a `comptime` block that does the
logic of determining what, if any, start symbols to export. Instead of
`start.zig` being in its own special package, it is just another normal
file that is part of the standard library.
`std.builtin.TestFn` is now part of the standard library rather than
specially generated by the compiler.
* All the data types from `@import("builtin")` are moved to
`@import("std").builtin`. The target-related types are moved
to `std.Target`. This allows the data types to have methods, such as
`std.Target.current.isDarwin()`.
* `std.os.windows.subsystem` is moved to
`std.Target.current.subsystem`.
* Remove the concept of the panic package from the compiler
implementation. Instead, `std.builtin.panic` is always the panic
function. It checks for `@hasDecl(@import("root"), "panic")`,
or else provides a default implementation.
This is an important step for multibuilds (#3028). Without this change,
the types inside the builtin namespace look like different types, when
trying to merge builds with different target settings. With this change,
Zig can figure out that, e.g., `std.builtin.Os` (the enum type) from one
compilation and `std.builtin.Os` from another compilation are the same
type, even if the target OS value differs.