26218 Commits

Author SHA1 Message Date
Andrew Kelley
6d84caf727 move some package management related source files around 2023-10-08 17:29:55 -07:00
Andrew Kelley
7bae6d9064 fix dependencies.zig generation with no dependencies 2023-10-08 17:26:02 -07:00
Andrew Kelley
8f20ce74f4 zig fetch: require 'paths' field in the manifest 2023-10-08 17:21:18 -07:00
Andrew Kelley
f0cc6f17a0 Package.Fetch: fix not making directory paths for symlinks 2023-10-08 17:21:08 -07:00
Andrew Kelley
f48ec4b8ee use long-lived arena for @cImport-generated Module 2023-10-08 16:54:31 -07:00
Andrew Kelley
1ad33f53fe give build.zig modules access to their dependencies' build.zig modules 2023-10-08 16:54:31 -07:00
Andrew Kelley
ce052d89a8 Manifest: fix not initializing token locations 2023-10-08 16:54:31 -07:00
Andrew Kelley
47a413361d Package.Fetch: fix handling of relative paths 2023-10-08 16:54:31 -07:00
Andrew Kelley
1fd95fc005 Package.Fetch: resolve instead of join relative paths
This prevents bogus "error: file exists in multiple modules" errors due
to file paths looking like:
```
note: root of module foo/freetype/
note: root of module foo/fontconfig/../freetype/
```

It also enables checking for dependency paths outside the root package.
2023-10-08 16:54:31 -07:00
Andrew Kelley
29156de120 CLI: fix only_core_functionality logic 2023-10-08 16:54:31 -07:00
Andrew Kelley
a605bd9887 zig build: add --fetch argument
closes #14280
2023-10-08 16:54:31 -07:00
Andrew Kelley
b2fefc8473 dependencies.zig: omit deps without hashes 2023-10-08 16:54:31 -07:00
Andrew Kelley
b7fc53c92a dependencies.zig: omit modules without build.zig as deps 2023-10-08 16:54:31 -07:00
Andrew Kelley
7b25d050e6 std.tar: fix creation of symlinks with omit_empty_directories 2023-10-08 16:54:31 -07:00
Andrew Kelley
e5c2a7dbca finish hooking up new dependency tree logic
* 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-08 16:54:31 -07:00
Andrew Kelley
35d81c99c0 more fixes related to previous commits Package/Module API 2023-10-08 16:54:31 -07:00
Andrew Kelley
a232f7e8ec finish implementing the auto-generated dependencies.zig module 2023-10-08 16:54:31 -07:00
Andrew Kelley
e86b7fcca3 fix detection of build.zig file inside packages 2023-10-08 16:54:31 -07:00
Andrew Kelley
4eb7b61daa package fetching: generate dependencies.zig file
Only problem is that it looks like `has_build_zig` is being false when
it should be true.

After that is fixed then main.zig needs to create the `@dependencies`
module from the generated source code.
2023-10-08 16:54:31 -07:00
Andrew Kelley
9eb21541ec make Package.Path support string escape formatting 2023-10-08 16:54:31 -07:00
Andrew Kelley
cbb9b5d9f0 std: add unstable sorting to array hash maps
closes #17426
2023-10-08 16:54:31 -07:00
Andrew Kelley
1ca4428324 fix recursive package fetching logic
For path-relative dependencies, they always need to be added to the hash
table at the end. For remote dependencies, they never need to be added.
2023-10-08 16:54:31 -07:00
Andrew Kelley
ddb7c40037 fix inverted logic for allowing/disallowing paths field 2023-10-08 16:54:31 -07:00
Andrew Kelley
aed6adb6e9 fix Fetch.JobQueue.consolidateErrors 2023-10-08 16:54:31 -07:00
Andrew Kelley
f708c5fafc CLI: finish updating module API usage
Finish the work started in 4c4fb839972f66f55aa44fc0aca5f80b0608c731.
Now the compiler compiles again.

Wire up dependency tree fetching code in the CLI for `zig build`.
Everything is hooked up except for `createDependenciesModule` is not yet
implemented.
2023-10-08 16:54:31 -07:00
Andrew Kelley
1c0d6f9c00 require inclusion directives in root manifest but not deps
see #14311
2023-10-08 16:54:31 -07:00
Andrew Kelley
d0bcc390e8 get zig fetch working with the new system
* 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-10-08 16:54:31 -07:00
Andrew Kelley
88bbec8f9b rework package manager
Organize everything around a Fetch task which does a bunch of stuff in a
worker thread without touching any shared state, and then queues up
Fetch tasks for its dependencies.

