7552 Commits

Author SHA1 Message Date
Nameless
b9fc0d2908
std.http: fix leaked connections (#16341)
The early return in pool release was causing leaked connections.
Closes #16282.
2023-07-07 20:08:19 +00:00
xdBronch
80404cc928 implement std.time.sleep for uefi 2023-07-07 11:57:09 -07:00
dec05eba
2e424e019f Client.zig: support rsa_pss_rsae_sha384 and rsa_pss_rsae_sha512
This fixes HTTP GET to https://www.iana.org/domains/reserved
for example
2023-07-06 18:36:15 -07:00
Jakub Konka
44df3a148b std: add prefixed versions of addFileSource and addDirectorySource to Step.Run 2023-07-06 17:03:28 -07:00
IntegratedQuantum
49ac816e36
Optimize Allocator functions to create less duplicate code for similar types (#16332)
* Move functionality from generic functions that doesn't depend on the type into a function that only depends on comptime alignment.

This reduces comptime code duplication because e.g. `alloc(u32, )` and `alloc(i32, )` now use the same function `allocWithFoo(4, 4, )` under the hood.
2023-07-06 14:41:49 -04:00
Jacob Young
78eb3c5617 bootstrap: support aarch64 in 32-bit mode
* `CMakeLists.txt`: support the weird `uname -m` output.
 * `CMakeLists.txt`: detect and use the C compiler's default arm mode.
 * cbe: support gcc with both `f128` and `u128` emulated.
 * std.os.linux.thumb: fix incorrectly passed asm inputs.
2023-07-04 15:47:07 -07:00
Andrew Kelley
8ae92fd17e std.Build.Step.Compile: fix clearing logic for empty cflags
Commit c0b774fbc65e3e406a38d37b02fffda7c5d3df26 originally added this
logic but it did not properly clear the C command line flags to empty
when a previous positional argument had command line flags, because it
never set the "previous" flag to true.

This fixes C compiler flags not being reset to empty when using the
build system and a second positional argument has no arguments after a
first positional argument has arguments.

Thanks to @squeek502 for finding this.
2023-07-04 10:53:35 -07:00
Evin Yulo
ba6e5e65a0 json: give enums a default stringify implementation 2023-07-03 20:33:36 -07:00
yujiri8
b26fa4ec4b
add docstring to std.json.stringify (#16241) 2023-07-03 19:26:11 -04:00
Andrew Kelley
17890f6b8a
Merge pull request #15879 from r00ster91/more_stage1_test_coverage
More stage1 test coverage
2023-07-03 15:59:54 -07:00
xdBronch
0dffab7356 check for UEFI in io.StreamSource 2023-07-03 11:00:54 -07:00
r00ster91
2b8687ba2d std.math.big.int: better name for equal function
All of the std except these few functions call it "eql" instead of "eq".
This has previously tripped me up when I expected the equality check function to be called "eql"
(just like all the rest of the std) instead of "eq".

The motivation is consistency.

If search "eq" on Autodoc, these functions stick out and it looks inconsistent.

I just noticed there are also a few functions spelling it out as "equal" (such as std.mem.allEqual).
Maybe those functions should also spell it "eql" but that can be done in a future PR.
2023-07-03 11:00:13 -07:00
John Simon
cb5a6be41a
Smaller memory footprint for BoundedArray (#16299)
Store BoundedArray's length using the smallest possible integer

Co-authored-by: zooster <r00ster91@proton.me>
2023-07-03 13:58:03 -04:00
Philipp Lühmann
de227ace14 std: fix doc comment of GPA deinit
This was missed in #15269
2023-07-03 01:14:20 -07:00
Michael Dusan
fc9ab5f0e8 tls certificates: support more BSDs
- add support for freebsd, netbsd, dragonfly
- refactor rescanOpenBSD -> rescanBSD
- make os-specific rescan*() non-public

closes #16279
2023-07-02 19:24:37 -07:00
Ryan Liptak
689f3163af Fix TTY.detectConfig regression on windows
e05412669c8dde1230612de5af64fbc3fb0bc17e inadvertently changed the logic on Windows and made it so that supportsAnsiEscapeCodes was never checked. This fixes that regression while keeping the logic intact for other platforms.
2023-07-02 00:07:24 -07:00
David Carlier
9e0ac4449a std.c: fix haiku's find_path signature.
codePointer and subPath are not mandatory.

following up on 1084590
2023-07-01 22:20:21 -07:00
Andrew Kelley
afc5edabe0
Merge pull request #16287 from Snektron/amdgpu-panic-fix
Some amdgcn fixes
2023-07-01 22:04:06 -07:00
Andrew Kelley
309aacfc89
Merge pull request #16284 from Snektron/spirv-internpool-fixes
SPIR-V InternPool aftermath damage control
2023-07-01 14:21:04 -07:00
Robin Voetter
a1b583dc24
std: make panic and abort for amdhsa call trap 2023-07-01 21:23:45 +02:00
David CARLIER
8f14431bc8 std.c: msghdr* struct removing prefixes to match linux. 2023-07-01 11:14:39 -07:00
Robin Voetter
aa398034eb
testing: disable printing for targets that do not support it
The SPIR-V cannot print the helpful error messages from the
std.testing module. This commit overrides the default print
function used here to one that only prints if the target supports
it. For now, its only done for SPIR-V, but this function could
be adapted to more targets that need it.
2023-07-01 14:29:11 +02:00
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
Jacob Young
f571438fc0 Unrevert "Sema: preserve extern struct field alignment"
This unreverts commit 1a2468abfcd8b539193d943c1eefb71319cc7b88.
2023-06-30 23:24:52 -04:00
Jacob Young
2282c27885 Remerge pull request #15995 from mlugg/fix/union-field-ptr-align
Sema: copy pointer alignment to union field pointers

This is an unrevert of 43c98dc11567eeb38be041c7dad179c53156f3df.
2023-06-30 23:23:26 -04:00
mlugg
402b958e19 std.pdb: fix incorrect field alignment in ptrCast 2023-06-30 23:23:03 -04:00
Ryan Liptak
2eae013378 fs.path: Fix Windows path component comparison being ASCII-only
We can use eqlIgnoreCaseUtf8 to get Unicode-aware Windows-compliant case insensitive path component comparison
2023-06-30 15:29:43 -07:00
Ryan Liptak
cfcf9cd9b7 Add os.windows.nls.upcaseW, a cross-platform implementation of RtlUpcaseUnicodeChar
This allows doing Windows-style case insensitive comparisons from any target, but means that it will need to include its own copy of the uppercase data table (5,088 bytes) to do so.

When targeting Windows, the ntdll functions are used instead to avoid including a redundant copy of the uppercase data in the resulting binary.
2023-06-30 15:29:43 -07: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
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
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
r00ster91
2463f4df77 addrspace: small cleanups 2023-06-27 19:50:17 -04:00
r00ster91
40e002ae2b std.builtin.StackTrace: don't print extra newline after stack trace 2023-06-27 19:49:54 -04:00
r00ster91
11c32c756f fix u65529 and above overflowing in more places
See also #15537
2023-06-27 19:08:24 -04: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
yujiri8
dae516dbdf
improve documentation of std.sort.*Context functions (#16145) 2023-06-27 00:51:06 -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
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
Meghan Denny
7322aa1183 std.Uri: allow getting the mutable result from (un)escape 2023-06-26 15:46:04 +03:00