Commit graph

21093 commits

Author SHA1 Message Date
Loris Cro
1696434063
Merge pull request #13300 from jcalabro/master
Better Autodoc Src File Links
2022-10-30 17:20:57 +01:00
Loris Cro
d4487b6a2e autodoc: update to new func zir body structure
this is a hack meant to restore functionality for the upcoming release,
a proper analysis of the new zir structure is required to make a robust
change.
2022-10-30 17:17:34 +01:00
Jakub Konka
2b25d3c333
Merge pull request #13356 from ziglang/macho-no-dupe
macho: fix performance regression for x86_64 and -dead_strip
2022-10-30 16:38:28 +01:00
Andrew Kelley
17df35025b CI: disable failing C backend test
See #13357
2022-10-30 03:21:18 -07:00
Jakub Konka
9b0c555db4 macho: fix regression in dead strip for x86_64
Correctly handle calculating encompassing atoms for local
relocations (`r_extern == 0`).
2022-10-30 10:49:00 +01:00
Jakub Konka
27bcd4ec79 macho: do not unnecessarily dupe sym names in resolver 2022-10-30 10:12:25 +01:00
Andrew Kelley
5339cac2ef std: re-enable auto hash test
It was temporarily disabled due to a self-hosted compiler
miscompilation.

closes #12178
2022-10-30 01:09:31 -07:00
Andrew Kelley
fbd1390f80 CI: drone: shuffle some tests around
We have to balance the timings to end up below the two hour mark.
2022-10-29 23:10:49 -07:00
Andrew Kelley
c8f1ea46b5 ci: enable aarch64-linux test coverage
closes #12689
2022-10-29 23:07:16 -07:00
Andrew Kelley
209a0d2a83
Merge pull request #13153 from squeek502/iterator-filename-limits
Windows: Fix Iterator name buffer size not handling all possible file name components
2022-10-29 23:50:37 -04:00
Andrew Kelley
5f5a20ebaf
Merge pull request #13093 from jacobly0/backend-fixes
C backend fixes
2022-10-29 23:06:59 -04:00
Evin Yulo
09a96cdfce Fix #12822: Clarify langref about the behavior of undefined 2022-10-29 17:55:06 -04:00
kkHAIKE
949cca9f2a Allocator: fix len_align calc in large type size case 2022-10-29 17:53:56 -04:00
Andrew Kelley
28dc208f65
Merge pull request #13082 from g-w1/unnamed-decls-and-relocs-p9
Plan9: Fix The Backend
2022-10-29 17:45:00 -04:00
Ryan Liptak
db80225a97 fs: Some NAME_MAX/MAX_NAME_BYTES improvements 2022-10-29 14:30:46 -07:00
Ryan Liptak
348f73502e Make MAX_NAME_BYTES on WASI equivalent to the max of the other platforms
Make the test use the minimum length and set MAX_NAME_BYTES to the maximum so that:
- the test will work on any host platform
- *and* the MAX_NAME_BYTES will be able to hold the max file name component on any host platform
2022-10-29 14:30:46 -07:00
Ryan Liptak
c5d23161fc Set wasi MAX_NAME_BYTES to minimum of the rest of the supported platforms
This is a slightly weird situation, because the 'real' value may depend on the host platform that the WASI is being executed on.
2022-10-29 14:30:45 -07:00
Ryan Liptak
dd0962d5ea Add wasi branch to MAX_NAME_BYTES 2022-10-29 14:30:45 -07:00
Ryan Liptak
c6ff1a7160 Windows: Fix iterator name buffer size not handling all possible file name components
Each u16 within a file name component can be encoded as up to 3 UTF-8 bytes, so we need to use MAX_NAME_BYTES to account for all possible UTF-8 encoded names.

