Commit Graph

6571 Commits

Author SHA1 Message Date
Jeroen van Rijn
795ceec2cd Merge pull request #5327 from nubunto/fix/pool-join-hangs
fix: pool_join hangs if no threads are started
2025-06-16 10:50:35 +02:00
Bruno Panuto
6874a4cdb0 fix: make pool_finish not hang when pool_start is not called 2025-06-16 00:28:43 -03:00
Laytan Laats
144daf6fff add macOS Tahoe to odin report and core:sys/info 2025-06-14 00:27:37 +02:00
Laytan
aa0cffb412 Merge pull request #5328 from laytan/compat-allocator-improvements
mem: compat allocator improvements
2025-06-13 19:41:58 +02:00
Jeroen van Rijn
84eaddbd47 WASI 2025-06-13 18:08:35 +02:00
Jeroen van Rijn
8c8406cc4d stub out get_env for js 2025-06-13 18:00:30 +02:00
Jeroen van Rijn
3862555153 Replace core:posix usage in core:os/os2 2025-06-13 17:49:05 +02:00
Jack Mordaunt
c1cd525d9d core/sync/chan.select_raw: call try_select_raw with deprecation warning
Eventually select_raw should be a blocking select operation, but for now
we need to migrate people away.
2025-06-12 16:14:52 -03:00
Jack Mordaunt
96b91849a9 core/sync/chan.try_select_raw: fix doc comment typo
Signed-off-by: Jack Mordaunt <jackmordaunt.dev@gmail.com>
2025-06-12 16:14:52 -03:00
Jack Mordaunt
faae81ba61 core/sync/chan.try_select_raw: test hook for testing the toctou
This is necessary because we need to allow the test guarantee against a
rare condition: where a third-party thread steals a value between the
validity checks can_{send,recv} and the channel operation
try_{send,recv}.
2025-06-12 16:14:52 -03:00
Jack Mordaunt
4043be8567 core/sync/chan.try_select_raw: skip nil input messages
This makes the proc easier and safer to call by letting the caller nil
out messages to skip sends.
2025-06-12 16:14:52 -03:00
Jack Mordaunt
fb39e5a2f8 core/sync/chan.try_select_raw: clarify loop control flow
Use a label to clarify the continue statements.
2025-06-12 16:14:52 -03:00
Jack Mordaunt
d5b7302ac0 core/sync.try_select_raw: fix TOCTOU
Fixes a TOCTOU where the channel could be used between the call to
can_{recv,send} and {recv,send} causing an unexpected blocking
operation.

To do this we use the non-blocking try_{recv,send} and retry the check
in a loop. This guarantees non-blocking select behaviour, at the cost of
spinning if the input channels are highly contended.

Signed-off-by: Jack Mordaunt <jackmordaunt.dev@gmail.com>
2025-06-12 16:14:52 -03:00
Jack Mordaunt
be873af003 core/sync.select_raw: rename to try_select_raw
This follows the convention where non-blocking operations are prefixed
with "try" to indicate as much.

Since select_raw in it's current form doesn't block, it should be
try_select_raw, and allow select_raw to name a blocking implementation.
2025-06-12 16:14:52 -03:00
Jack Mordaunt
7f9589922d core/sync.select_raw: return a useful index
This fixes a flaw in the original implementation: the returned index is
actually useless to the caller.

This is because the index returned refers to the internal "candidate"
list. This list is dynamic, and may not have all of the input channels
(if they weren't ready according to chan.can_{recv,send}). That means
the index is not guaranteed to mean anything to the caller.

The fix introduced here is to return the index into the input slice
(recvs,sends) and an enum to specify which input slice that is.

If no selection was made, then (-1, .None) is returned to communicate as
much.

Signed-off-by: Jack Mordaunt <jackmordaunt.dev@gmail.com>
2025-06-12 16:14:51 -03:00
Laytan Laats
67a8b035db mem: compat allocator improvements
1. store alignment instead of original pointer
2. implement .Query_Info
3. poison the header and alignment portion of the allocation
4. .Resize uses `max(orig_alignment, new_alignment)` as it's alignment
   now
5. .Free passes along the original alignment
2025-06-12 20:40:22 +02:00
Laytan Laats
0ed6cdc98e mem/tlsf: fix asan reporting poisoning of already poisoned region
free on tlsf poisons the entire block, while alloc might only unpoison a
part of it (cause it's size is aligned up). This causes free to
potentially poison an already poisoned portion, which is a
use-after-poison.

Because this is "fine" and intended, I opted to just
@no_sanitize_address it.
2025-06-12 19:37:24 +02:00
Jeroen van Rijn
74f70bfbcb Comment 2025-06-12 17:09:33 +02:00
Jeroen van Rijn
298bab99a4 Merge pull request #5326 from Kelimion/fix-5321
Revert changes to thread_unix.odin
2025-06-12 16:56:29 +02:00
Jeroen van Rijn
5aa377e64e Revert changes to thread_unix.odin 2025-06-12 16:36:40 +02:00
Jeroen van Rijn
b119ca0261 Merge pull request #5325 from Kelimion/fix-5321
Fix #5321
2025-06-12 16:14:01 +02:00
Jeroen van Rijn
59ba37f232 Remove transmute 2025-06-12 16:05:34 +02:00
Jeroen van Rijn
994b5a2a6c Remove c import 2025-06-12 16:01:31 +02:00
Jeroen van Rijn
caf41aa046 Fix #5321 2025-06-12 16:00:24 +02:00
Jeroen van Rijn
eb1b5f7d3a Merge pull request #5322 from Kelimion/fix-5321
Fix #5321 (on Windows)
2025-06-12 11:52:38 +02:00
Jeroen van Rijn
ac5f3746cf Fix #5321 2025-06-12 11:30:36 +02:00
Jeroen van Rijn
50ff3fabdc Merge pull request #5317 from Feoramund/fixup-container-queue
Tidy up `core:container/queue`
2025-06-12 00:00:34 +02:00
Feoramund
23c1ce8722 container/queue: Remove trailing whitespace 2025-06-11 11:57:38 -04:00
Feoramund
638a1529a3 container/queue: Add shrink 2025-06-11 11:55:30 -04:00
Feoramund
040d79e1b9 container/queue: Let queues be re-initialized with different allocators 2025-06-11 11:55:30 -04:00
Feoramund
81f5763482 container/queue: Add common aliases enqueue and dequeue 2025-06-11 11:55:30 -04:00
Feoramund
6cb84e467b container/queue: Document the package 2025-06-11 11:55:30 -04:00
Feoramund
862442511a container/queue: Reorganize 2025-06-11 11:55:29 -04:00
Feoramund
58bda1209a container/queue: Deprecate peek_*
The `*_ptr` and `peek_*` procedures did the same thing, except `peek_*`
was over-cautiously putting the index through a modulo when all
assignments to `q.offset` are already wrapped.
2025-06-11 11:54:52 -04:00
Feoramund
27cd508571 container/queue: Fix and add more bounds checking 2025-06-11 11:54:47 -04:00
gingerBill
4aec582a05 Add system:dl to foreign import for dlfcn.odin 2025-06-11 15:27:00 +01:00
Jeroen van Rijn
9dafd77bc0 Turn core:math/bìg tests into regular core:testing tests.
`core:math/big` has been verified against Python's big integer implementation long enough.
Turn it into a regular regression test using the `core:testing` framework, testing against
a generated corpus of test vectors.
2025-06-11 00:40:52 +02:00
Jeroen van Rijn
4f4839ecc5 Add initial tests for big rationals 2025-06-10 16:46:12 +02:00
Feoramund
4236b043e2 Move negation in internal_rat_to_float to end of procedure
This should cause a compiler error, due to the assignment to a named
return value in a deferred block.

Fixes #4565
2025-06-10 08:34:07 -04:00
Jeroen van Rijn
d08e14fc3c Merge pull request #5304 from Feoramund/clarify-flags-variadic
Clarify `core:flags` variadic behaviors
2025-06-09 19:08:53 +02:00
Feoramund
6dee422700 flags: Rename varg to overflow, let it be renamed with config 2025-06-09 13:02:05 -04:00
Feoramund
2e199c669f flags: Forbid combination of pos and manifold 2025-06-09 11:39:10 -04:00
Feoramund
7c5700996f flags: Mention varg in the documentation 2025-06-09 11:39:10 -04:00
Feoramund
e20db8df89 flags: Rename variadic to manifold (breaking change) 2025-06-09 11:27:27 -04:00
Jeroen van Rijn
179e5b8835 Fix #4705
Allocate `doc.tokenizer`, and free it in `destroy`.
2025-06-09 15:09:04 +02:00
gingerBill
87247b8bb7 Merge pull request #5286 from Feoramund/no-san-mem
Add `@(no_sanitize_memory)` with additions to `base:sanitizer`
2025-06-09 12:46:22 +01:00
Colin Davidson
3407bd7cf9 better handle offset-0 case 2025-06-08 17:03:43 -07:00
Feoramund
0747032e4a Use idiomatic rawptr(nil) 2025-06-08 17:48:06 -04:00
Jeroen van Rijn
d2d187eaaa Work around untyped nil 2025-06-08 22:53:52 +02:00
Tohei Ichikawa
7662e7d843 Removed obsolete tz param from gettimeofday 2025-06-08 16:07:11 -04:00