Commit Graph

6397 Commits

Author SHA1 Message Date
Andrew Kelley 07671838b0 Merge pull request #13561 from jacobly0/gcc-warnings 2022-11-16 10:38:44 -05:00
Eric Joldasov 684264908e compiler_rt: fix TODOs in udivmod.zig 2022-11-16 13:08:41 +02:00
Jacob Young b5b507a742 zig.h: match float comparison signatures from compiler rt 2022-11-15 23:33:48 -05:00
Veikka Tuominen b6b3462796 std.mem.Allocator: do not return undefined pointers from create
Closes #13517
2022-11-16 01:12:27 +02:00
GethDW 024bac7f53 std.build: fix typo
This would only fail to compile when building *on* WASI.
2022-11-15 23:23:27 +02:00
Hayden Pope ceb9fedb47 std.os.linux: Add setitimer and getitimer syscalls 2022-11-15 02:38:28 -05:00
Frank Denis 7eed028f9a crypto.bcrypt: fix massive speed regression when using stage2 (#13518)
state: State -> state: *const State
Suggested by @nektro

Fixes #13510
2022-11-14 16:37:19 +01:00
Naoki MATSUMOTO b29057b6ab std.crypto.ghash: fix uninitialized polynomial use (#13527)
In the process of 'remaining blocks',
the length of processed message can be from 1 to 79.
The value of 'n-1' is ranged from 0 to 3.
So, st.hx[i] must be initialized at least from st.hx[0] to st.hx[3]
2022-11-14 16:35:08 +01:00
Andrew Kelley 20e8c2df4e zig.h: remove redundant definition of u16/i16 2022-11-13 16:50:20 -07:00
Andrew Kelley 77e7d97725 C backend: improve ergonomics of zig.h a little bit
Partially implements #13528. Enough to unblock the wasi-bootstrap
branch.
2022-11-13 16:50:16 -07:00
Halil b2ffe113d3 x/os/Reactor: implement remove function (#13330)
* x/os/Reactor: implement remove function

* x/os/Reactor: update tests
2022-11-13 17:43:29 +02:00
Jonathan 81dadbcd77 pthread_sigmask 2022-11-13 17:36:56 +02:00
Nick Cernis 8a5818535b Make invalidFmtError public and use in place of compileErrors for bad format strings (#13526)
* Export invalidFmtErr

To allow consistent use of "invalid format string" compile error
response for badly formatted format strings.

See https://github.com/ziglang/zig/pull/13489#issuecomment-1311759340.

* Replace format compile errors with invalidFmtErr

- Provides more consistent compile errors.
- Gives user info about the type of the badly formated value.

* Rename invalidFmtErr as invalidFmtError

For consistency. Zig seems to use “Error” more often than “Err”.

* std: add invalid format string checks to remaining custom formatters

* pass reference-trace to comp when building build file; fix checkobjectstep
2022-11-12 21:03:24 +02:00
IntegratedQuantum fbc4331f18 Implements std.math.sign for float vectors. 2022-11-12 15:41:55 +02:00
Jakub Konka 7733246d6e pdb: make SuperBlock def public 2022-11-12 09:40:40 +01:00
Frank Denis df7223c7f2 crypto.AesGcm: provision ghash for the final block 2022-11-11 18:04:22 +01:00
Frank Denis 59af6417bb crypto.ghash: define aggregate tresholds as blocks, not bytes (#13507)
These constants were read as a block count in initForBlockCount()
but at the same time, as a size in update().

The unit could be blocks or bytes, but we should use the same one
everywhere.

So, use blocks as intended.

Fixes #13506
2022-11-10 19:00:00 +01:00
Veikka Tuominen 41b7e40d75 Merge pull request #13418 from ryanschneider/signal-alignment-13216
std.os: fix alignment of Sigaction.handler_fn
2022-11-09 17:36:40 +02:00
IntegratedQuantum d1e7be0bd1 Handle sentinel slices in std.mem.zeroes
Fixes #13256
2022-11-09 17:33:48 +02:00
bfredl 95f989a05b Fixes to linux/bpf/btf.zig
- the meaning of packed structs changed in zig 0.10. adjust accordingly.
  Use "extern struct" for the cases that directly map to C structs.

- Add new type info kinds, like enum64 and DeclTag

- change the Type enum to use the canonical names from libbpf.
  This is more predictable when comparing with external BPF
  documentation (than invented synonyms that need to be guessed)
2022-11-09 17:14:22 +02:00
Frank Denis 36e618aef1 crypto.ghash: compatibility with stage1
Defining the selector enum outside the function definition is
required for stage1.
2022-11-08 16:59:53 +01:00
Frank Denis 7d48cb1138 std.crypto: make ghash faster, esp. for small messages (#13464)
* std.crypto: make ghash faster, esp. for small messages

Aggregated reduction requires 5 additional multiplications (to
precompute the powers of H), in order to save 2 multiplications
per batch.

So, only use large batches when it's actually interesting to do so.

For the last blocks, reuse the precomputations in order to perform
a single reduction.

Also, even in .ReleaseSmall, allow 2-block aggregation.
The speedup is worth it, and the code increase is reasonable.

And in .ReleaseFast, bump the upper batch size up to 16.

Leverage comptime by the way instead of duplicating code.

std/crypto/benchmark.zig on Apple M1:

    Zig 0.10.0: 2769 MiB/s
        Before: 6014 MiB/s
         After: 7334 MiB/s

Normalize function names by the way.

* Change clmul() to accept the half to be processed

This avoids a bunch of truncate() calls.

* Add more ghash tests to check all code paths
2022-11-07 21:45:29 +01:00
Frank Denis 32563e6829 crypto.core.aes: process 6 block in parallel instead of 8 on aarch64 (#13473)
* crypto.core.aes: process 6 block in parallel instead of 8 on aarch64

At least on Apple Silicon, this is slightly faster than 8 blocks.

* AES: add parallel blocks for tigerlake, rocketlake, alderlake, zen3
2022-11-07 12:28:37 +01:00
Frank Denis 907f3ef887 crypto.salsa20: make the number of rounds a comptime parameter (#13442)
...instead of hard-coding it to 20.

- This is consistent with the ChaCha implementation
- NaCl and libsodium, that this API is designed to interop with,
also support 8 and 12 round variants. The 12 round variant, in
particular, provides the same security level as the 20 round variant,
but is obviously faster.
- scrypt currently uses its own non optimized version of Salsa, just
because it use 8 rounds instead of 20. This will help remove code
duplication.

No behavior nor public API changes. The Salsa20 and XSalsa20 still
represent the 20-round variant.
2022-11-06 23:52:41 +01:00
r00ster91 b83e4d9656 std.os.linux.T: translate more MIPS values
This fixes the broken terminal for me and thus fixes #13198.
2022-11-06 16:33:50 +02:00
Jay Petacat 694d8831c3 Revert "x86" CPU model (not arch) back to "i386"
PR #13101 recently renamed the "i386" architecture to "x86", and it
seems the specific CPU model got swept up in that. "x86" is an umbrella
term that describes a family of CPUs, and the "i386" is the oldest
supported model under that umbrella.
2022-11-06 13:39:03 +01:00
delitako c8a5ad6d9d Improve doc comments for two functions (#13456)
* std.heap: fix function name in doc comment

* std.mem: document return value of `replace`
2022-11-05 22:55:50 +01:00
Ali Chraghi aea617c60b std.os: take advantage of the freebsd's copy_file_range 2022-11-05 15:43:39 -04:00
Jakub Konka 83d89a05b7 coff: compile and link simple exit program on arm64
* make image base target dependent
* fix relocs to imports
2022-11-05 10:15:01 +01:00
Andrew Kelley 1d68045919 Merge pull request #13101 from alichraghi/o4 2022-11-05 02:34:24 -04:00
Ryan Schneider a68b27c252 std.os: improve sigaction test coverage. 2022-11-04 08:07:44 -07:00
Ryan Schneider 7f1f2e653d std.os: fix alignment of Sigaction.handler_fn
Fixes #13216
2022-11-04 08:00:50 -07:00
Ryan Schneider 64b3ffd8ff std.os: Add IGN coverage to sigaction tests
* Should start failing on aarch64 and other word-aligned CPUs.
2022-11-04 08:00:50 -07:00
Veikka Tuominen 986b7ce5b2 rename i386-linux-gnu to x86-linux-gnu 2022-11-04 16:41:23 +02:00
Veikka Tuominen 8c4faa5f3f Merge pull request #13338 from Vexu/stage2-compile-errors
Improve some error messages
2022-11-04 16:04:31 +02:00
Andrew Kelley 42755a1944 Merge pull request #13430 from ziglang/stack-probe-msvc
Miscellaneous arm64 windows fixes
2022-11-03 19:49:10 -04:00
Ali Chraghi f5f1f8c666 all: rename i386 to x86 2022-11-04 00:09:27 +03:30
Yujiri b19161ba9c Add docstrings to some functions in std.meta 2022-11-03 17:37:38 +02:00
Veikka Tuominen 678f3f6e65 Merge pull request #13276 from r00ster91/stem
std.fs.path: add stem()
2022-11-03 16:45:37 +02:00
Jakub Konka 480c3c4d0a compiler_rt: fix duplicate symbol error when linking libc on arm64 Windows 2022-11-03 14:41:28 +01:00
Frank Denis 96793530cd std.crypto.pwhash.bcrypt: inline the Feistel network function (#13416)
std/crypto/benchmark.zig results:

* Intel i5

before: 3.144 s/ops
 after: 1.922 s/ops

* Apple M1

before: 2.067 s/ops
 after: 1.373 s/ops
2022-11-03 13:10:08 +01:00
Nathan Bourgeois e64eef366c Translate-C Remainder Macro Fix 2022-11-03 14:07:00 +02:00
Jacob Young 085f6fd8f7 cbe: use wrapping for left shifts 2022-11-02 23:00:10 -04:00
Jacob Young fa46f9a3d7 cbe: fix extern 2022-11-02 21:42:40 -04:00
Eric Milliken b40fc70188 std.time: add microTimestamp() (#13327) 2022-11-02 23:20:19 +01:00
Andrew Kelley e50789f1cb Merge pull request #13389 from jacobly0/fix-only-c
cbe: enough fixes for `-Donly-c` to be able to produce an executable
2022-11-02 15:53:59 -04:00
Jacob Young 771dadc5e0 x86: cleanup inline asm
Multiple outputs work now, so use that instead of deleting clobbers.
2022-11-01 20:39:06 -04:00
Jacob Young 9b2db56d0f x86: remove inline asm clobbers that conflict with inputs or outputs 2022-11-01 20:39:06 -04:00
Jacob Young 91fe0b80a2 cbe: fix threadlocal 2022-11-01 20:38:51 -04:00
Jacob Young 757db665a7 build: remove ofmt from LibExeObjStep which is redundant with target.ofmt 2022-11-01 20:38:37 -04:00