Fixes #8268
2022-10-29 14:30:44 -07:00
Ryan Liptak
33fdc43714 std.fs: Add MAX_NAME_BYTES
Also add some NAME_MAX or equivalent definitions where necessary
2022-10-29 14:30:43 -07:00
Jacob Young
4364f51476 cbe: finish partial zig_noreturn rewrite 2022-10-29 16:54:50 -04:00
Andrew Kelley
e036cc48d5
Merge pull request #13342 from ziglang/fix-glibc-race
glibc: fix race condition when building stubs
2022-10-29 16:16:57 -04:00
fn ⌃ ⌥
a70c86e661 Fix deprecation docs for isAlpha and isCntrl 2022-10-29 15:22:05 -04:00
Andrew Kelley
3e926d868e CI: update freebsd tarball 2022-10-29 12:15:47 -07:00
Andrew Kelley
4cfeb9a541 glibc: fix race condition when building stubs
Before, the code for building glibc stubs used a special case of the
Cache API that did not add any file inputs, and did not use
writeManifest(). This is not really how the Cache API is designed to
work and it shows because there was a race condition.

This commit adds as an input file the abilists file that comes with
Zig's installation, which has the added benefit of making glibc stub
caching properly detect cache invalidation when the user decides to
overwrite their abilists file. This harmonizes with the rest of how Zig
works, which intentionally allows you to hack the installation files and
have it behave properly with the cache system.

Finally, because of having any file inputs, the normal API flow of the
Cache system can be used, eliminating the one place that used the Cache
API in a special way. In other words, it uses writeManifest() now and
properly obeys the cache hit/miss semantics.

closes #13160
2022-10-29 12:15:47 -07:00
Jacob Young
48a2783969 cbe: implement optional slice representation change 2022-10-29 05:58:41 -04:00
Andrew Kelley
20925b2f5c
Merge pull request #13272 from topolarity/sha2-intrinsics
crypto.sha2: Use intrinsics for SHA-256 on x86-64 and AArch64
2022-10-29 03:31:42 -04:00
Andrew Kelley
c36eb4ede9
Merge pull request #13221 from topolarity/packed-mem
Introduce `std.mem.readPackedInt` and improve bitcasting of packed memory layouts
2022-10-28 21:15:16 -04:00
Zhora Trush
c66d3f6bf6 Enhance indexOfIgnoreCase with Boyer-Moore-Horspool algorithm 2022-10-28 20:29:41 -04:00
Cody Tapscott
67fa3262b1 std.crypto: Use featureSetHas to gate intrinsics
This also fixes a bug where the feature gating was not taking
effect at comptime due to https://github.com/ziglang/zig/issues/6768
2022-10-28 17:17:08 -07:00
Andrew Kelley
84e0c148b1 CLI: report error when -fstage1 requested but not available 2022-10-28 15:30:04 -07:00
Cody Tapscott
f9fe548e41 std.crypto: Add isComptime guard around intrinsics
Comptime code can't execute assembly code, so we need some way to
force comptime code to use the generic path. This should be replaced
with whatever is implemented for #868, when that day comes.

I am seeing that the result for the hash is incorrect in stage1 and
crashes stage2, so presumably this never worked correctly. I will follow
up on that soon.
2022-10-28 15:21:10 -07:00
Cody Tapscott
4c1f71e866 std.crypto: Optimize SHA-256 intrinsics for AMD x86-64
This gets us most of the way back to the performance I had when
I was using the LLVM intrinsics:
  - Intel Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz:
       190.67 MB/s (w/o intrinsics) -> 1285.08 MB/s
  - AMD EPYC 7763 (VM) @ 2.45 GHz:
       240.09 MB/s (w/o intrinsics) -> 1360.78 MB/s
  - Apple M1:
       216.96 MB/s (w/o intrinsics) -> 2133.69 MB/s

Minor changes to this source can swing performance from 400 MB/s to
1400 MB/s or... 20 MB/s, depending on how it interacts with the
optimizer. I have a sneaking suspicion that despite LLVM inheriting
GCC's extremely strict inline assembly semantics, its passes are
rather skittish around inline assembly (and almost certainly, its
instruction cost models can assume nothing)
2022-10-28 15:21:10 -07:00
Cody Tapscott
ee241c47ee std.crypto: SHA-256 Properly gate comptime conditional
This feature detection must be done at comptime so that we avoid
generating invalid ASM for the target.
2022-10-28 15:21:10 -07:00
Cody Tapscott
10edb6d352 crypto.sha2: Use intrinsics for SHA-256 on x86-64 and AArch64
There's probably plenty of room to optimize these further in the
future, but for the moment this gives ~3x improvement on Intel
x86-64 processors, ~5x on AMD, and ~10x on M1 Macs.

