25416 Commits

Author SHA1 Message Date
Zachary Raineri
0461a64a93
change uses of std.builtin.Mode to OptimizeMode (#16745)
std.builtin.Mode is deprecated.
2023-08-09 14:39:34 -04:00
Andrew Kelley
72c68f698e
Merge pull request #16752 from jacobly0/generic-srclocs
Sema: fix issues with source locations of generic arguments
2023-08-09 11:38:47 -07:00
mllken
9676a43a5d linux: add setsid 2023-08-09 11:33:06 -07:00
Jacob Young
57470e833e Module: implement span for .call_arg of a @call
Closes #16750
2023-08-09 10:09:17 -04:00
Jacob Young
736df27663 Sema: use the correct decl for generic argument source locations
Closes #16746
2023-08-09 10:09:01 -04:00
Jacob Young
9630379a8e Sema: fix generic method argument source locations 2023-08-09 10:09:01 -04:00
Jacob Young
cd7998096b
Merge pull request #16708 from jacobly0/llvm-builder
llvm: convert more things to use Builder

 * finish converting intrinsics
 * finish converting attributes
 * finish converting instructions
 * finish converting globals
 * pass behavior tests with no dependence on the llvm api (`-fno-libllvm`)
2023-08-09 03:16:55 -04:00
Jacob Young
3e1dd93bb2 llvm: force strip without libllvm to avoid unimplemented behavior
Also fix deinit bugs.
2023-08-08 23:32:40 -04:00
Jacob Young
53bea0f7e4 llvm: remove dependence on llvm data layout alignment
by just using the zig alignment and letting llvm promote it as desired
2023-08-08 22:09:44 -04:00
Jacob Young
35cd56a369 llvm: fix alias issues 2023-08-08 21:32:50 -04:00
Jacob Young
2bdd180c6f llvm: finish converting globals 2023-08-08 21:32:50 -04:00
Jacob Young
2499d8fb73 Builder: fix enough bugs to pass the behavior tests
without using any information from the LLVM API
2023-08-08 21:32:50 -04:00
Jacob Young
a66cd54f94 llvm: cleanup even more unused LLVM API bindings 2023-08-08 21:32:50 -04:00
Jacob Young
a0cb03ed99 llvm: finish converting instructions 2023-08-08 21:32:50 -04:00
Jacob Young
49cc1bff08 llvm: finish converting intrinsics 2023-08-08 21:32:50 -04:00
Jacob Young
6577f52614 llvm: convert vector reduction intrinsics
Scratch that thing I said about one pass. :)
2023-08-08 21:32:50 -04:00
Jacob Young
e1efd4d3c2 Builder: simplify intrinsic table
This format removes back-references allowing it to be parsed in a single
pass.  It also reduces the number of kinds, simplifying the code.
2023-08-08 21:32:50 -04:00
Jacob Young
5b79f08ee8 llvm: finish converting attributes to use Builder and the C LLVM API 2023-08-08 21:32:50 -04:00
Jacob Young
b63d9745b5 llvm: convert intrinsics to using Builder 2023-08-08 21:32:50 -04:00
Jacob Young
3ebf8ce970 Builder: fix builtin pseudo-instruction dumping 2023-08-08 21:32:50 -04:00
Jacob Young
f938404a45 Builder: fix attribute spacing 2023-08-08 21:32:50 -04:00
Philipp Lühmann
d34201c849
std.json: stringify enum literals (#16742) 2023-08-08 23:26:46 +00:00
Andrew Kelley
36c57c3ba1
Merge pull request #16707 from marler8997/jsonStringifyBigNumbers
std.json: fix roundtrip stringify for large integers
2023-08-08 12:08:21 -07:00
Andrew Kelley
ac95cfe449
Merge pull request #16721 from hryx/stage1-coverage 2023-08-06 21:57:22 -07:00
Stevie Hryciw
2ad6ca581d Add behavior test for copying self-referential struct
Closes #6312. In the C++ implementation this caused a stack overflow
from infinite recursion during analysis.
2023-08-06 18:23:28 -07:00
Stevie Hryciw
16dcefaca5 Add compile error test for comptime slice-of-struct copy
Closes #6305. In the C++ implementation this hit a compiler assertion.
It is handled properly in the self-hosted version.
2023-08-06 18:11:49 -07:00
Stevie Hryciw
6bba5a39e4 Add behavior test for ptrCast on function pointer
Closes #6280. In the C++ implementation this triggered a
compiler assertion.
2023-08-06 18:09:41 -07:00
Zachary Raineri
49244dc0ca
std: remove some unused imports (#16710) 2023-08-06 15:18:50 -04:00
Loris Cro
373e48c983
autodoc: new layout (#16715)
* autodoc: init guide TOC work

* autodoc: working guides toc navigation

* autodoc: more improvements

* autodoc: ui refinements

* autodoc: new layout and init descriptions for namespaces in std.zig
2023-08-06 18:12:05 +02:00
Jonathan Marler
2046880de8 std.json: josh review fixes
* renamed enum_big_numbers_quoted option to enum_nonportable_numbers_as_strings
* updated stringify doc to mention the option

I also reversed the logic to determine whether an integer is nonportable,
it seemed easier to reason about.

I also took a stab at applying the new option to floats, but, I got stuck
at trying to print large floats, not sure if Zig supports that yet.
2023-08-06 09:25:21 -06:00
Jacob Young
1cce539ddc json.stringify: properly implement RFC8259 recommendation
The previous magic numbers used `1 << 52`, which did not account for the
implicit leading one in the floating point format.  The RFC is correct
when it uses an exponent of 53.  Technically these exclusive endpoints
are also representable, but everyone including the RFC seems to use them
exclusively.

Also, delete special case optimizations related to the type which have
already been implemented in the zig compiler to produce comptime values
for tautological runtime comparisons.
2023-08-06 00:35:10 -04:00
Jonathan Marler
7dacf77745 std.json: fix roundtrip stringify for large integers
std.json follows interoperability recommendations from RFC8259 to limit
JSON number values to those that fit inside an f64.  However, since Zig
supports arbitrarily large JSON numbers, this breaks roundtrip data
congruence.

To appease both use cases, I've added an option `emit_big_numbers_quoted`
to StringifyOptions.  It's disabled by default which preserves roundtrip
but can be enabled to favor interoperability.
2023-08-05 21:56:00 -06:00
Jacob Young
1c7798a3cd
Merge pull request #16705 from antlilja/builder-intrinsics
Implement more intrinsics in new LLVM IR builder API and remove uses of LLVM owns API
2023-08-05 23:05:02 -04:00
Robin Voetter
68f84964b3 llvm: add const addrspace cast 2023-08-05 17:11:57 -07:00
antlilja
e149f1e1de
Use new LLVM IR builder API in bit op lowering 2023-08-06 01:46:57 +02:00
antlilja
86f61a9d26
Implement bitop intrinsics in new LLVM IR builder
* llvm.bitreverse
* llvm.bswap
* llvm.ctpop
* llvm.ctlz
* llvm.cttz
2023-08-06 01:46:57 +02:00
antlilja
2b4ac7c6b3
Use new LLVM builder API in buildFloatOP 2023-08-06 01:46:56 +02:00
antlilja
63dcffdf9f
Implement fp intrinsics in new LLVM IR builder
Intrinsics implemented
* llvm.ceil
* llvm.cos
* llvm.exp
* llvm.exp2
* llvm.fabs
* llvm.floor
* llvm.log
* llvm.log10
* llvm.log2
* llvm.round
* llvm.sin
* llvm.trunc
* llvm.fma
2023-08-06 01:46:51 +02:00
Jacob Young
b8c9d5ae98 cbe: don't emit traps in naked functions
Closes #16680
2023-08-05 16:44:56 -07:00
none
f3fbdf2b44 wyhash: keep tail bytes on iterative update
Update calls with input longer then one block must ensure that
last sixteen bytes are available when final is called.

Fixes #16695
2023-08-05 15:30:50 -07:00
Ryan Liptak
90fde14c5f std.testing.expectEqualSlices: On failure, print address for pointer types
When comparing slice elements, `std.meta.eql` is used which only compares pointer address and length to determine equality for pointer types. This previously led to confusing results where `expectEqualSlices` would appear to fail on seemingly equal slices (judging by the output of `expectEqualSlices`. For example:

try testing.expectEqualSlices(
    []const i64,
    &[_][]const i64{ &[_]i64{ 1, 2, 3 }, &[_]i64{ 5, 5, 5 } },
    &[_][]const i64{ &[_]i64{ 1, 2, 3 }, &[_]i64{ 5, 5, 5 } },
);

Previously, this would result in:

============ expected this output: =============  len: 2 (0x2)

[0]: { 1, 2, 3 }
[1]: { 5, 5, 5 }

============= instead found this: ==============  len: 2 (0x2)

[0]: { 1, 2, 3 }
[1]: { 5, 5, 5 }

================================================

After this commit, it will result in:

============ expected this output: =============  len: 2 (0x2)

[0]i64@7ff7e2773758: { 1, 2, 3 }
[1]i64@7ff7e2773770: { 5, 5, 5 }

============= instead found this: ==============  len: 2 (0x2)

[0]i64@7ff7e2773788: { 1, 2, 3 }
[1]i64@7ff7e27737a0: { 5, 5, 5 }

================================================
2023-08-05 11:54:26 -07:00
Jacob Young
a91a8df679 Sema: fix issues passing an invalid type to a generic method
Closes #16601
2023-08-05 11:21:50 -07:00
Prcuvu
fc6e575684 cmake: Fix typo: elif → elseif 2023-08-04 15:24:07 -07:00
Andrew Kelley
e7ba4b7f94 update .mailmap 2023-08-04 11:01:18 -07:00
David Gonzalez Martin
9c05810be6 debug: expose module debug info deinitialization
Before this commit, you could use readElfDebugInfo independently with
one catch: the data is not freed since the deinitialization functions
for ModuleDebugInfo are private. This change makes them public so the
    users of such function and similar can free the memory after the
    debug symbols have been used.
2023-08-04 09:24:11 +02:00
Jeremy Volkman
516eb33442 Fix typo: headerpat -> headerpad 2023-08-04 09:20:45 +02:00
Andrew Kelley
a327d8b995 start the 0.12.0 release cycle 2023-08-03 11:22:40 -07:00
Andrew Kelley
67709b6382 Release 0.11.0 0.11.0 2023-08-03 11:22:03 -07:00
Krzysztof Wolicki
b317ca4d6f autodoc: Added line_comment tokens to ziglexer.js tokenizer 2023-08-03 19:07:33 +02:00
Andrew Kelley
c4e62be62e
Merge pull request #16058 from ziglang/frontend-lib-paths
compiler: resolve library paths in the frontend
2023-08-03 09:53:18 -07:00