Commit graph

7969 commits

Author SHA1 Message Date
Frank Denis
a5c79c7998
crypto.ff: faster exponentiation with short/public exponents (#17617)
RSA exponents are typically 3 or 65537, and public.

For those, we don't need to use conditional moves on the exponent,
and precomputing a lookup table is not worth it. So, save a few
cpu cycles and some memory for that common case.

For safety, make `powWithEncodedExponent()` constant-time by default,
and introduce a `powWithEncodedPublicExponent()` function for exponents
that are assumed to be public.

With `powWithEncodedPublicExponent()`, short (<= 36 bits) exponents
will take the fast path.
2023-10-21 02:09:43 -07:00
Ryan Liptak
fb5f69a552 Improve Dir.makePath and Dir.makeOpenPathAccessMaskW doc comments
These are not recursive functions, so 'recursively' could be misleading.
2023-10-20 23:25:43 -07:00
Ryan Liptak
63b504219d Dir.makeOpenPathAccessMaskW: Use path.ComponentIterator
See 49053cb1b4 for details

Also, fix leaking the intermediate directory handles.
2023-10-20 23:25:43 -07:00
joadnacer
89aad1b89c linux.io_uring: Implement splice functions 2023-10-21 05:02:17 +03:00
Andrew Kelley
0d4d8dfc15 std.Target: update default Linux cross-compiling version
Currently, Zig uses the oldest Debian release that is still under LTS
for the default version minimum. This is now Debian 10 (Buster), with
long-term support until 2024-06-30.

Debian Buster uses Linux 4.19 and glibc 2.28.

For the default version maximum, Zig uses the newest stable Linux
version, which is currently 6.5.7.

Citations:
* https://www.debian.org/News/2019/20190706
* https://packages.debian.org/source/buster/glibc
* https://kernel.org/

Previous update commit: 1530203c80
2023-10-20 20:12:50 -04:00
Constantin Bilz
45d7dfa833 std.hash_map: add const attribute to StringIndexContext.bytes and ...
StringIndexAdapter.bytes

Without this change, constructing a Context/Adapter for a `const` string
table requires a `@constCast`.
2023-10-20 19:06:32 +03:00
Andrew Kelley
a361f37b1c
Merge pull request #17608 from squeek502/resinator-fixes
resinator: Fix `INCLUDE` var handling and sync with upstream
2023-10-20 03:49:14 -04:00
dweiller
db18b562ac std.Build: do not assume custom test runners support client-server mode 2023-10-20 02:39:17 -04:00
Prokop Randacek
fee09009a8 gettimeofday takes nullable pointers 2023-10-20 00:15:34 -04:00
Krzysztof Wolicki
530dc0405c
std.os: unlinkW shouldn't return error.DirNotEmpty 2023-10-19 12:59:52 +00:00
Andrew Kelley
ae2cd5fe26 Revert "Never implicitly add rpaths for each lib dir, add NixOS libdir to rpath"
This reverts commit d7b73af8f6.

I did not look at this closely enough. This is incorrect; it should not
implicitly add rpaths for every library, and it should not disable the
nice default of each_lib_path when compiling for the native OS.

See #16062 where we are working on a follow-up improvement to this.
2023-10-18 23:37:47 -07:00
Ryan Liptak
c139b9d4ad path.ComponentIterator: Add peekNext and peekPrevious functions 2023-10-18 20:42:59 -07:00
Qusai Hroub
f6a6cdbba3 std.fs.Dir.makeOpenPath: optimize when path already exists
Uses a single NtCreateFile syscall on windows.

Closes #12474. Thanks to @joedavis and @matu3ba.
2023-10-18 20:36:03 -07:00
Ryan Liptak
8ec04b567e Error if an .rc file uses the 'preprocess only' or 'no preprocess' flags 2023-10-18 18:30:32 -07:00
Andrew Kelley
32bc077672 std.Build: make dependencies inherit --search-prefix 2023-10-18 20:01:25 -04:00
Krzysztof Wolicki
bffe65c18f std.ChildProcess: fix error in killWindows 2023-10-18 19:11:28 -04:00
Andrew Kelley
8804d72684 std certs: solaris can use the BSD path 2023-10-18 12:51:45 -04:00
Andrew Kelley
e8f3c4c4b1
Merge pull request #13610 from bcrist/child_process_already_terminated
return error.AlreadyTerminated from std.ChildProcess.kill when necessary
2023-10-18 10:23:23 -04:00
Andrew Kelley
149f2f8adb
Merge pull request #17524 from Vexu/aro-translate-c
Add ability to test Aro based `translate-c`
2023-10-18 00:32:59 -04:00
Ben Crist
fb9376bd04 Double check that child processes have really exited when
TerminateProcess reports ACCESS_DENIED
2023-10-17 16:56:39 -07:00
Ben Crist
6d47198303 return error.AlreadyTerminated from std.ChildProcess.kill when necessary 2023-10-17 16:56:15 -07:00
Tobias Simetsreiter
7a9500fd80
Fix rendering ast in zon mode (#17547)
Co-authored-by: Tobias Simetsreiter <tobias.simetsreiter@wabtec.com>
2023-10-17 19:04:01 -04:00
David
364c54460f
Deflate: fix missing value in reset 2023-10-17 21:46:47 +00:00
David
5c8912d7a4
XXH3 Implementation for Zig STD (#17530)
XXH3 is the faster alternative to XXH64 which utilizes SIMD
when hashing large chunks of memory and similar mixing to
WyHash (64x64 -> 128 mul) for smaller inputs.

Co-authored-by: Reixcon226 <87927264+Rexicon226@users.noreply.github.com>

---------

Co-authored-by: kprotty <kbutcher6200@gmail.com>
2023-10-17 13:55:01 -05:00
Andrew Kelley
3b21c15782
Merge pull request #17562 from ziglang/fetch-symlink-normalize-sep
Package.Fetch: normalize path separators in symlinks
2023-10-17 14:35:39 -04:00
kcbanner
68ed787751 windows: fix ReadLink not using a synchronous file handle 2023-10-17 14:33:55 -04:00
Andrew Kelley
877393d17a std.fs: fix relative symbolic links on Windows
closes #17564
2023-10-17 06:27:07 -04:00
Veikka Tuominen
e765495b11 tests: translate-c and run-translated-c to the test harness 2023-10-17 11:55:17 +03:00
Andrew Kelley
f1a9344ffe std.fs.openDir: handle OBJECT_NAME_INVALID 2023-10-16 17:22:24 -07:00
Andrew Kelley
b171a6f25d Package.Fetch: normalize path separators in symlinks
closes #17549
2023-10-16 16:47:47 -07:00
Andrew Kelley
1456f95b3c std: disable flaky test on aarch64-windows
tracked by #17134
2023-10-16 16:13:46 -07:00
joadnacer
7b9165b375 std.mem: Improve writeIntSlice performance 2023-10-16 08:49:05 -04:00
Jacob Young
fbd90e487b Build: fix some issues with ConfigHeader step
* include path was using bad default for dependency lazy paths
 * unhashed config options caused changes to not trigger a rebuild
2023-10-16 03:50:47 -04:00
Andrew Kelley
ca690ffa22
Merge pull request #17448 from squeek502/win32-manifest
Add preliminary support for Windows `.manifest` files
2023-10-15 19:47:27 -07:00
Robin Voetter
fd6b3db342
Merge pull request #17293 from Snektron/spirv-aaaa
spirv: more instructions
2023-10-16 02:04:09 +02:00
Ryan Liptak
5f15acc463 Add preliminary support for Windows .manifest files
An embedded manifest file is really just XML data embedded as a RT_MANIFEST resource (ID = 24). Typically, the Windows-only 'Manifest Tool' (`mt.exe`) is used to embed manifest files, and `mt.exe` also seems to perform some transformation of the manifest data before embedding, but in testing it doesn't seem like the transformations are necessary to get the intended result.

So, to handle embedding manifest files, Zig now takes the following approach:

- Generate a .rc file with the contents `1 24 "path-to-manifest.manifest"`
- Compile that generated .rc file into a .res file
- Link the .res file into the final binary

This effectively achieves the same thing as `mt.exe` minus the validation/transformations of the XML data that it performs.

How this is used:

On the command line:
```
zig build-exe main.zig main.manifest
```
(on the command line, specifying a .manifest file when the target object format is not COFF is an error)

or in build.zig:

```
const exe = b.addExecutable(.{
    .name = "manifest-test",
    .root_source_file = .{ .path = "main.zig" },
    .target = target,
    .optimize = optimize,
    .win32_manifest = .{ .path = "main.manifest" },
});
```
(in build.zig, the manifest file is ignored if the target object format is not COFF)

Note: Currently, only one manifest file can be specified per compilation. This is because the ID of the manifest resource is currently always 1. Specifying multiple manifests could be supported if a way for the user to specify an ID for each manifest is added (manifest IDs must be a u16).

Closes #17406

options
2023-10-15 13:33:16 -07:00
Johan Jansson
a1e0b9979a std.heap.ArenaAllocator: fix doc comment typo
Fixes #17537
2023-10-15 21:20:48 +03:00
Robin Voetter
3ca1f88898
std.testing: disable expectEqualSlices printing for spirv 2023-10-15 14:00:26 +02:00
Robin Voetter
dc44baf763
std.testing: allow print() at comptime
This allows functions like expectEqual to be performed at comptime. If
an error is detected, the result is logged via a compile error.
2023-10-15 14:00:08 +02:00
joadnacer
a241cf90d6 std.base64: Improve Encoder/Decoder performance 2023-10-14 23:28:19 -07:00
JustinWayland
895c81ce72
Add a missing period in Future's description 2023-10-14 11:20:11 +03:00
Andrew Kelley
2d7d037c48
Merge pull request #17510 from Vexu/vector
Fix `@Vector` source locations being swapped
2023-10-13 16:04:47 -07:00
radar roark
244233da2a remove redundant use of pathFromRoot 2023-10-13 07:20:45 -07:00
Veikka Tuominen
c919e9a280 std.simd: return comptime_int from suggestVectorSize 2023-10-13 16:58:05 +03:00
Andrew Kelley
027aabf497 drop for loop syntax upgrade mechanisms 2023-10-13 03:43:54 -07:00
Koakuma
375bb5f4a1 lib: Fix asm code in _start for SPARC
SPARCs have delayed branches, that is, it will unconditionally
run the next instruction following a branch.
Slightly reorder the _start code sequence to prevent it from
accidentally executing stray instructions, which may result in odd
program behavior.
2023-10-12 16:13:32 -07:00
JustinWayland
b37fdf387a Fix minor typo in the description of Progress 2023-10-13 00:44:30 +03:00
Kai Jellinghaus
2254882ebe Fix compilation failure in valgrind.zig 2023-10-12 10:17:49 -07:00
Alexander Heinrich
4e188dd66c Update docs of PriorityQueue.iterator() and PriorityDeque.iterator() 2023-10-12 04:48:22 +03:00
Krzysztof Wolicki
7edba14d7c
Step.Run: change cwd to ?Build.LazyPath (#17418)
closes #17409
2023-10-10 18:39:44 -04:00