aboutsummaryrefslogtreecommitdiff
path: root/src/Compilation.zig
AgeCommit message (Collapse)Author
2024-03-10fix 32 bit compilationAndrew Kelley
2024-03-10autodocs: fix root name and missing dir closeAndrew Kelley
2024-03-10-femit-docs: create main.wasm artifactAndrew Kelley
2024-03-10-femit-docs: creating sources.tarAndrew Kelley
It's always a good day when you get to use File.writeFileAll 😎
2024-03-10frontend: skeleton for creating autodocsAndrew Kelley
This time, unlike the old implementation, it properly does autodoc generation during the compilation pipeline, saving time.
2024-03-10better to use AST than ZIR for doc generationAndrew Kelley
2024-03-07Merge pull request #19190 from mlugg/struct-equivalenceAndrew Kelley
compiler: namespace type equivalence based on AST node + captures
2024-03-06feat: add support for --enable-new-dtags and --disable-new-dtagsDillen Meijboom
2024-03-06Package.Module: deduplicate identical builtin modulesmlugg
Previously, when multiple modules had builtin modules with identical sources, two distinct `Module`s and `File`s were created pointing at the same file path. This led to a bug later in the frontend. These modules are now deduplicated with a simple hashmap on the builtin source.
2024-03-01compiler: audit debug mode checksJacob Young
* Introduce `-Ddebug-extensions` for enabling compiler debug helpers * Replace safety mode checks with `std.debug.runtime_safety` * Replace debugger helper checks with `!builtin.strip_debug_info` Sometimes, you just have to debug optimized compilers...
2024-02-28use hash.addListOfBytes where applicableAndrew Kelley
2024-02-28add missing export symbol names to whole mode wasm cache hashAndrew Kelley
Fixes false positive cache hit.
2024-02-28make aro-based translate-c lazily built from sourceAndrew Kelley
Part of #19063. Primarily, this moves Aro from deps/ to lib/compiler/ so that it can be lazily compiled from source. src/aro_translate_c.zig is moved to lib/compiler/aro_translate_c.zig and some of Zig CLI logic moved to a main() function there. aro_translate_c.zig becomes the "common" import for clang-based translate-c. Not all of the compiler was able to be detangled from Aro, however, so it still, for now, remains being compiled with the main compiler sources due to the clang-based translate-c depending on it. Once aro-based translate-c achieves feature parity with the clang-based translate-c implementation, the clang-based one can be removed from Zig. Aro made it unnecessarily difficult to depend on with these .def files and all these Zig module requirements. I looked at the .def files and made these observations: - The canonical source is llvm .def files. - Therefore there is an update process to sync with llvm that involves regenerating the .def files in Aro. - Therefore you might as well just regenerate the .zig files directly and check those into Aro. - Also with a small amount of tinkering, the file size on disk of these generated .zig files can be made many times smaller, without compromising type safety in the usage of the data. This would make things much easier on Zig as downstream project, particularly we could remove those pesky stubs when bootstrapping. I have gone ahead with these changes since they unblock me and I will have a chat with Vexu to see what he thinks.
2024-02-27move `zig libc` command to be lazily builtAndrew Kelley
part of #19063 This is a prerequisite for doing the same for Resinator.
2024-02-26compiler: JIT zig fmtAndrew Kelley
See #19063
2024-02-26move Zir to std.zig.ZirAndrew Kelley
Part of an effort to ship more of the compiler in source form.
2024-02-25test: rework how filtering worksJacob Young
* make test names contain the fully qualified name * make test filters match the fully qualified name * allow multiple test filters, where a test is skipped if it does not match any of the specified filters
2024-02-09Merge pull request #18875 from ziglang/macho-zo-dwarfJakub Konka
macho: emit DWARF for ZigObject relocatable
2024-02-09Merge pull request #18712 from Vexu/std.optionsAndrew Kelley
std: make options a struct instance instead of a namespace
2024-02-08builtin: enable panic handler on self-hosted machoJakub Konka
comp: toggle compiler-rt and zig-libc caps for macho
2024-02-06Merge pull request #18814 from mlugg/incremental-dependenciesMatthew Lugg
Begin re-implementing incremental compilation
2024-02-05compiler: rename value.zig to Value.zigAndrew Kelley
This commit only does the file rename to be friendlier to version control conflicts.
2024-02-04compiler: lock incremental dependency tracking behind --debug-incrementalmlugg
This logic (currently) has a non-trivial cost (particularly in terms of peak RSS) for tracking dependencies. Until incremental compilation is in use in the wild, it doesn't make sense for users to pay that cost.
2024-02-04Zcu: refactor Decl.analysis fieldmlugg
* Functions failing codegen now set this failure on the function analysis state. Decl analysis `codegen_failure` is reserved for failures generating constant values. * `liveness_failure` is consolidated into `codegen_failure`, as we do not need to distinguish these, and Liveness.Verify is just a debugging feature anyway. * `sema_failure_retryable` and `codegen_failure_retryable` are removed. Instead, retryable failures are recorded in the new `Zcu.retryable_failures` list. On an incremental update, this list is flushed, and all elements are marked as outdated so that we re-attempt analysis and code generation. Also remove the `generation` fields from `Zcu` and `Decl` as these are not needed by our new strategy for incremental updates.
2024-02-04Zcu: incremental compilation improvementsmlugg
* Mark root Decls for re-analysis separately * Check for re-analysis of root Decls * Remove `outdated` entry when analyzing fn body * Remove legacy `outdated` field from Decl analysis state
2024-02-04Zcu: more dependency tracking logicmlugg
* Invalidate `decl_val` dependencies * Recursively mark and un-mark all dependencies correctly * Queue analysis of outdated dependers in `Compilation.performAllTheWork` Introduces logic to invalidate `decl_val` dependencies after `Zcu.semaDecl` completes. Also, recursively un-mark dependencies as PO where needed. With this, all dependency invalidation logic is in place. The next step is analyzing outdated dependencies and triggering appropriate re-analysis.
2024-02-04compiler: re-introduce dependencies for incremental compilationmlugg
Sema now tracks dependencies appropriately. Early logic in Zcu for resolving outdated decls/functions is in place. The setup used does not support `usingnamespace`; compilations using this construct are not yet supported by this incremental compilation model.
2024-02-02Compilation: delete clang diag files afterwardsAndrew Kelley
After parsing diagnostics files from clang we don't have any more use for those tmp files. Delete them to reduce clutter and disk usage.
2024-02-02cli+build: handle -ObjC flag and route it to MachO linkerJakub Konka
2024-02-01remove std.io.ModeVeikka Tuominen
2024-01-26Merge pull request #18654 from mlugg/incremental-the-secondAndrew Kelley
InternPool: introduce TrackedInst to prepare for incremental compilation
2024-01-25Compilation: preserve "builtin" as the first dependencyJacob Young
Previously, sorting dependencies would reorder the builtin dependency and cause `Package.Module.getBuiltinDependency` to stop working.
2024-01-24macho: parse dependent dylibsJakub Konka
2024-01-23InternPool: introduce TrackedInstmlugg
It is problematic for the cached `InternPool` state to directly reference ZIR instruction indices, as these are not stable across incremental updates. The existing ZIR mapping logic attempts to handle this by iterating the existing Decl graph for a file after `AstGen` and update ZIR indices on `Decl`s, struct types, etc. However, this is unreliable due to generic instantiations, and relies on specialized logic for everything which may refer to a ZIR instruction (e.g. a struct's owner decl). I therefore determined that a prerequisite change for incremental compilation would be to rework how we store these indices. This commit introduces a `TrackedInst` type which provides a stable index (`TrackedInst.Index`) for a single ZIR instruction in the compilation. The `InternPool` now stores these values in place of ZIR instruction indices. This makes the ZIR mapping logic relatively trivial: after `AstGen` completes, we simply iterate all `TrackedInst` values and update those indices which have changed. In future, if the corresponding ZIR instruction has been removed, we must also invalidate any dependencies on this instruction to trigger any required re-analysis, however the dependency system does not yet exist.
2024-01-22Fix wrong if condition for windows (#18637)ndbn
Fixes #18594
2024-01-20Merge pull request #18596 from ypsvlq/mingwAndrew Kelley
mingw-w64: add missing CRT sources
2024-01-20Merge pull request #18622 from ziglang/zig-mod-edge-caseAndrew Kelley
build system: better handle modules that do not have a zig root source file
2024-01-19zig cc: expose clang precompiled C header supportXavier Bouchoux
see https://releases.llvm.org/17.0.1/tools/clang/docs/UsersManual.html#generating-a-pch-file syntax examples: `zig cc -x c-header test.h -o test.pch` `zig cc -include-pch test.pch main.c` `zig c++ -x c++-header test.h -o test.pch` `zig c++ -include-pch test.pch main.cpp`
2024-01-19Compilation: avoid caching root source file twiceAndrew Kelley
The deleted lines here are redundant because they happen first thing inside the function call below. Additionally, skip hashing the root source file if it is an empty string. I explored making this field along with `root` optional but found this to be less messy actually.
2024-01-20mingw: update build logicElaine Gibson
2024-01-14compiler: move each_lib_rpath to frontendJan200101
Co-authored-by: Andrew Kelley <andrew@ziglang.org>
2024-01-10Compilation: fix tsan error reportingAndrew Kelley
2024-01-09Add support for `--(no-)undefined-version`dhash
Co-authored-by: Motiejus Jakštys <motiejus@jakstys.lt> Co-authored-by: Jakub Konka <kubkon@jakubkonka.com> Co-authored-by: Samuel Cantero <scanterog@gmail.com> Co-authored-by: Giorgos Georgiou <giorgos.georgiou@datadoghq.com> Co-authored-by: Carl Åstholm <carl@astholm.se>
2024-01-09Merge pull request #18491 from ziglang/fix-mod-link-obj-pathAndrew Kelley
std.Build.Step.Compile: fix link object paths
2024-01-08compilation: fix bad path in error messageAndrew Kelley
2024-01-08Compilation: only add __MSVCRT_VERSION__ for -lcAndrew Kelley
prevents it from being defined twice when building mingw-w64 libs.
2024-01-08Compilation: add definition to prefer ucrt for windows C/C++ filesAndrew Kelley
This makes C/C++ files when targeting mingw-w64 choose to depend on ucrt for stdio.
2024-01-08mingw: update from msvcrt to ucrtAndrew Kelley
2024-01-06Compilation: pass code model in buildOutputFromZigTristan Ross
2024-01-03compiler: fix build runner not added to cache hashAndrew Kelley
Closes #18438