23947 Commits

Author SHA1 Message Date
David CARLIER
e8f76b452b std.c: adding freebsd's domainset api 2023-05-09 14:24:03 +03:00
David Carlier
1585ed637d std.c: openbsd sigcontext/ucontext for arm64. 2023-05-09 14:23:46 +03:00
David CARLIER
3dd0afe787 std.c: adding freebsd's kinfo_proc type. 2023-05-09 12:04:53 +03:00
r00ster91
297b5d1074 fix [x]u65529 and above overflowing
```
$ cat overflow.zig
test {
    var a: [1]u65535 = undefined;
    _ = a;
}
$ zig-out/bin/zig test overflow.zig
thread 290266 panic: integer overflow
zig/src/type.zig:3604:55: 0xada43d in intAbiAlignment (zig)
            std.math.ceilPowerOfTwoPromote(u16, (bits + 7) / 8),
                                                      ^
zig/src/type.zig:3598:42: 0xadd4ea in intAbiSize (zig)
        const alignment = intAbiAlignment(bits, target);
                                         ^
zig/src/type.zig:3500:61: 0x92be91 in abiSizeAdvanced (zig)
                return AbiSizeAdvanced{ .scalar = intAbiSize(bits, target) };
                                                            ^
zig/src/type.zig:3385:62: 0x928933 in abiSizeAdvanced (zig)
                switch (try payload.elem_type.abiSizeAdvanced(target, strat)) {
                                                             ^
zig/src/type.zig:3268:32: 0x92c012 in abiSize (zig)
        return (abiSizeAdvanced(ty, target, .eager) catch unreachable).scalar;
                               ^
```
This is only noticed in a debug build of zig and silently does the wrong
thing and overflows in release builds.

This happened to `[x]u65529` and above because of the ` + 7` on a `u16`.
2023-05-09 11:58:34 +03:00
Jakub Konka
f40539e5d8
Merge pull request #15597 from jacobly0/x86_64-behavior
x86_64: more behavior than ever before
2023-05-08 19:04:05 +02:00
jcalabro
16314e0e19 Fix langref typo 2023-05-08 19:41:28 +03:00
Jacob Young
1f5aa7747f x86_64: finish optimizing mir tag usage
Final tag count is 95.
2023-05-08 07:36:20 -04:00
Jacob Young
ecb5feaf94 x86_64: continue to optimize mir tag usage
Migrate mnemonic literals to tuples that represent the compressed
storage.  225 tags left in use, many tags left to compress.
2023-05-08 07:36:20 -04:00
Jacob Young
6c14eb2863 x86_64: optimize mir tag usage
This moves all pseudo-instructions to a single `Mir.Inst.Tag` tag and
prepares to start coalescing similar mnemonics. 239 tags left in use.
2023-05-08 07:36:20 -04:00
Jacob Young
6778da4516 x86_64: implement binary operations for f16 and f16 vectors 2023-05-08 07:36:20 -04:00
Jacob Young
f8708e2c4d x86_64: implement @floor, @ceil, and @trunc for float vectors 2023-05-08 07:36:20 -04:00
Jacob Young
057139fda5 x86_64: implement binary operations for float vectors 2023-05-08 07:36:20 -04:00
Jacob Young
ea957c4cff x86_64: implement @sqrt for f16 scalars and vectors 2023-05-08 07:36:20 -04:00
Jacob Young
5c5da179fb x86_64: implement @sqrt for vectors 2023-05-08 07:36:20 -04:00
Jacob Young
05580b9453 x86_64: implement float cast from f16 to f64 2023-05-08 07:36:20 -04:00
Jacob Young
1c53f0a6b0 Dwarf: workaround crash 2023-05-08 07:36:20 -04:00
Jacob Young
406c403543 x86_64: add missing movsx and movzx encodings 2023-05-08 07:36:20 -04:00
Jacob Young
cba195c117 x86_64: implement some float and float vector movement
This allows actually storing value of these supported types in
registers, and not restricting them to stack slots.
2023-05-08 07:36:20 -04:00
Jacob Young
3a5e3c52e0 x86_64: implement @mulAdd 2023-05-08 07:36:20 -04:00
Jacob Young
0bd92da0e2 target: fix typos in x86 feature descriptions 2023-05-08 07:36:20 -04:00
Jacob Young
4b75352c78 x86_64: implement packed floating point fields 2023-05-08 07:36:20 -04:00
Jacob Young
5d4288c5f6 x86_64: fix unordered float equality 2023-05-08 07:36:19 -04:00
Jacob Young
ae588a09f2 x86_64: implement f16 cmp 2023-05-08 07:36:19 -04:00
Jacob Young
32ab930f1d x86_64: implement f16 conversions when supported 2023-05-08 07:36:19 -04:00
Jacob Young
1a261917ce x86_64: implement @ctz and @clz for u128 2023-05-08 07:36:19 -04:00
Jacob Young
9bea854dc2 x86_64: implement @floor, @ceil, and @trunc 2023-05-08 07:36:19 -04:00
Jayden
b18b4db709
parse_float: Error when a float is attempted to be parsed into an invalid type
Co-authored-by: Ryan Liptak <squeek502@hotmail.com>
2023-05-08 10:42:24 +00:00
Dominic
5a3eca5d4c
Disallow named test decls with duplicate names 2023-05-08 10:59:06 +03:00
Jacob Young
bac3a28214 fmt: avoid canonicalizing enum fields named @"_" to _
This can be used to escape the usual meaning of `_` to indicate a
non-exhaustive enum and create an enum tag that is a literal underscore,
so zig fmt should allow this syntax.

