23141 Commits

Author SHA1 Message Date
John Schmidt
ec445fb6b8 Improve error messages for break type coercion 2023-03-21 15:09:42 +02:00
r00ster91
8642770eff langref: add missing return types to builtin functions
This should add all remaining missing return types to all builtin
functions.
For @clz, @ctz, and @popCount it uses anytype for the lack of a better
alternative. We already use this return type for other builtin functions in the langref
to indicate that the type is not always the same.
It is not possible to use anytype as the return type for regular
functions but builtin functions are special.
2023-03-21 15:05:57 +02:00
mlugg
f9b5829508 Sema: implement @export for arbitrary values 2023-03-21 15:04:39 +02:00
Veikka Tuominen
5e161c102d
Merge pull request #14841 from squeek502/is-cygwin-pty-stuff
`os.isCygwinPty`: Fix a bug, replace kernel32 call, and optimize
2023-03-21 15:03:33 +02:00
Marcus Ramse
1e087d3a64 std.json: support tuples 2023-03-21 15:01:45 +02:00
Veikka Tuominen
cd3575b0f0
Merge pull request #14848 from r00ster91/json
std.json: fix 2 TODOs
2023-03-21 15:00:47 +02:00
Xavier Bouchoux
898e4473e8 CBE: implement aggregateInit() for array of array case.
fixes `error(compilation): clang failed with stderr: error: array type 'uint32_t[10]' (aka 'unsigned int[10]') is not assignable`
2023-03-21 14:56:04 +02:00
Veikka Tuominen
f7204c7f37
Merge pull request #15028 from Vexu/compile-errors
Sema: improve error message of field access of wrapped type
2023-03-21 14:55:36 +02:00
Jakub Konka
515e1c93e1
Merge pull request #14993 from jacobly0/x86_64
x86_64: implement more operations
2023-03-21 11:16:29 +01:00
Jacob Young
c58b5732f3 x86_64: implement @byteSwap and @bitReverse 2023-03-21 08:49:54 +01:00
Jacob Young
f316cb29cc x86_64: implement atomic and fence ops 2023-03-21 08:49:54 +01:00
Jacob Young
3f4569bf18 codegen: fix backend breakage due to optional layout change 2023-03-21 08:49:54 +01:00
Jacob Young
6c453dd806 x86_64: implement some slice ops 2023-03-21 08:49:54 +01:00
Jacob Young
958c8e1ce9 x86_64: implement @popCount for older processors
This fixes the behavior tests when compiled for baseline.
2023-03-21 08:49:54 +01:00
Jacob Young
f95faac5ae x86_64: (re)implement optional ops
Note that this commit also changes the layout of optional for all
other backends using `src/codegen.zig` without updating them!
2023-03-21 08:49:54 +01:00
Jacob Young
24f0900ecb x86_64: implement some error union ops 2023-03-21 08:49:54 +01:00
Jacob Young
bbd05e2d97 x86_64: improve codegen for neg and not 2023-03-21 08:49:54 +01:00
Jacob Young
80427796df x86_64: implement @returnAddress and @frameAddress 2023-03-21 08:49:54 +01:00
Jacob Young
53ec2a955e x86_64: implement clz, ctz, and popCount 2023-03-21 08:49:54 +01:00
Jacob Young
edd63f9aba x86_64: reimplement inline memcpy and memset 2023-03-21 08:49:54 +01:00
Jacob Young
c865c8fb2a x86_64: implement float division intrinsics 2023-03-21 08:49:54 +01:00
Jacob Young
b6eebb709f x86_64: fix OBO
These loops were skipping over the top stack entry, and there's already
a function that does this correctly.
2023-03-21 08:49:54 +01:00
Jacob Young
30e1daa746 x86_64: implement basic float ops 2023-03-21 08:49:54 +01:00
Jacob Young
29e6aedc95 x86_64: implement min and max as commutative binary ops 2023-03-21 08:49:54 +01:00
Frank Denis
dff4bbfd24
Remove Gimli and Xoodoo from the standard library (#14928)
These are great permutations, and there's nothing wrong with them
from a practical security perspective.

However, both were competing in the NIST lightweight crypto
competition.

Gimli didn't pass the 3rd selection round, and is not much used
in the wild besides Zig and libhydrogen. It will never be
standardized and is unlikely to get more traction in the future.

Xoodyak, that Xoodoo is the permutation of, was a finalist.

It has a lot of advantages and *might* be standardized without NIST.
But this is too early to tell, and too risky to commit to it
in a standard library.

For lightweight crypto, Ascon is the one that we know NIST will
standardize and that we can safely rely on from a usage perspective.

Switch to a traditional ChaCha-based CSPRNG, with an Ascon-based one
as an option for constrained systems.

Add a RNG benchmark by the way.

Gimli and Xoodoo served us well. Their code will be maintained,
but outside the standard library.
2023-03-21 04:54:10 +00:00
Veikka Tuominen
e70a0b2a6b Value: implement reinterpreting enum field index as integer
Closes #15019
2023-03-21 03:31:03 +02:00
Jacob Young
bc0f246911 tests: add -Dskip-cross-glibc option
It is reasonable to pass -Dskip-non-native when unable to run foreign
binaries, however there is no option for being able to run foreign
static binaries but unable to run foreign dynamic binaries.  This can
occur when qemu is installed but not cross glibc.
2023-03-20 21:00:06 -04:00
mlugg
3a25f6a22e Port some stage1 test cases to stage2
There are now very few stage1 cases remaining:
* `cases/compile_errors/stage1/obj/*` currently don't work correctly on
  stage2. There are 6 of these, and most of them are probably fairly
  simple to fix.
* `cases/compile_errors/async/*` and all remaining `safety/*` depend on
  async; see #6025.

Resolves: #14849
2023-03-20 19:55:50 -04:00
Veikka Tuominen
82133cd992 Sema: improve error message of field access of wrapped type
Closes #15027
2023-03-21 00:34:12 +02:00
Veikka Tuominen
9d9815fb9c Value: handle comparisons of runtime_values
Closes #15004
2023-03-21 00:34:12 +02:00
Veikka Tuominen
773b1c4c5c llvm: fix lowering packed union initiated to zero-bit value
Closes #14980
2023-03-21 00:34:12 +02:00
Andrew Kelley
626a75bbc2 std.Build.RunStep: fix control flow with qemu+glibc logic 2023-03-20 17:14:48 -04:00
KOUNOIKE Yuusuke
5df31f3ef3
add wasm-simd support for suggestVectorSizeForCpu (#14992) 2023-03-20 17:45:12 +01:00
Veikka Tuominen
0c16912733 std: improve error for formatting a function body type
Closes #14915
2023-03-20 17:29:43 +02:00
Reuben Dunnington
30427ff794
Fix GetFileInformationByHandle compile error (#14829)
* Fix GetFileInformationByHandle compile error

The wrapper function was mistakenly referencing ntdll.zig when the actual function is declared in kernel32.zig.

* delete GetFileInformationByHandle since it's not used by the stdlib
2023-03-19 23:23:05 +00:00
Jakub Konka
9a203fa789
Merge pull request #14986 from ziglang/macos-hcs
Upstream macOS hot-code swapping PoC
2023-03-19 21:22:40 +01:00
Ganesan Rajagopal
30aeb41a19 Fix linker segfault adding rpath to sharedlib
If the shared library is a relative path, dirname will return null causing a segfault. In the case I debugged, the current directory was already in RPATH so just ignoring this case seems a reasonable fix. After this fix "make" and "make test" pass for mimalloc.

Closes #13766
2023-03-19 17:42:27 +01:00
Ryan Liptak
2fce991d2a Remove std.os.windows.QueryInformationFile (a wrapper of NtQueryInformationFile)
This function is unused, and the current implementation contains a few footguns:

- The current wrapper treats all possible errors as unexpected, even likely ones like BUFFER_OVERFLOW (which is returned if the size of the out_buffer is too small to contain all the variable-length members of the requested info, which the user may not actually care about)
- Each caller may need to handle errors differently, different errors might be possible depending on the FILE_INFORMATION_CLASS, etc, and making a wrapper that handles all of those different use-cases nicely seems like it'd be more trouble than it's worth (FILE_INFORMATION_CLASS has 76 different possible values)

If a wrapper for NtQueryInformationFile is wanted, then it should probably have wrapper functions per-use-case, like how QueryObjectName wraps NtQueryObject for the `ObjectNameInformation` class
2023-03-19 17:33:25 +01:00
Jakub Konka
6874b29308 macho: fix 32bit build 2023-03-19 17:13:38 +01:00
Luuk de Gram
c26cbd561c
Merge pull request #14998 from Luukdegram/shared-mem
wasm-linker: Implement shared-memory
2023-03-19 15:43:06 +01:00
Luuk de Gram
322ace70f9
Merge pull request #14838 from Luukdegram/bss-fix
wasm-linker: fix storing atoms in the correct segment
2023-03-19 15:42:39 +01:00
Jakub Konka
f026939a40 macho: enable hot update state only when on compatible host 2023-03-19 09:45:05 +01:00
Andrew Kelley
8f481dfc3c fix std.Build.OptionsStep
* use the same hash function as the rest of the steps
 * fix race condition due to a macOS oddity.
 * fix race condition due to file truncation (rename into place instead)
 * integrate with marking Step.result_cached. check if the file already
   exists with fs.access before doing anything else.
 * use a directory so that the file basename can be "options.zig"
   instead of a hash digest.
 * better error reporting in case of file system failures.
2023-03-19 00:39:29 -04:00
Jakub Konka
6f15eedff1 darwin: put posix spawn constants in POSIX_SPAWN struct 2023-03-18 21:54:05 +01:00
Jakub Konka
0aab3bda12 macho: add wrappers for attaching/detaching from HCS process 2023-03-18 21:53:46 +01:00
Jakub Konka
37192bcdcb macos: HCS PoC working 2023-03-18 21:53:36 +01:00
Jakub Konka
f1e25cf43e macho: add hot-code swapping poc 2023-03-18 21:53:26 +01:00
Jakub Konka
266c81322e darwin: resurrect posix_spawn wrappers 2023-03-18 21:53:15 +01:00
Jakub Konka
e35c8a2fd6 link: use std.os.ptrace wrapper on linux 2023-03-18 21:52:52 +01:00
Jakub Konka
a23ef3783b os.zig: expose ptrace wrapper for darwin and linux 2023-03-18 21:52:40 +01:00