26089 Commits

Author SHA1 Message Date
Veikka Tuominen
fc4d53e2ea
Merge pull request #17221 from Vexu/aro-translate-c
Aro translate-c
2023-10-02 07:08:53 +03:00
Jacob Young
0f1652dc60
Merge pull request #17262 from jacobly0/x86_64
x86_64: support operations that are implemented in compiler_rt
2023-10-01 20:45:42 -04:00
kcbanner
62a0fbdaef air_print: fix panic when printing .abs 2023-10-01 15:08:50 -07:00
Veikka Tuominen
5792570197 add Aro sources as a dependency
ref: 5688dbccfb58216468267a0f46b96bed7013715a
2023-10-01 23:51:54 +03:00
Veikka Tuominen
47050fbb7d aro translate-c: update to cast builtin changes 2023-10-01 23:51:54 +03:00
Veikka Tuominen
7ec729b3ae aro-translate-c: move shared types to a common namespace 2023-10-01 23:51:54 +03:00
Veikka Tuominen
31ecf75311 aro-translate-c: translate enums 2023-10-01 23:51:54 +03:00
Veikka Tuominen
fef94da958 add compiler flag for selecting C frontend 2023-10-01 23:51:54 +03:00
Jacob Young
da335f0ee4 x86_64: implement float @sqrt builtin 2023-10-01 15:09:52 -04:00
Jacob Young
fbe5bf469e x86_64: implement float arithmetic builtins 2023-10-01 15:09:52 -04:00
Jacob Young
1eb023908d x86_64: implement float round builtins 2023-10-01 15:09:52 -04:00
Jacob Young
c3042cbe12 x86_64: add missing caller preserved regs
All allocatable registers have to be either callee preserved or caller
preserved.
2023-10-01 15:09:52 -04:00
Jacob Young
8470652f10 x86_64: implement float compare and cast builtins 2023-10-01 15:09:52 -04:00
Jacob Young
6d5cbdb863 behavior: cleanup floatop tests 2023-10-01 15:09:52 -04:00
Jacob Young
3bd1b9e15f x86_64: implement and test unary float builtins 2023-10-01 15:09:52 -04:00
Jakub Konka
af40bce08a x86_64: emit R_X86_64_GOT32 for non-PIC GOT references 2023-10-01 21:09:35 +02:00
Andrew Kelley
8e1421f19e
Merge pull request #17346 from Vexu/errSetCast
Sema: implement `@errSetCast` for error unions
2023-10-01 12:00:17 -07:00
Veikka Tuominen
0b1ba6eb52
update zig1.wasm 2023-10-01 17:16:34 +03:00
Veikka Tuominen
63bd2bff12 Sema: add @errorCast which works for both error sets and error unions
Closes #17343
2023-10-01 17:00:01 +03:00
Jay Petacat
d8bfbbbf25 std.mem.zeroes: Zero out entire extern union, including padding
Fixes #17258
2023-10-01 02:39:05 -07:00
Andrew Kelley
376242e586
Merge pull request #17161 from tiehuis/vectorize-index-of-scalar
std.mem: add vectorized indexOfScalarPos and indexOfSentinel
2023-10-01 00:07:57 -07:00
Ian Johnson
9a001e1f7c Support fetching dependencies over git+http(s)
Closes #14298

This commit adds support for fetching dependencies over git+http(s)
using a minimal implementation of the Git protocols and formats relevant
to fetching repository data.

Git URLs can be specified in `build.zig.zon` as follows:

```zig
.xml = .{
    .url = "git+https://github.com/ianprime0509/zig-xml#7380d59d50f1cd8460fd748b5f6f179306679e2f",
    .hash = "122085c1e4045fa9cb69632ff771c56acdb6760f34ca5177e80f70b0b92cd80da3e9",
},
```

The fragment part of the URL may specify a commit ID (SHA1 hash), branch
name, or tag. It is an error to omit the fragment: if this happens, the
compiler will prompt the user to add it, using the commit ID of the HEAD
commit of the repository (that is, the latest commit of the default
branch):

```
Fetch Packages... xml... /var/home/ian/src/zig-gobject/build.zig.zon:6:20: error: url field is missing an explicit ref
            .url = "git+https://github.com/ianprime0509/zig-xml",
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: try .url = "git+https://github.com/ianprime0509/zig-xml#dfdc044f3271641c7d428dc8ec8cd46423d8b8b6",
```

This implementation currently supports only version 2 of Git's wire
protocol (documented in
[protocol-v2](https://git-scm.com/docs/protocol-v2)), which was first
introduced in Git 2.19 (2018) and made the default in 2.26 (2020).

The wire protocol behaves similarly when used over other transports,
such as SSH and the "Git protocol" (git:// URLs), so it should be
reasonably straightforward to support fetching dependencies from such
URLs if the necessary transports are implemented (e.g. #14295).
2023-09-30 18:30:43 -07:00
Lucas Santos
303181901b Improve (Unmanaged)ArrayList.insert
(Unmanaged)ArrayList.insert has the same inefficiency as the old insertSlice. With the new addManyAt, the solution is trivial.
Also improves the test "growing memory preserves contents". In the previous implementation, if any changes were made to the ArrayList memory growth policy (function growMemory), the list could end up with enough capacity to not trigger a memory growth, defeating the purpose of the test. The new implementation more robustly triggers a memory growth.
2023-09-30 16:17:22 -07:00
Marc Tiehuis
08635f08a9 fix indexOfSentinel alignment for types larger than 1 byte 2023-09-30 22:15:47 +13:00
Andrew Kelley
937e8cb705
Merge pull request #17328 from ziglang/simplify-cbe-deps
C backend: remove unneeded ordering mechanism
2023-09-30 01:26:00 -07:00
Marc Tiehuis
5b5da0ef8c std.mem: check backend vector support for indexOfSentinel/indexOfScalarPos 2023-09-30 21:22:12 +13:00
Marc Tiehuis
cd766513fe std.mem: add vectorized indexOfScalarPos and indexOfSentinel
These are an order of magnitude quicker than the previous
implementations:

A relative comparison of each, measuring scanning a 1G file.

    Reading 1G (1.0000000009313226GiB)

             std.mem.sliceTo: 281.232ms
          vectorized.sliceTo: 24.769ms
                      strlen: 24.291ms

           std.indexOfScalar: 229.016ms
    vectorized.indexOfScalar: 24.685ms
                      memchr: 24.958ms
2023-09-30 21:19:43 +13:00
Jakub Konka
873c695c41
Merge pull request #17319 from ziglang/elf-tls
elf: add basic TLS segment handling
2023-09-30 08:43:33 +02:00
Andrew Kelley
864bb5dc07 C backend: iterate decl_table via slice 2023-09-29 19:14:17 -07:00
Andrew Kelley
7c605ba62c C backend: remove ?*Decl from DeclGen
Another simplification. DeclGen already has `decl_index` which can be
used to retrieve the `*Decl` if needed.
2023-09-29 19:14:17 -07:00
Andrew Kelley
0d841e827a C backend: remove unneeded ordering mechanism
This logic to lower snippets of C code in a dependency order is no
longer needed. Simplify the logic by deleting the mechanism.
2023-09-29 19:14:17 -07:00
Andrew Kelley
101df768a0
Merge pull request #17312 from LucasSantos91/master
Fix inefficiency with ArrayList.insertSlice
2023-09-29 18:15:24 -07:00
Jakub Konka
e72fd185e0 elf: skip writing out zerofill atoms to file 2023-09-30 00:52:10 +02:00
Krzysztof Wolicki
19a82ffdba
Add include_extensions to InstallDir Options (#17300)
closes #16687
2023-09-29 18:50:37 -04:00
Andrew Kelley
9013970861 std.ArrayList: fixups for the previous commit
* Move `computeBetterCapacity` to the bottom so that `pub` stuff shows
   up first.
 * Rename `computeBetterCapacity` to `growCapacity`. Every function
   implicitly computes something; that word is always redundant in a
   function name. "better" is vague. Better in what way? Instead we
   describe what is actually happening. "grow".
 * Improve doc comments to be very explicit about when element pointers
   are invalidated or not.
 * Rename `addManyAtIndex` to `addManyAt`. The parameter is named
   `index`; that is enough.
 * Extract some duplicated code into `addManyAtAssumeCapacity` and make
   it `pub`.
 * Since I audited every line of code for correctness, I changed the
   style to my personal preference.
 * Avoid a redundant `@memset` to `undefined` - memory allocation does
   that already.
 * Fixed comment giving the wrong reason for not calling
   `ensureTotalCapacity`.
2023-09-29 13:42:38 -07:00
Jakub Konka
6c50ad6e9f elf: set sh_size to 0 for nobit sections in collision detection
`SHT_NOBITS` sections take no file space after all.
2023-09-29 22:37:59 +02:00
Jakub Konka
e5e6984652 elf: dump state for debugging after writing it all out 2023-09-29 22:29:06 +02:00
Jakub Konka
5381bfd348 elf: fix setting st_value of _end synthetic symbol 2023-09-29 22:18:38 +02:00
Lucas Santos
9d765b5ab5 std.ArrayList: insertSlice avoids extra memcpy
Includes a more robust implementation of replaceRange, which updates the
ArrayListUnmanaged if state changes in the managed part of the code
before returning an error.

Co-authored-by: Andrew Kelley <andrew@ziglang.org>
2023-09-29 12:52:40 -07:00
Jakub Konka
8e90b41ae0 elf: set shdr/phdr file size before growing in VM 2023-09-29 21:43:01 +02:00
Jakub Konka
304d38e844 elf: simplify logic for growing non-alloc sections 2023-09-29 20:35:28 +02:00
Krzysztof Wolicki
e919fbea9f
Step.Run: fix assert of the wrong value (#17303)
closes #16866
2023-09-29 14:14:42 -04:00
Jakub Konka
0524a3c83d elf: fix calculating current allocated section size when growing alloc sections 2023-09-29 19:06:02 +02:00
Andrew Kelley
c07d6e4c17
Merge pull request #14603 from AdamGoertz/file-uris
Support relative paths in package manager
2023-09-29 00:34:07 -07:00
Adam Goertz
e07e182fc1 Extract logic for directory packages
In addition to improving readability, this also fixes a subtle bug
where the Progress node could display the wrong total number of packages to fetch.
2023-09-29 00:32:43 -07:00
AdamGoertz
4594206e72 Fix diamond dependencies with directory packages 2023-09-29 00:32:43 -07:00
AdamGoertz
c6b9205005 Purge absolute paths and remove unneeded path processing
No need to create paths with windows-specific path separators
2023-09-29 00:32:43 -07:00
Adam Goertz
2f0e5b00b0 Allow only relative paths.
This commit makes the following changes:
* Disallow file:/// URIs
* Allow only relative paths in the .path field of build.zig.zon
* Remote now-unneeded shlwapi dependency
2023-09-29 00:32:43 -07:00
Adam Goertz
b3cad98534 Support file:/// URIs and relative paths 2023-09-29 00:32:43 -07:00
Philipp Lühmann
ed19ebc360
std.math.big.int.Const.order 0 == -0 (#17299) 2023-09-29 18:09:47 +13:00