Before, zig fmt changes

    const E = enum { @"_" };

to the semantically different

    const E = enum { _ };

After, it remains the same.
2023-05-08 10:58:31 +03:00
David CARLIER
ff59c45840 std.c: darwin add host_info based data. 2023-05-07 17:05:03 +03:00
Loris Cro
e8cc1017da
Merge pull request #15594 from der-teufel-programming/autodoc-tldocs
Autodoc: Add gathering of top-level doc comments for imported files
2023-05-07 13:58:53 +02:00
Dominic
e1f5ad3cc8
Fix parsing of hexadecimal literals 2023-05-07 08:05:53 +00:00
Jakub Konka
49c1384bac elf: fix typo in def of SHT_LLVM_ADDRSIG 2023-05-07 09:09:19 +02:00
Jakub Konka
66ff7d9161 elf: add more missing defs for SHT_* and SHF_* 2023-05-07 09:05:18 +02:00
Jacob Young
d71a43ec2c cbe: fix typos 2023-05-06 10:27:39 -07:00
Andrew Kelley
1e9811070b
Merge pull request #15591 from jacobly0/undef-errdefer-capture
AstGen: fix branch on undefined
2023-05-05 21:31:16 -07:00
Krzysztof Wolicki
c40a1ee224 autodoc: Add gathering of top-level doc comments for imported files 2023-05-06 02:51:53 +02:00
David CARLIER
4bfd37ddb4 std.c: adding cpu affinity api for macOs (mainly x86_64) 2023-05-06 00:55:20 +03:00
Jacob Young
df4849c4f5 AstGen: cleanup previous fix
Allocating an extended tag is much cleaner and easier to reason about
than reusing an existing tag.  The previous `.data = undefined` was a
clear indication that we don't have any data to store, and so might as
well store an extended tag in that space almost for free.
2023-05-05 16:09:59 -04:00
Jacob Young
da878dc077 AstGen: fix branch on undefined
`isAlwaysVoid` was being called with the undefined tag added by
`addOne`, causing non-deterministic behavior failures with release
builds of the compiler.  Prevents the following random failure:

    test/behavior/defer.zig:120:40: error: expected type 'error{One}', found 'void'
2023-05-05 15:09:35 -04:00
Jacob Young
d70853ba39 main: add debug dump-zir command 2023-05-05 11:00:44 -07:00
Veikka Tuominen
a111130977
Merge pull request #15317 from devnexen/darwin_rand_nativegen
std: add CCRandomGenerateBytes macOs native api.
2023-05-05 19:52:05 +03:00
Loris Cro
9f3f9fb40f
Merge pull request #15578 from der-teufel-programming/autodoc-if-switch
Autodoc: Save and render source code for `if` and `switch`
2023-05-05 18:24:55 +02:00
Krzysztof Wolicki
538c8258c7 autodoc: Remove debug code 2023-05-05 12:01:00 +02:00
Krzysztof Wolicki
e0c65ce3f2 autodoc: main.js exprName cleanup 2023-05-05 02:46:04 +02:00
Krzysztof Wolicki
c63338712e autodoc: Save switches as comptimeExpr with the code instead of analyzing it deeply;
simplified getBlockSource;
2023-05-05 02:41:23 +02:00
Krzysztof Wolicki
e363ffad90 autodoc: Better comptimeExpr code for blocks 2023-05-05 01:46:19 +02:00
David CARLIER
012f9a97eb std.c: add os_proc_available_memory for darwin 2023-05-04 10:13:11 +03:00
Veikka Tuominen
3f3b1a6808 std.Build: use Step.* instead of *Step
Follow up to 13eb7251d37759bd47403db304c6120c706fe353
2023-05-03 20:55:29 -07:00
Jonathan Marler
5def162391 fix bug and simplify std.crypto.tls.Client.limitVecs 2023-05-03 20:52:18 -07:00