24806 Commits

Author SHA1 Message Date
Robin Voetter
74f40ddd11
spirv: enable simplified default panic handler
SPIR-V cannot print, so we cannot yet use the fancy default
panic handler. Instead we will just use the infinite loop
one for now.
2023-07-01 14:27:57 +02:00
Robin Voetter
8eee392862
spirv: fix up todos & errors from intern pool changes
This replaces the implementation of constant() which one that
is directly based on the intern pool rather than the Zig type tag
too.
2023-07-01 14:27:12 +02:00
Evan Haas
0a6cd257b9 translate-c: Use @constCast and @volatileCast to remove CV-qualifiers
Instead of converting a pointer to an int and then back to a pointer.
2023-06-29 23:36:56 +03:00
Michael Dusan
614bc6755e openbsd: add root certificate scanning
patch by @bilaliscarioth, thank you!

closes #16168
2023-06-29 10:29:28 -07:00
Jacob Young
43c98dc115 Revert "Merge pull request #15995 from mlugg/fix/union-field-ptr-align"
This reverts commit 40cf3f7ae5fbfb84b7af6b27e6296ee858b209ef, reversing
changes made to d98147414d084bc41b00ba9c0be8c7b82ad4e76c.
2023-06-29 00:23:19 -04:00
Jacob Young
1a2468abfc Revert "Sema: preserve extern struct field alignment"
This reverts commit 4620972d086ebb3b7686a79914876488c6dfd171.
2023-06-29 00:23:19 -04:00
Evan Haas
77dcd903a0 langref: Add c_char to the list of primitive types 2023-06-28 17:35:22 -07:00
Lauri Tirkkonen
82520a214c std.crypto.hash.sha2: require avx2 on x86_64
according to
https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=vpalignr&ig_expand=283,283,284,283,283&techs=AVX_ALL
the vpalignr instruction requires AVX2 support
2023-06-28 17:33:02 -07:00
Krzysztof Wolicki
0c1bfe271e autodoc: Correct a comment about types from std.builtin 2023-06-28 19:03:24 +02:00
Krzysztof Wolicki
2984a75804 autodoc: Try to handle all InternPool.Index types good enough 2023-06-28 19:03:24 +02:00
Ian Johnson
4dacaa1e12 Autodoc: add preference for / search
Closes #16081
2023-06-28 18:16:16 +02:00
Bertie Wheen
7166407d8f langref: correct ordering of @xFromY builtins 2023-06-28 17:38:41 +03:00
Alex Kladov
4620972d08 Sema: preserve extern struct field alignment
In

    extern struct { x: u32, y: u16 }

we actually know that y's alignment is `@alignOf(u32)`, and not just
`@alignOf(u16)`.

closes: #16134
2023-06-28 16:36:32 +02:00
zooster
28f515acd7 behavior: test slicing array of zero-sized values
Closes #15343
2023-06-28 14:00:18 +03:00
Motiejus Jakštys
910ad92e0e ld: support -version-script
gettext uses this version and, surely enough, it is supported by lld
2023-06-28 09:32:10 +02:00
Krzysztof Wolicki
5804f3f757 autodoc: walkResultTypeRef returns Zig's undefined instead of 0th type 2023-06-27 19:07:39 +02:00
Krzysztof Wolicki
7f648c297e autodoc: Added u0, i0 to correctly indexed types 2023-06-27 19:07:39 +02:00
Luuk de Gram
622c5f3200
Merge pull request #16207 from Luukdegram/wasi-threads
WASI: Implement experimental threading support
2023-06-27 18:28:26 +02:00
mlugg
ff37ccd298 Air: store interned values in Air.Inst.Ref
Previously, interned values were represented as AIR instructions using
the `interned` tag. Now, the AIR ref directly encodes the InternPool
index. The encoding works as follows:
* If the ref matches one of the static values, it corresponds to the same InternPool index.
* Otherwise, if the MSB is 0, the ref corresponds to an InternPool index.
* Otherwise, if the MSB is 1, the ref corresponds to an AIR instruction index (after removing the MSB).

