Skip to content

Claim channel slots on the success path - #31

Merged
Cod-e-Codes merged 1 commit into
mainfrom
runtime-slot-claim
Sep 23, 2026
Merged

Cod-e-Codes merged 1 commit into
mainfrom
runtime-slot-claim

Conversation

@Cod-e-Codes

Copy link
Copy Markdown
Owner

Summary

  • Channel send and recv claim a slot with atomics and copy elem_size bytes on the success path. A pthread wait happens only when the buffer is full, empty, or disconnected, and only after the waiter is registered and the operation is retried. This impacts every program that links the runtime: relink with this ion_runtime.c. Ion source is unchanged.
  • HashMap probes and for_each borrow slots with Vec::get_ref. Vec::set runs only for the index that receives a new pair or a tombstone. This impacts programs that import stdlib/map.ion: recompile them.
  • ion_box_alloc and ion_box_free are static inline malloc and free in runtime/ion_runtime.h. This impacts C that called those symbols from ion_runtime.o: recompile that C against this header.
  • A match on a reference to a generic enum uses that instantiation, and a binding recorded as a reference stays a pointer when a type parameter is replaced by a copy type. Recompile those programs.

Test plan

  • cargo test
  • cargo clippy -- -D warnings
  • tests/test_runner.sh
  • Same-machine checksums for same-thread send/recv, cross-thread send/recv, HashMap insert plus scan, and Box new/unwrap match the pre-change build

…lace.

Programs that link the runtime must relink, and programs that import the map must be recompiled. Box allocation is an inline malloc so the C compiler can see it.
@Cod-e-Codes
Cod-e-Codes merged commit cd9ed04 into main Sep 23, 2026
8 checks passed
@Cod-e-Codes
Cod-e-Codes deleted the runtime-slot-claim branch September 23, 2026 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant