13044 Commits

Author SHA1 Message Date
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
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
ef87729388 Manifest: add top-level paths field for inclusion rules
See #14311
2023-10-08 16:54:31 -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
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
Jakub Konka
df9462690f std: fix memory bug in getExternalExecutor
Until now, we would pass `candidate: NativeTargetInfo` which creates
a copy of the `NativeTargetInfo.DynamicLinker` buffer. We would then
return this buffer in `bad_dl: []const u8` which would goes out-of-scope
the moment we leave this function frame yielding garbage. To fix this,
we just need to remember to pass by const-pointer
`candidate: *const NativeTargetInfo`.
2023-10-06 12:43:00 +02:00
Jacob Young
54b2d6f072 x86_64: implement C abi for everything else 2023-10-05 04:38:25 -04:00
Jacob Young
cc6694a323 x86_64: implement C abi for f128 2023-10-05 04:10:38 -04:00
Jacob Young
c2ec518fe2 x86_64: refactor calling convention checks 2023-10-05 00:19:25 -04:00
Jacob Young
b4427bc300 plan9: refactor debug info
The main goal is to stop depending on `emit.lower.target`.
2023-10-05 00:19:25 -04:00
Jacob Young
5a35734a48 x86_64: fix abi bit/byte mixups 2023-10-05 00:19:21 -04:00
Jacob Young
644d943861 x86_64: implement 128-bit integer comparisons 2023-10-04 16:26:56 -04:00
Jacob Young
2a5335d7b6 x86_64: implement C abi for 128-bit integers 2023-10-04 14:42:35 -04:00
Jacob Young
9748096992 x86_64: fix various crashes 2023-10-04 14:42:35 -04:00
Jakub Konka
8b4e3b6aee comp: add support for -fdata-sections 2023-10-04 11:21:56 -07:00
Krzysztof Wolicki
9c3165b81b
autodoc: Add handling for array_cat, array_mul, struct_init_empty_result. (#17367)
Fix issue with getting docs for src-less types in main.js
2023-10-04 18:25:00 +02:00
Jacob G-W
d634e02d33 plan9: implement linking anon decls 2023-10-03 12:49:45 -07:00
Luuk de Gram
de78caf9c4 wasm: implement lowering anon decls 2023-10-03 12:49:29 -07:00
Jakub Konka
cbdf4858e8 elf: assert llvm_object is null in getAnonDeclVAddr 2023-10-03 12:49:24 -07:00
Jakub Konka
d5b9d18bf0 coff: implement lowering anon decls 2023-10-03 12:49:21 -07:00
Jakub Konka
57eefe0533 macho: implement lowering anon decls 2023-10-03 12:49:17 -07:00