fibers B1.3a-1: stackful context switch (naked swap_context + fiber bootstrap)
The first piece of the B1.3 fiber runtime — the stackful context switch, pure sx over abi(.naked). swap_context(from, to) saves the callee-saved registers + SP/LR into *from and loads them from *to, then rets onto to's stack (SP-in != SP-out by design — why it must be .naked). Fibers are bootstrapped by hand: the saved context starts with SP = top of an alloc_bytes stack, LR = a global-asm trampoline (mov x0, x19; bl _fib_body, reaching the sx body via export), and x19 = the *Fiber. Locked by examples/1807-concurrency-fiber-context-switch.sx (aarch64-pinned): - 2-fiber ping-pong (A <-> B, 3 rounds each): rounds: 6, and a per-fiber stack canary held live across every suspend survives (canary fails: 0); - a 64-frame deep recursive chain suspended at the bottom and resumed, verifying every frame's stack-local on the unwind (frames verified: 64, depth fails: 0). Scope (honest): exercises register/stack preservation INDIRECTLY (compiler- allocated live values + the canary). The EXPLICIT every-callee-saved GP (x19-x28) + FP (d8-d15) sentinel scribble — the full design-section-10.7 gate — is B1.3a-2, still owed. x86_64 sibling + mmap guard-page stacks are B1.3b. Suite green 733/0. Runs under JIT, ir-only on a non-arm host.
This commit is contained in:
@@ -0,0 +1 @@
|
||||
{ "target": "macos" }
|
||||
@@ -0,0 +1 @@
|
||||
0
|
||||
16966
examples/expected/1807-concurrency-fiber-context-switch.ir
Normal file
16966
examples/expected/1807-concurrency-fiber-context-switch.ir
Normal file
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
rounds: 6
|
||||
canary fails: 0
|
||||
frames verified: 64
|
||||
depth fails: 0
|
||||
Reference in New Issue
Block a user