Commit Graph

3440 Commits

Author SHA1 Message Date
Joran Dirk Greef 9091fcbe9d Improve openat/accept test debugging 2020-10-04 15:11:09 +02:00
Joran Dirk Greef 6a53f4be4b Add openat(), close(), connect(), send(), recv(), as well as tests
Removes non-essential .hardlink_with_next_sqe() and .drain_previous_sqes().
2020-10-04 13:15:39 +02:00
Joran Dirk Greef 3d2de6cfba Use load relaxed semantics when reading the SQPOLL wakeup flag 2020-10-04 13:14:57 +02:00
Joran Dirk Greef 69a55fc560 Allow for advanced non-sequential SQE allocation schemes
Decouples SQE queueing and SQE prepping methods to allow for non-sequential
SQE allocation schemes as suggested by @daurnimator.

Adds essential SQE prepping methods from liburing to reduce boilerplate.

Removes non-essential .link_with_next_sqe() and .use_registered_fd().
2020-10-04 13:01:41 +02:00
Joran Dirk Greef e32c7d06e5 Limit entries to u12, add errors for invalid entries, use mem.zeroInit 2020-10-04 12:49:48 +02:00
Joran Dirk Greef 61ec6cb6d3 Expose available kernel features 2020-10-04 12:48:08 +02:00
Andrew Kelley 8170a3d574 Merge pull request #6463 from jedisct1/ghash
std/crypto: add GHASH implementation
2020-10-04 02:46:36 -04:00
Andrew Kelley 5fda4fe4c8 Merge pull request #6454 from jedisct1/hkdf
std/crypto: implement the HKDF construction
2020-10-04 02:45:54 -04:00
LemonBoy 538d485782 std: Add pow(a,b) for big ints
Implemented following Knuth's "Evaluation of Powers" chapter in TAOCP,
some extra complexity is needed to make sure there's no aliasing and
avoid allocating too many limbs.

A brief example to illustrate why the last point is important:
consider 10^123, since 10 is well within the limits of a single limb we
can safely say that the result will surely fit in:

⌈log2(10)⌉ bit * 123 = 492 bits = 7 limbs

A naive calculation using only the number of limbs yields:

1 limb * 123 = 123 limbs

The space savings are noticeable.
2020-10-04 02:24:40 -04:00
Andrew Kelley 70f3767903 revert adding std.event.Loop.runDetached
I'd like to discuss this before adding it. I think this is the wrong
direction to go with this API.
2020-10-03 17:13:22 -07:00
LemonBoy 8b4f5f039d Alternative strategy to avoid calling stat()
This is an optimization as it avoids an extra syscall, but it's also a
workaround for fstat being not available on Windows.
2020-10-03 19:51:22 +02:00
Joran Dirk Greef c5b4fcaa1c Add IORING_FEAT_POLL_32BITS 2020-10-03 17:43:08 +02:00
Joran Dirk Greef a9b107045f Use load acquire semantics when reading the SQPOLL wakeup flag
Ensures that the wakeup flag is read after the tail pointer has been
written. It's important to use memory load acquire semantics for the
flags read, otherwise the application and the kernel might not agree on
the consistency of the wakeup flag, leading to I/O starvation.

