Commit Graph

29894 Commits

Author SHA1 Message Date
Andrew Kelley
768cb7e406 objcopy: use the fatal helper method 2024-07-12 00:14:08 -07:00
Andrew Kelley
dad07fb6f3 std.Build.Cache.Path: fix hash impl on windows 2024-07-12 00:14:08 -07:00
Andrew Kelley
2e42969786 std.Build.Step.Run: integrate with --watch 2024-07-12 00:14:08 -07:00
Andrew Kelley
6fcb1897d2 std.Build.Step.WriteFile: remove random bytes from cache hash
The cache hash already has the zig version in there, so it's not really
needed.
2024-07-12 00:14:08 -07:00
Andrew Kelley
a966eee090 std.Build.Step.WriteFile: fix handling of directories
and add file system watching integration.

`addDirectoryWatchInput` now returns a `bool` which helps remind the
caller to
1. call addDirectoryWatchInputFromPath on any derived paths
2. but only if the dependency is not already captured by a step
   dependency edge.

The make function now recursively walks all directories and adds the
found files to the cache hash rather than incorrectly only adding the
directory name to the cache hash.

closes #20571
2024-07-12 00:14:08 -07:00
Andrew Kelley
f2856403c6 introduce std.Build.Cache.Manifest.addFilePath
and deprecate `addFile`. Part of an effort to move towards using
`std.Build.Cache.Path` abstraction in more places, which makes it easier
to avoid absolute paths and path resolution.
2024-07-12 00:14:08 -07:00
Andrew Kelley
5c3fae3a32 td.Build.Step.InstallDir: leave hint for wrong cached status
Since I spent a couple minutes debugging this, hopefully this saves
someone some future trouble doing the same.
2024-07-12 00:14:08 -07:00
Andrew Kelley
61d2234743 std.Build.Watch: add ONDIR to fanotify event mask
This makes mkdir/rmdir events show up.
2024-07-12 00:14:08 -07:00
Andrew Kelley
b6ed833083 build runner: ignore ENOENT of fanotify_mark REMOVE
This happens when deleting watched directories and is harmless.
2024-07-12 00:14:08 -07:00
Andrew Kelley
2ebf021061 build runner: don't pass a dirfd + null to fanotify_mark
Otherwise it reports EBADF.
2024-07-12 00:14:08 -07:00
Andrew Kelley
7bccef3e4e std.Build.Watch: introduce special file "." to watch entire dir
And use it to implement InstallDir Step watch integration.

I'm not seeing any events triggered when I run `mkdir` in the watched
directory, however, and I have not yet figured out why.
2024-07-12 00:14:08 -07:00
Andrew Kelley
26bdc836d2 std.Build.LazyPath: add getPath3; deprecate getPath2 and getPath
The goal is to move towards using `std.Build.Cache.Path` instead of
absolute path names.

This was helpful for implementing file watching integration to
the InstallDir Step
2024-07-12 00:14:08 -07:00
Andrew Kelley
0994e22a64 build runner: more useful failure handling for fanotify_mark 2024-07-12 00:14:08 -07:00
Andrew Kelley
dcbb3aa1f3 std.Build.Cache.Path: fix format function for absolute paths 2024-07-12 00:14:08 -07:00
Andrew Kelley
d1c14f2f52 std.Build.Step.WriteFile: extract UpdateSourceFiles
This has been planned for quite some time; this commit finally does it.

Also implements file system watching integration in the make()
implementation for UpdateSourceFiles and fixes the reporting of step
caching for both.

WriteFile does not yet have file system watching integration.
2024-07-12 00:14:08 -07:00
Andrew Kelley
0cc492a272 make more build steps integrate with the watch system 2024-07-12 00:14:08 -07:00
Andrew Kelley
956f1ebc70 std.Build.Watch: gracefully handle fanotify queue overflow 2024-07-12 00:14:08 -07:00
Andrew Kelley
e712ca595f std.os.linux: type safety for fanotify metadata event mask field 2024-07-12 00:14:08 -07:00
Andrew Kelley
e6b6a728b3 build runner: fix build summary painting over CLI progress
by obtaining the stderr lock when printing the build summary
2024-07-12 00:14:07 -07:00
Andrew Kelley
001ff7b3b2 std.Build.Watch: make dirty steps invalidate each other
and make failed steps always be invalidated
and make steps that don't need to be reevaluated marked as cached
2024-07-12 00:14:07 -07:00
Andrew Kelley
6f89824c22 build system: make debounce interval CLI-configurable 2024-07-12 00:14:07 -07:00
Andrew Kelley
5ee3971b18 proof-of-concept --watch implementation based on fanotify
So far, only implemented for InstallFile steps.

Default debounce interval bumped to 50ms. I think it should be
configurable.

Next I have an idea to simplify the fanotify implementation, but other
OS implementations might want to refer back to this commit before I make
those changes.
2024-07-12 00:14:07 -07:00
Andrew Kelley
c5a4177140 std.os.linux: add AT.HANDLE_FID 2024-07-12 00:14:07 -07:00
Andrew Kelley
bbd90a562e build runner: implement --watch (work-in-progress)
I'm still learning how the fanotify API works but I think after playing
with it in this commit, I finally know how to implement it, at least on
Linux. This commit does not accomplish the goal but I want to take the
code in a different direction and still be able to reference this point
in time by viewing a source control diff.

