aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Build/Cache.zig
AgeCommit message (Collapse)Author
2023-10-23x86_64: implement 128-bit builtinsJacob Young
* `@clz` * `@ctz` * `@popCount` * `@byteSwap` * `@bitReverse` * various encodings used by std
2023-10-22Revert "Revert "Merge pull request #17637 from jacobly0/x86_64-test-std""Jacob Young
This reverts commit 6f0198cadbe29294f2bf3153a27beebd64377566.
2023-10-22Revert "Merge pull request #17637 from jacobly0/x86_64-test-std"Andrew Kelley
This reverts commit 0c99ba1eab63865592bb084feb271cd4e4b0357e, reversing changes made to 5f92b070bf284f1493b1b5d433dd3adde2f46727. This caused a CI failure when it landed in master branch due to a 128-bit `@byteSwap` in std.mem.
2023-10-21x86_64: fix bugs and disable erroring testsJacob Young
2023-10-08Package.Fetch: fix handling of relative pathsAndrew Kelley
2023-10-08finish hooking up new dependency tree logicAndrew Kelley
* add Module instances for each package's build.zig and attach it to the dependencies.zig module with the hash digest hex string as the name. * fix incorrectly skipping the wrong packages for creating dependencies.zig * a couple more renaming of "package" to "module"
2023-10-08get `zig fetch` working with the new systemAndrew Kelley
* start renaming "package" to "module" (see #14307) - build system gains `main_mod_path` and `main_pkg_path` is still there but it is deprecated. * eliminate the object-oriented memory management style of what was previously `*Package`. Now it is `*Package.Module` and all pointers point to externally managed memory. * fixes to get the new Fetch.zig code working. The previous commit was work-in-progress. There are still two commented out code paths, the one that leads to `Compilation.create` and the one for `zig build` that fetches the entire dependency tree and creates the required modules for the build runner.
2023-08-19Cache: Fix findPrefix when paths are slightly out of the ordinaryRyan Liptak
This makes Cache.findPrefix/findPrefixResolved use `std.fs.path.relative` instead of `std.mem.startsWith` when checking if a file is within a prefix. This fixes multiple edge cases around prefix detection: - If a prefix path ended with a path separator, then the first character of the 'sub_path' would get cut off because the previous implementation assumed it was a path separator. Example: prefix: `/foo/`, file_path: `/foo/abc.txt` would see that they both start with `/foo/` and then slice starting from one byte past the common prefix, ending up with `bc.txt` instead of the expected `abc.txt` - If a prefix contained double path separators after any component, then the `startsWith` check would erroneously fail. Example: prefix: `/foo//bar`, file_path: `/foo/bar/abc.txt` would not see that abc.txt is a sub path of the prefix `/foo//bar` - On Windows, case insensitivity was not respected at all, instead the UTF-8 bytes were compared directly This fixes all of the things in the above list (and possibly more).
2023-08-13std.Build: add support for deps .d file in Step.RunSahnvour
2023-06-24all: migrate code to new cast builtin syntaxmlugg
Most of this migration was performed automatically with `zig fmt`. There were a few exceptions which I had to manually fix: * `@alignCast` and `@addrSpaceCast` cannot be automatically rewritten * `@truncate`'s fixup is incorrect for vectors * Test cases are not formatted, and their error locations change
2023-06-17std: replace builtin.Version with SemanticVersionr00ster91
2023-06-03Merge pull request #15579 from squeek502/mem-delimitersAndrew Kelley
Split `std.mem.split` and `tokenize` into `sequence`, `any`, and `scalar` versions
2023-05-30cache: handle 0-length prefix paths in findPrefixResolvedkcbanner
2023-05-25std.fs.file: Rename File.Lock enum values to snake caseLinus Groh
2023-05-16tweaks to --build-idAndrew Kelley
* build.zig: the result of b.option() can be assigned directly in many cases thanks to the return type being an optional * std.Build: make the build system aware of the std.Build.Step.Compile.BuildId type when used as an option. - remove extraneous newlines in error logs * simplify caching logic * simplify hexstring parsing tests and use a doc test * simplify hashing logic. don't use an optional when the `none` tag already provides this meaning. * CLI: fix incorrect linker arg parsing
2023-05-13Update all std.mem.tokenize calls to their appropriate functionRyan Liptak
Everywhere that can now use `tokenizeScalar` should get a nice little performance boost.
2023-05-11Cache: fix unnecessary cache missesJacob Young
With the old logic, it was possible for a bunch of processes to queue up to update a cache entry, and then each to do so one at a time. Now, it rechecks whether there still a cache miss or another process has completed the work in the interim.
2023-05-11Cache: fix race conditionJacob Young
When checking a cache entry with no input files for a hit, if `createFile` returned `error.WouldBlock` we would forget about the fact that the file has been created, and all future checks will assume that a cache hit has happened, even though one never has or does, leading to rare `FileNotFound` errors trying the access the protected files. This fix works by writing an extra byte to the manifest file to distinguish hits and misses when there no input files to write.
2023-04-28update codebase to use `@memset` and `@memcpy`Andrew Kelley
2023-04-23Improvements to docs and textzooster
* docs(std.math): elaborate on difference between absCast and absInt * docs(std.rand.Random.weightedIndex): elaborate on likelihood I think this makes it easier to understand. * langref: add small reminder * docs(std.fs.path.extension): brevity * docs(std.bit_set.StaticBitSet): mention the specific types * std.debug.TTY: explain what purpose this struct serves This should also make it clearer that this struct is not supposed to provide unrelated terminal manipulation functionality such as setting the cursor position or something because terminals are complicated and we should keep this struct simple and focused on debugging. * langref(package listing): brevity * langref: explain what exactly `threadlocal` causes to happen * std.array_list: link between swapRemove and orderedRemove Maybe this can serve as a TLDR and make it easier to decide. * PrefetchOptions.locality: clarify docs that this is a range This confused me previously and I thought I can only use either 0 or 3. * fix typos and more * std.builtin.CallingConvention: document some CCs * langref: explain possibly cryptic names I think it helps knowing what exactly these acronyms (@clz and @ctz) and abbreviations (@popCount) mean. * variadic function error: add missing preposition * std.fmt.format docs: nicely hyphenate * help menu: say what to optimize for I think this is slightly more specific than just calling it "optimizations". These are speed optimizations. I used the word "performance" here.
2023-04-18Cache: fix multi-process race condition on macOSAndrew Kelley
This fixes `.INVAL => unreachable` being triggered by the cache system on macOS when multiple processes race to create the same compilation. The problem is that when two processes race to create a file, it sometimes returns ENOENT even though that error code is nonsensical for this situation. Commit 2b0929929d67e222ca6a9523a3a594ed456c4a51 purportedly solved this, but it did not open the file with write permissions, leading to the EINVAL panic later on. This commit remedies the situation by introducing a loop and simply retrying when the ENOENT occurs.
2023-04-12Zir: implement explicit block_comptime instructionmlugg
Resolves: #7056
2023-03-15std.Build.Cache: make unit tests not depend on cwdAndrew Kelley
This makes them more resilient to being run multiple times by multiple different processes at the same time.
2023-03-15std.Build.Cache: handle ENOENT on createFile raceAndrew Kelley
Companion commit to 628fec41593a2d2eca8b504e4fe90de9823aeded
2023-03-15std.Build.Cache: handle ENOENT on createFile raceAndrew Kelley
There are no dir components, so you would think that this was unreachable, however we have observed on macOS two processes racing to do openat() with O_CREAT manifest in ENOENT.
2023-03-15std.Build.Cache.Directory: add a format() methodAndrew Kelley
2023-03-03std.Build.Cache: remove 'test-filetimestamp.tmp' once timestamp returnedAli Chraghi
2023-02-13std.Build.Cache: remove debug log statementsAndrew Kelley
Now that this API is used by the build system, these debug logs are problematic because build scripts run in debug mode, making these logs noisy output.
2023-02-13move the cache system from compiler to std libAndrew Kelley