Refs: https://github.com/axboe/liburing/commit/6768ddcc562adb6ea141cf508bccecb6be8ce666
Refs: https://github.com/axboe/liburing/issues/219
2020-10-03 14:34:42 +02:00
Joran Dirk Greef 95def89c23 Handle EBADFD (ring fd in bad state) in enter() 2020-10-03 14:34:01 +02:00
LemonBoy 0f248e0988 std: Make file copy ops use zero-copy mechanisms
Use copy_file_range on Linux (if available), fcopyfile on Darwin,
sendfile on *BSDs (and on Linux kernels without copy_file_range).
2020-10-03 12:31:17 +02:00
Loris Cro 276598346a provide the full buffer length to _NSGetExecutablePath
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-10-03 12:03:22 +02:00
Loris Cro f841ea77e2 make symlink buffer null-terminated
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-10-02 19:33:14 +02:00
Loris Cro a2074c1ec3 fix symlink path not being resolved in darwin
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-10-02 17:06:29 +02:00
Alexandros Naskos 55eb7c16c0 Merge pull request #6494 from IridescentRose/emit-reloc-patch
Emit reloc patch
2020-10-02 17:00:47 +03:00
Alexandros Naskos cd4c1ea790 Merge pull request #6491 from markfirmware/patch-2
Fixes --linker-script unrecognized
2020-10-02 17:00:22 +03:00
Alexandros Naskos 006b780d44 Merge pull request #6484 from LemonBoy/winshit
Some windows fixes
2020-10-02 15:05:44 +03:00
Tadeo Kondrak 183d1d4ba1 Switch TypeInfo.Fn.alignment to comptime_int from u29
All integers in TypeInfo are intentionally comptime_int:
https://github.com/ziglang/zig/issues/1683
2020-10-01 18:01:41 -06:00
Tadeo Kondrak 97ab720d84 stage1: Add alignment to TypeInfo.Fn 2020-10-01 17:59:42 -06:00
Alexandros Naskos 0228887b94 Merge pull request #6428 from tadeokondrak/alignment-typeinfo-struct-union
Add alignment field to TypeInfo.UnionField and TypeInfo.StructField
2020-10-02 02:56:18 +03:00
Nathan 84b6d2a80a Resolved additional formatting issues. 2020-10-01 18:03:34 -04:00
Nathan 5e3ce11b18 Resolve name and format issues. 2020-10-01 17:47:32 -04:00
Alexandros Naskos a4fe438d39 std.fmt.comptimePrint: bufPrint cannot return an error 2020-10-02 00:39:19 +03:00
Tadeo Kondrak 362c87f1aa Update std.meta.ArgsTuple for alignment in StructField/UnionField 2020-10-01 15:06:24 -06:00
Tadeo Kondrak ec8f0777f2 Update std.meta.Tuple for alignment in StructField/UnionField 2020-10-01 15:06:23 -06:00
Nathan Bourgeois 4566b27373 Patch in emit relocs support 2020-10-01 17:04:04 -04:00
Tadeo Kondrak a12203d2be Switch TypeInfo alignment fields from u29 to comptime_int 2020-10-01 15:01:28 -06:00
Tadeo Kondrak d81648ce8c Add alignment field to TypeInfo.UnionField and TypeInfo.StructField
Closes https://github.com/ziglang/zig/issues/6122
2020-10-01 15:01:25 -06:00
Tadeo Kondrak 77df5dae7f Make builtin.TypeInfo.Pointer.alignment u29 instead of comptime_int 2020-10-01 15:01:24 -06:00
Alexandros Naskos 5acf2a5068 Merge pull request #6419 from tadeokondrak/std.fmt.comptimePrint
std.fmt: add comptimePrint
2020-10-01 23:59:00 +03:00
markfirmware 1296e4a857 Update build.zig 2020-10-01 15:27:08 -04:00
markfirmware 8acfcf4e0d Update build.zig
Fixes #6477
2020-10-01 13:15:35 -04:00
Alexandros Naskos bf0afaa876 std.event.Loop.runDetached should be pub 2020-10-01 16:50:05 +03:00
Alexandros Naskos beda6f2299 Merge pull request #6455 from kristoff-it/event-loop-go
add runDetached to event loop
2020-10-01 15:57:02 +03:00
LemonBoy 1b2d50737a mingw: Add user32.def for 32bit Windows
Closes #6479
2020-10-01 11:27:59 +02:00
Frank Denis 97fd0974b9 ghash: add pclmul support on x86_64 2020-10-01 02:05:11 +02:00
Frank Denis 8161de7fa4 Implement ghash aggregated reduction
Performance increases from ~400 MiB/s to 450 MiB/s at the expense of
extra code. Thus, aggregation is disabled on ReleaseSmall.

Since the multiplication cost is significant compared to the reduction,
aggregating more than 2 blocks is probably not worth it.
2020-10-01 02:05:07 +02:00
Frank Denis f1ad94437b ghash & poly1305: use pointer to slices for keys and output 2020-10-01 02:04:30 +02:00
Frank Denis 58873ed3f9 std/crypto: add GHASH implementation
GHASH is required to implement AES-GCM.

Optimized implementations for CPUs with instructions for carry-less
multiplication will be added next.
2020-10-01 02:04:30 +02:00
Alexandros Naskos 4eb390b157 Merge pull request #6457 from Snektron/fix-arraylistunmanaged
Fix std.ArrayListUnmanaged + improve test coverage
2020-10-01 00:09:45 +03:00
Andrew Kelley 718a659773 std: skip some tests that stage1 leaks too much memory with
We can restore these when we have self-hosted available.

This is intended to address #6467
2020-09-30 12:37:00 -07:00
Andrew Kelley 7067764ed3 Merge remote-tracking branch 'origin/master' into llvm11
The changes to install_files.h needed to put into src/libcxx.zig
2020-09-30 02:55:41 -07:00
Andrew Kelley fe117d9961 Merge pull request #6250 from ziglang/stage2-zig-cc
move `zig cc`, `zig translate-c`, `zig libc`, main(), and linking from stage1 to stage2
2020-09-30 04:28:19 -04:00
Andrew Kelley 2a893efae1 fix incorrect dylib filename pattern in the previous commit 2020-09-30 00:53:55 -07:00
Andrew Kelley 870af49074 std.zig.binNameAlloc: take into account version for macos dylibs 2020-09-30 00:36:20 -07:00
Ryan Liptak bd449b184a Add deleteDir test with exception for not-empty directory on Windows
Re-adds the test that was added and then reverted in https://github.com/ziglang/zig/pull/6397, but with the test for https://github.com/ziglang/zig/issues/5537 skipped for now since that issue is no longer fixed.
2020-09-30 02:35:17 -04:00