This isn't the theoretical optimal package fetching performance because
CPU cores don't necessarily map 1:1 with I/O tasks, and each fetch task
contains a mixture of computations and I/O. However, it is expected for
this to significantly outperform master branch, which fetches everything
recursively with only one thread.

The logic is now a lot more linear and easy to follow. Everything that
is embarassingly parallel is done on the thread pool, and then after
everything is fetched, the worker threads are joined and the main thread
does the finishing touches of stitching together the dependencies.zig
import files. There is only one tiny little critical section and it does
not even have any error handling in it.

This also lays the groundwork for #14281 because in system mode, all
this fetching logic will be skipped, but the "finishing touches"
mentioned above still need to be done. With this branch, that logic is
separated out and no longer recursively tangled with fetching stuff.

Additionally, this branch:
 * Implements inclusion directives in `build.zig.zon` for deciding which
   files belong the package (#14311).
 * Adds basic documentation for `build.zig.zon` files.
 * Adds support for fetching dependencies with the `file://` protocol
   scheme (#17364).
 * Adds a workaround for a Linux/btrfs file system bug (#17282).

This commit is a work-in-progress. Still todo:

1. Hook up the CLI to the new system.
2. Restore the module table creation logic after all the fetching is
   done.
3. Fix compilation errors, get the tests passing, and regression test
   against real world projects.
2023-10-08 16:54:31 -07:00
Andrew Kelley
d06da95884 add basic build.zig.zon documentation 2023-10-08 16:54:31 -07:00
Andrew Kelley
ef87729388 Manifest: add top-level paths field for inclusion rules
See #14311
2023-10-08 16:54:31 -07:00
Andrew Kelley
24c8adc6ac std.zig.ErrorBundle: add some explicit error sets 2023-10-08 16:54:30 -07:00
Andrew Kelley
51e15a9650 std.tar: add option for omitting empty directories 2023-10-08 16:54:30 -07:00
Luuk de Gram
54e7f58fcb
Merge pull request #17438 from Luukdegram/issue-17436
wasm - fix `@tagName` for signed enums
2023-10-08 21:58:35 +02:00
Luuk de Gram
9402f8b74a
add behavior test @tagName with signed values 2023-10-08 15:23:50 +02:00
Luuk de Gram
8e836cb59a
wasm: correctly lower signed value in @tagName 2023-10-08 15:18:40 +02:00
Jacob Young
1de242cd73
Merge pull request #17416 from jacobly0/x86_64
x86_64: implement more `f80` operations and other features
2023-10-08 09:15:35 -04:00
Jacob Young
b5dedd7c00 x86_64: implement @mulAdd of floats for baseline 2023-10-08 04:41:55 -04:00
Jacob Young
35c9b717f7 x86_64: implement @rem for floats 2023-10-08 04:41:55 -04:00
Jacob Young
3bf9a8feb5 x86_64: fix @divTrunc and @divFloor of f16 2023-10-08 04:41:55 -04:00
Jacob Young
9fc9235ac8 x86_64: fix undersized vector binary operations 2023-10-08 04:41:55 -04:00
Jacob Young
f6e027da32 x86_64: fix conversions between floats and 128-bit integers 2023-10-08 04:41:55 -04:00
Jacob Young
b8f00ae337 x86_64: implement @abs for some integer vector types 2023-10-08 04:41:55 -04:00
Jacob Young
24d76500d2 x86_64: fix bitcast from f80 2023-10-08 04:41:55 -04:00
Jacob Young
a9b37ac637 cbe: fix crash on error
This hashmap value used to be assigned much later during `flushModule`,
which never happens if an error is returned by the backend, and
attempting to the undefined values would cause a crash.
2023-10-08 00:06:17 -04:00
Jacob Young
24c67992e0 x86_64: hack around silent f80 miscompilations
The x87 kind sucks.
2023-10-07 19:47:46 -04:00
Jacob Young
b19fd485b1 x86_64: improve inline assembly support
* instruction prefixes
 * mnemonic fixes
 * labels
 * memory operands
 * read-write constraint modifier
 * register and memory alternative constraint
2023-10-07 16:02:01 -04:00
Jacob Young
7436f3efc9 x86_64: implement C var args 2023-10-07 02:10:34 -04:00
Jacob Young
20b4401cde x86_64: implement negation and @abs for f80
Also implement live-outs since the x87 requires so much care around
liveness tracking.
2023-10-07 00:29:17 -04:00
Jacob Young
5aeb13c350 x86_64: implement f80 movement 2023-10-07 00:29:17 -04:00
Jacob Young
9f8b2ff9e2 x86_64: fix C abi typos 2023-10-07 00:29:17 -04:00