18593 Commits

Author SHA1 Message Date
Andrew Kelley
e0a0df5a8a
Merge pull request #11598 from aiotter/master
Add functions from `dirent.h` to std.c
2022-05-26 20:11:54 -04:00
Jonathan Marler
ee1a95b555 fix semantic error with std.os.linux.all_mask
all_mask is a value of type sigset_t, which is defined as an array type
[N]u32.  However, all_mask references sigset_t.len, but, the array type
does not have a len field.  Fix is to use @typeInfo(sigset_t).Array.len
instead.
2022-05-26 19:50:10 -04:00
Hanna
4e918873e7
Rename std.build.Pkg.path to std.build.Pkg.source (#11557) 2022-05-26 19:32:28 -04:00
Andrew Kelley
67d5bfefba std.testing: remove tight coupling with executing zig as child process
This tight coupling causes problems for various targets, requires
hacky "get args" functionality, and bungles relative file system paths,
making invalid assumptions about the zig-cache directory.

In short, these are not unit tests; these should be standalone tests
instead.

Reverts e5d4a694ea7dd251e10d6434c9321b5e0a548d4b
Reverts d976456ef665bf0aba3a83a8e7fccb4a92b2d3b2
Reverts dbbda0f41a7c5e214801925f8447a15193c3c731
Closes #11542
2022-05-26 16:22:47 -07:00
Andrew Kelley
ba426f0a54
Merge pull request #10197 from vrischmann/io_uring-provide_buffers
io_uring: implement automatic buffer selection
2022-05-26 18:39:17 -04:00
Jakub Konka
326b2aa27b
Merge pull request #11729 from ziglang/fix-test-harness
test: correctly track identical error msgs in handled errors list
2022-05-26 21:00:40 +02:00
joachimschmidt557
7deae07101 std.PriorityQueue: fix missing siftUp in remove
When the replacement node is smaller than its parent, we need to sift
up instead of sifting down.
2022-05-26 14:50:24 -04:00
Jakub Konka
5ce9c878cf apply Vexu's suggestion to use failing_allocator for now 2022-05-26 16:55:31 +02:00
Jakub Konka
d1e4600675 test: correctly track identical error msgs in handled errors list
Prior to this change, for an example compiler error test case with
multiple identical errors messages such as

```
:1:2: error: foo
:1:2: error: foo
```

the test harness would never increment the error index thus only
marking the very first error message as handled yielding a false
positive.

Additionally, while here, regress `dereference_anyopaque` test case
as not passing on `wasm32-wasi` target.
2022-05-26 16:23:56 +02:00
Frank Denis
b08d32ceb5 crypto/25519: add scalar.random(), use CompressedScalar type
Add the ability to generate a random, canonical curve25519 scalar,
like we do for p256.

Also leverage the existing CompressedScalar type to represent these
scalars.
2022-05-26 13:30:03 +02:00
Jakub Konka
01607b54fc
Merge pull request #11722 from ziglang/stage2-behavior
stage2: enhance array concatenation and multiplication
2022-05-26 13:28:30 +02:00
Jakub Konka
90f12a9186
Merge pull request #11723 from koachan/sparc64-codegen
stage2: sparc64: Small refactorings and stack pointer accounting fixes
2022-05-26 12:06:11 +02:00
Jakub Konka
0e0b00fd48 regalloc: use StaticBitSet internally 2022-05-26 12:05:51 +02:00
Koakuma
c5b99267c0 stage2: sparc64: Remove saved_regs_stack_space calculation
SPARC does not have an explicit notion of saving/restoring registers.
The usual windowing mechanism (save/restore/return) already takes care of that
for us.
2022-05-26 13:48:39 +07:00
Koakuma
3923722cc6 stage2: sparc64: Account for stack bias & reserved area in genSetReg
genSetReg with ptr_stack_offset should add the bias and reserved area
before emitting the instruction.
2022-05-26 13:48:29 +07:00
Koakuma
5fa971610e stage2: sparc64: Change binOpImmediate immediates to u12
Sync with the check in binOp.
2022-05-26 13:09:56 +07:00
Koakuma
0310d88d7e stage2: sparc64: Add cmp and mov synthetic instructions 2022-05-26 13:08:39 +07:00
Andrew Kelley
83f69af971 stage2: implement runtime array multiplication
Additionally:

 * Sema: fix array cat/mul not setting the sentinel value
   - This required an LLVM backend enhancement to the handling of the
     AIR instruction aggregate_init that likely needs to be
     propagated to the other backends.
 * Sema: report integer overflow of array concatenation in a proper
   compile error instead of crashing.
 * Sema: fix not using proper pointer address space for array cat/mul
2022-05-25 22:33:48 -07:00
Andrew Kelley
b82081e709 Sema: implement array concatenation with runtime operands 2022-05-25 22:33:48 -07:00
Andrew Kelley
ab88165326 Sema: generic function instantiations inherit branch quota 2022-05-25 23:32:52 -04:00
Andrew Kelley
1dd7109476
Merge pull request #11716 from Vexu/stage2
Stage2 misc fixes
2022-05-25 22:30:08 -04:00
Jakub Konka
97816e3cb8 aarch64: check lo/cc flag for unsigned sub_with_overflow
With this change, we are now correctly lowering `sub_with_overflow`
for signed and unsigned integers of register-sized integers (32-
or 64-bit precisely). We also match LLVM's behavior and so, the
condition flags we now set are:

* unsigned:
  - `add_with_overflow`: `hs`/`cs` (carry set)
  - `sub_with_overflow`: `lo`/`cc` (carry clear)
* signed:
  - `add_with_overflow`/`sub_with_overflow`: `vs` (overflow)
2022-05-25 23:43:45 +02:00
Veikka Tuominen
f409d925ad Sema: check for generic poison in resolveInst 2022-05-25 23:11:13 +03:00
Jakub Konka
39ebfedd2b
Merge pull request #11715 from ziglang/stage2-x64-cond-codes 2022-05-25 20:33:43 +02:00
Helio Machado
e0be22b6c0
std.crypto: cosmetic improvement to AES multiplication algorithm (#11616)
std.crypto: cosmetic improvement to AES multiplication algorithm (#11616)
2022-05-25 19:23:49 +02:00
Veikka Tuominen
eba66f4a58 Sema: handle block.is_typeof in more places 2022-05-25 19:57:44 +03:00
Veikka Tuominen
d214b6bdf0 stage2: packed struct fields do not have a byte offset 2022-05-25 19:57:38 +03:00
Jakub Konka
7000395a7d x64: use new condition codes enum for register with overflow mcv 2022-05-25 17:18:43 +02:00
Jakub Konka
5fb7070642 x64: move from compare_flags_* mcv to eflags with condition codes enum 2022-05-25 17:06:47 +02:00
Veikka Tuominen
b0e8bf15f5 Sema: add error for dereferencing comptime value at runtime 2022-05-25 17:39:55 +03:00
Vincent Rischmann
3c58d3e281 io_uring: replace the readv method with a read on a new ReadBuffer type
readv() is essentially identical to read() except for the buffer type,
this simplifies the API for the caller at the cost of not clearly mapping to the liburing C API.
2022-05-25 13:53:09 +02:00
Vincent Rischmann
acb8af468f io_uring: add tests for automatic buffer selection 2022-05-25 13:53:09 +02:00
Vincent Rischmann
d8798ef0cd io_uring: use the socket test harness 2022-05-25 13:53:09 +02:00
Vincent Rischmann
456716b30d io_uring: add a test harness for server/client TCP socket tests 2022-05-25 13:53:09 +02:00
Vincent Rischmann
270a5039d4 io_uring: change recv() to use a RecvBuffer instead
RecvBuffer is equivalent to ReadBuffer but tailored for recv only.
2022-05-25 13:53:09 +02:00
Vincent Rischmann
52dd468cc3 io_uring: change read() to use a ReadBuffer instead
Reads can be done in two ways with io_uring:
* using a simple buffer
* using a automatic buffer selection which requires the user to have
provided a number of buffers before

ReadBuffer let's the caller choose where the data should be read.
2022-05-25 13:53:09 +02:00
Vincent Rischmann
7b3e5ce0b3 io_uring: add provide_buffers and remove_buffers
These functions are needed to implement automatic buffer selection.

This maps to the IORING_OP_PROVIDE_BUFFERS and IORING_OP_PROVIDE_BUFFERS ops.
2022-05-25 13:53:09 +02:00
Andrew Kelley
71e2a56e3e mark some more behavior tests as passing 2022-05-25 00:12:56 -07:00
Andrew Kelley
8373520785
Merge pull request #11699 from ziglang/empty-error-sets
stage2: fixes for error union semantics
2022-05-25 03:12:34 -04:00
Francesco Alemanno
a0775fdaa1 Add std.rand.RomuTrio
Co-authored-by: ominitay <37453713+ominitay@users.noreply.github.com>
2022-05-24 22:48:51 -04:00
Andrew Kelley
60af42705d mark two behavior tests as passing 2022-05-24 18:21:34 -07:00
Andrew Kelley
a4ff94804c Sema: additional check for one-possible-value types in analyzeLoad
This is needed because pointers to zero-bit types are not necessarily
comptime known, but when doing a load, only the element type having one
possible value is relevant.
2022-05-24 18:20:03 -07:00
Andrew Kelley
1f16b07d6f stage2: treat error{}!void as a zero-bit type 2022-05-24 17:53:04 -07:00
Andrew Kelley
c711c788f0 stage2: fixes for error unions, optionals, errors
* `?E` where E is an error set with only one field now lowers the same
   as `bool`.
 * Fix implementation of errUnionErrOffset and errUnionPayloadOffset to
   properly compute the offset of each field. Also name them the same
   as the corresponding LLVM functions and have the same function
   signature, to avoid confusion. This fixes a bug where wasm was
   passing the error union type instead of the payload type.
 * Fix C backend handling of optionals with zero-bit payload types.
 * C backend: separate out airOptionalPayload and airOptionalPayloadPtr
   which reduces branching and cleans up control flow.
 * Make Type.isNoReturn return true for error sets with no fields.
 * Make `?error{}` have only one possible value (null).
2022-05-24 15:34:52 -07:00
joachimschmidt557
c847a462ae stage2 ARM: update to new union layout 2022-05-24 15:34:52 -07:00
Jakub Konka
26376c9fda wasm: use errUnionPayloadOffset and errUnionErrOffset from codegen.zig 2022-05-24 15:34:52 -07:00
Jakub Konka
8c49420928 aarch64: update for new error union layout 2022-05-24 15:34:52 -07:00
Jakub Konka
c043d57cab x64,arm,aarch64: omit unsupported tests for now 2022-05-24 15:34:52 -07:00
Jakub Konka
41f517e5f5 x64: update for new error union layout 2022-05-24 15:34:52 -07:00
Jakub Konka
b42100c70f dwarf: update abbrev info generation for new error union layout 2022-05-24 15:34:52 -07:00