These extensions are very new - Most processors prior to 2020 do
not support them.

AVX-512 is a slightly older alternative that we could use on Intel
for a much bigger performance bump, but it's been fused off on
Intel's latest hybrid architectures and it relies on computing
independent SHA hashes in parallel. In contrast, these SHA intrinsics
provide the usual single-threaded, single-stream interface, and should
continue working on new processors.

AArch64 also has SHA-512 intrinsics that we could take advantage
of in the future
2022-10-28 15:21:10 -07:00
Evan Haas
c616141241 translate-c: Better support for division in macros
Perform C-style arithmetic conversions on operands to division operator
in macros

Closes #13162
2022-10-28 17:59:32 -04:00
Cody Tapscott
40b7792a4c Enable bitcast test now that #13214 is resolved. 2022-10-28 12:41:15 -07:00
Veikka Tuominen
bd32206b44
Merge pull request #13322 from Vexu/comptime-reason
Further enhance explanation of why expression is evaluated at comptime
2022-10-28 20:15:13 +02:00
Cody Tapscott
03ed0a59e3 std.mem: Skip read/writePackedInt test on WASM32/64 2022-10-28 08:41:04 -07:00
Cody Tapscott
9d0a4b60e1 Value: Add @intCast in writeToPackedMemory for 32-bit targets 2022-10-28 08:41:04 -07:00
Cody Tapscott
3295fee911 stage2: Use mem.readPackedInt etc. for packed bitcasts
Packed memory has a well-defined layout that doesn't require
conversion from an integer to read from. Let's use it :-)

This change means that for bitcasting to/from a packed value that
is N layers deep, we no longer have to create N temporary big-ints
and perform N copies.

Other miscellaneous improvements:
  - Adds support for casting to packed enums and vectors
  - Fixes bitcasting to/from vectors outside of a packed struct
  - Adds a fast path for bitcasting <= u/i64
  - Fixes bug when bitcasting f80 which would clear following fields

This also changes the bitcast memory layout of exotic integers on
big-endian systems to match what's empirically observed on our targets.
Technically, this layout is not guaranteed by LLVM so we should probably
ban bitcasts that reveal these padding bits, but for now this is an
improvement.
2022-10-28 08:41:04 -07:00
Cody Tapscott
c639c22544 std.mem: Add readPackedInt, writePackedInt, etc.
These utility functions allow reading from (stage2) packed memory at
runtime-known offsets.
2022-10-28 08:41:04 -07:00
Frank Denis
f28e4e03ee
std.sign.ecdsa: add support for incremental signatures (#13332)
Similar to what was done for EdDSA, allow incremental creation
and verification of ECDSA signatures.

Doing so for ECDSA is trivial, and can be useful for TLS as well
as the future package manager.
2022-10-28 16:25:37 +02:00
Ali Chraghi
d6943f87f9 NativeTargetInfo: remove unused error 2022-10-28 13:58:28 +02:00
Veikka Tuominen
6fc71835c3 value: properly hash null_value pointer
Closes #13325
2022-10-28 13:31:16 +03:00
Veikka Tuominen
c3b85e4e2f Sema: further enhance explanation of why expr is evaluated at comptime 2022-10-28 13:31:16 +03:00
Andrew Kelley
c389f8800b
Merge pull request #13290 from Vexu/generic-deletion-mitigation
Mitigate generic deletion bug
2022-10-28 01:04:00 -04:00
Andrew Kelley
23878aec4a CI: azure: fix upload script
Partial revert of changes made in
398a3aae40, fixes regression.
2022-10-27 20:57:21 -07:00
Andrew Kelley
1f4f8d34a1 compiler_rt: fix memcmp wrong for some inputs
See the new test case - this fails in the previous implementation.

See #13303
2022-10-27 22:11:20 -04:00
Andrew Kelley
2991e4a454
Merge pull request #13288 from Vexu/opt-slice
Optimize size of optional slices (+ some fixes)
2022-10-27 22:09:17 -04:00