Note that since most static InternPool indices are low values (the
exceptions being `.none` and `.var_args_param_type`), the first rule is
almost a nop.
2023-06-27 01:21:32 -07:00
yujiri8
dae516dbdf
improve documentation of std.sort.*Context functions (#16145) 2023-06-27 00:51:06 -07:00
Jacob Young
d881d841ed Sema: use tmp_hack_arena as a temporary solution for lifetime issues
All of this code is expected to get rewritten anyway.

Closes #16216
2023-06-27 00:46:31 -07:00
Andrew Kelley
d9e867172e
Merge pull request #16233 from jacobly0/tls
crypto.tls.Client: fix occasional crash in `readvAdvanced`
2023-06-27 00:45:49 -07:00
Jacob Young
9343c31c38 Sema: fix @min/@max type resolution with all runtime args
Closes #16229
2023-06-26 18:46:25 -07:00
Jacob Young
8239d3b358 crypto: recoup storage in tls.Client.partially_read_buffer 2023-06-26 21:05:08 -04:00
Jacob Young
eb8881a538 crypto: cleanup unneeded uses of @as in tls.Client 2023-06-26 21:05:08 -04:00
Ali Chraghi
6bd5479306 std.sort.block: add safety check for lessThan return value 2023-06-26 17:50:10 -07:00
mlugg
88284c124a AstGen: fix result locations for elements of typed array init
Resolves: #16226
2023-06-26 16:20:33 -07:00
Ian Johnson
bbda053f9e Build: make InstallDirStep use a FileSource
Closes #16187
2023-06-26 15:59:53 -07:00
Luuk de Gram
87b8a0567b
default to single-threaded for WebAssembly
When targeting WebAssembly, we default to building a single-threaded build
as threads are still experimental. The user however can enable a multi-
threaded build by specifying '-fno-single-threaded'. It's a compile-error
to enable this flag, but not also enable shared-memory.
2023-06-26 20:00:58 +02:00
Luuk de Gram
e06ab1b010
std: implement detach for WASI-threads
When a thread is detached from the main thread, we automatically
cleanup any allocated memory. For this we first reset the stack-pointer
to the original stack-pointer of the main-thread so we can safely clear
the memory which also contains the thread's stack.
2023-06-26 20:00:58 +02:00
Luuk de Gram
622b7c4746
free allocated memory upon call join
When `join` detects a thread has completed, it will free the allocated
memory of the thread. For this we must first copy the allocator. This is
required as the allocated memory holds a reference to the original
allocator. If we free the memory, we would end up with UB as the
allocator would free itself.
2023-06-26 20:00:57 +02:00
Luuk de Gram
834609038c
std: implement join for WASI-threads
We now reset the Thread ID to 0 and wake up the main thread listening
for the thread to finish. We use inline assembly as we cannot use
the stack to set the thread ID as it could possibly clobber any
of the memory.

Currently, we leak the memory that was allocated for the thread.
We need to implement a way where we can clean up the memory without
using the stack (as the stack is stored inside this same memory).
2023-06-26 20:00:57 +02:00
Luuk de Gram
10bf58b2db
store allocator & remove global assembly
We now store the original allocator that was used to allocate the
memory required for the thread. This allocator can then be used
in any cleanup functionality to ensure the memory is freed correctly.

Secondly, we now use a function to set the stack pointer instead of
generating a function using global assembly. This is a lot cleaner
and more readable.
2023-06-26 20:00:57 +02:00
Luuk de Gram
a97dbdfa0b
std: implement Thread spawn for WASI
This implements a first version to spawn a WASI-thread. For a new thread
to be created, we calculate the size required to store TLS, the new stack,
and metadata. This size is then allocated using a user-provided allocator.

After a new thread is spawn, the HOST will call into our bootstrap procedure.
This bootstrap procedure will then initialize the TLS segment and set the
newly spawned thread's TID. It will also set the stack pointer to the newly
created stack to ensure we do not clobber the main thread's stack.

When bootstrapping the thread is completed, we will call the user's
function on this new thread.
2023-06-26 20:00:57 +02:00
Luuk de Gram
ea0d4c8377
std: implement Futex for WebAssembly
Implements std's `Futex` for the WebAssembly target using Wasm's
`atomics` instruction set. When the `atomics` cpu feature is disabled
we emit a compile-error.
2023-06-26 20:00:57 +02:00
Luuk de Gram
062eb6f3c0
Compilation: allow threads for Wasm when shared-memory is enabled
When the user enabled the linker-feature 'shared-memory' we do not force
a singlethreaded build. The linker already verifies all other CPU features
required for threads are enabled. This is true for both WASI and
freestanding.
2023-06-26 20:00:57 +02:00
Luuk de Gram
3819371163
wasm-ld: implement --export-memory flag
This flag allows the user to force export the memory to the host
environment. This is useful when the memory is imported from the
host but must also be exported. This is (currently) required
to pass the memory validation for runtimes when using threads.
In this future this may become an error instead.
2023-06-26 20:00:57 +02:00
Meghan Denny
7322aa1183 std.Uri: allow getting the mutable result from (un)escape 2023-06-26 15:46:04 +03:00
Jan200101
42ca357604 std.Build: omit newline from last line 2023-06-26 04:25:14 -07:00
Jobat
d5ebe3e395 Change capacity to take a non-pointer parameter
I don't believe there's a requirement for this to take a pointer, as the underlying function doesn't.
2023-06-26 02:05:28 -07:00
Jacob Young
c036f83fa0 Value: fix incorrect types returned from readFromMemory 2023-06-26 01:30:00 -07:00
jacobly0
cc2daae47e
Merge pull request #15771 from jacobly0/x86_64-behavior
x86_64: behavior
2023-06-26 02:45:48 -04:00
Roman Frołow
dce1999c80 is has -> has 2023-06-25 23:30:25 -07:00
Andrew Kelley
40cf3f7ae5
Merge pull request #15995 from mlugg/fix/union-field-ptr-align
Sema: copy pointer alignment to union field pointers
2023-06-25 23:06:53 -07:00
Jacob Young
85902115d4 x86_64: cleanup @as invasion 2023-06-25 19:14:26 -04:00
Jacob Young
7013567f8a x86_64: disable failing behavior test 2023-06-25 19:14:03 -04:00
Jacob Young
1a1930ec9b x86_64: fix test failure 2023-06-25 19:14:03 -04:00
Jacob Young
0e15b6e973 x86_64: fix incorrect encoding table entries
This was found by downstream tests.
2023-06-25 19:14:03 -04:00
Jacob Young
b4b1ad475b x86_64: truncate packed field value 2023-06-25 19:14:03 -04:00
Jacob Young
3f13987a76 x86_64: add missing padding to global unions 2023-06-25 19:14:03 -04:00