I think the move is going to be saving the file_handle for the parent
directory, which combined with the dirent names is how we can correlate
the events back to the Step instances that have registered file system
inputs. I predict this to be similar to implementations on other
operating systems.
2024-07-12 00:14:07 -07:00
Andrew Kelley
deea36250f std.Build.Cache.Path: add subPathOpt and TableAdapter
Helpful methods when using one of these structs as a hash table key.
2024-07-12 00:14:07 -07:00
Andrew Kelley
6c64090e7a std.os.linux: fanotify_init, fanotify_mark, name_to_handle_at
* Delete existing `FAN` struct in favor of a `fanotify` struct which has
  type-safe bindings (breaking).
* Add name_to_handle_at syscall wrapper.
* Add file_handle
* Add kernel_fsid_t
* Add fsid_t
* Add and update std.posix wrappers.
2024-07-12 00:14:07 -07:00
Andrew Kelley
26d506c0f8 std.Build: remove the "push installed file" mechanism
Tracked by #14943
2024-07-12 00:14:07 -07:00
Andrew Kelley
6e025fc2e2 build system: add --watch flag and report source file in InstallFile
This direction is not quite right because it mutates shared state in a
threaded context, so the next commit will need to fix this.
2024-07-12 00:14:07 -07:00
Andrew Kelley
d2bec8f92f delete dead CLI usage code from main.zig 2024-07-12 00:14:07 -07:00
Andrew Kelley
908c2c902a std.Build.Cache.Path: add eql method 2024-07-12 00:14:07 -07:00
Igor Anić
ca752c61c0 tls.Client: fix out of bounds panic
When calculating how much ciphertext from the stream can fit into
user and internal buffers we should also take into account ciphertext
data which are already in internal buffer.

Fixes: 15226

Tested with
[this](https://github.com/ziglang/zig/issues/15226#issuecomment-2218809140).
Using client with different read buffers until I, hopefully, understood
what is happening.

Not relevant to this fix, but this
[part](95d9292a7a/lib/std/crypto/tls/Client.zig (L988-L991))
is still mystery to me. Why we don't use free_size in buf_cap
calculation. Seems like rudiment from previous implementation without iovec.
2024-07-12 03:07:15 -04:00
Matthew Lugg
80d7e260d7
Merge pull request #20570 from jacobly0/fix-races
InternPool: fix more races blocking a separate codegen/linker thread
2024-07-11 23:27:13 +01:00
Ryan Sepassi
45be803646
Update __chkstk_ms to have weak linkage (#20138)
* Update `__chkstk_ms` to have weak linkage

`__chkstk_ms` was causing conflicts during linking in some circumstances (specifically with linking object files from Rust sources). This PR switches `__chkstk_ms` to have weak linkage.

#15107

* Update stack_probe.zig to weak linkage for all symbols
2024-07-11 20:20:06 +00:00
Jacob Young
77810f2882 InternPool: fix optimization assertion failure 2024-07-10 22:56:12 -04:00
Jacob Young
c79d3e4aab Compilation: fix leak 2024-07-10 22:05:52 -04:00
Jacob Young
c2316c5228 InternPool: make global_error_set thread-safe 2024-07-10 21:39:55 -04:00
Jacob Young
98f3a262a7 InternPool: fix extra mutation races 2024-07-10 19:03:07 -04:00
Jacob Young
2c89f3b654 InternPool: make maps thread-safe 2024-07-10 19:02:55 -04:00
Jacob Young
afa66fa392 InternPool: make tracked_insts thread-safe 2024-07-10 14:42:50 -04:00
Jacob Young
f290b54f89 InternPool: make files more thread-safe 2024-07-10 11:20:08 -04:00
Jacob Young
8f292431b0 InternPool: fix undefined decl fully qualified name
This is now possible after moving `File.Index` to `*File` mapping into
intern pool.
2024-07-10 11:20:08 -04:00
Jacob Young
3d2dfbe828 InternPool: add FileIndex to *File mapping 2024-07-10 11:20:08 -04:00
mlugg
f93a10f664 Air: store param names directly instead of referencing Zir 2024-07-10 11:20:08 -04:00
Jacob Young
3aa48bf859 InternPool: fix race on struct flags 2024-07-10 11:10:49 -04:00
Jacob Young
9cf42b1036 InternPool: fix race on FuncInstance.branch_quota 2024-07-10 11:10:49 -04:00
Jacob Young
667b4f9054 Zcu: cache fully qualified name on Decl
This avoids needing to mutate the intern pool from backends.
2024-07-10 11:10:49 -04:00
kcbanner
95d9292a7a dwarf: use StackIterator.MemoryAccessor to check memory accesses instead of isValidMemory 2024-07-10 10:46:35 -04:00
Jacob Young
1f6b3d1664
Merge pull request #20551 from mochalins/std_thread_pool_fix
fix: Update `spawn`'s `runFn` signature
2024-07-10 05:19:58 -04:00
mochalins
f58ee387c7 fix: Use std.os.windows.poll rather than libc 2024-07-10 01:35:01 -04:00
Andrew Kelley
9363e995fc std.Progress: slightly better atomic memcpy
Let's at least do aligned usize loads/stores where possible.
2024-07-10 00:28:44 -04:00