atomics A.0b: real seq_cst load/store emission (green)
Replace the A.0a emit bail with real LLVM atomic codegen: - emitAtomicLoad: LLVMBuildLoad2 + LLVMSetOrdering + LLVMSetAlignment - emitAtomicStore: LLVMBuildStore + LLVMSetOrdering + LLVMSetAlignment (value coerced to the pointee type, mirroring emitStore) - llvmOrdering: explicit sx AtomicOrdering -> LLVMAtomicOrdering map (LLVM's enum is non-contiguous; never an identity cast) examples/1700 now prints 7/42/43; IR is 'load atomic i64, ptr .. seq_cst, align 8' + 'store atomic ..'. Unit test 'emit: atomic load/store (seq_cst, aligned)' locks the emission shape (load atomic/store atomic/seq_cst/align 8) without a fragile full-module .ir snapshot. Suite green (710 examples + units).
This commit is contained in:
@@ -4,9 +4,17 @@ Companion to [PLAN-ATOMICS.md](PLAN-ATOMICS.md). Update after every step (one st
|
||||
time, per the cadence rule). New corpus category: `17xx`.
|
||||
|
||||
## Last completed step
|
||||
**A.0a (lock commit) — DONE.** Full atomic load/store plumbing landed with LLVM emission
|
||||
deliberately bailing loudly; `examples/1700-atomics-load-store.sx` locked to the bail
|
||||
diagnostic (exit 1). Suite green (710 examples, 0 failed; 476 units).
|
||||
**A.0b (green) — DONE.** Real atomic load/store emission: `LLVMBuildLoad2`/`LLVMBuildStore`
|
||||
+ `LLVMSetOrdering` + mandatory `LLVMSetAlignment`, ordering via an explicit
|
||||
sx-tag→`LLVMAtomicOrdering` switch (`llvmOrdering`). `examples/1700` green (7/42/43); IR
|
||||
shows `load atomic i64, ptr … seq_cst, align 8` + `store atomic …`. Added unit test
|
||||
`emit: atomic load/store (seq_cst, aligned)` in `emit_llvm.test.zig` (asserts `load
|
||||
atomic`/`store atomic`/`seq_cst`/`align 8`). No fragile full-module `.ir` snapshot for 1700
|
||||
(it uses `print`); the unit test is the emission-shape gate. Suite green (710 + units).
|
||||
|
||||
### Earlier — A.0a (lock commit)
|
||||
Full atomic load/store plumbing with LLVM emission deliberately bailing loudly;
|
||||
`examples/1700` locked to the bail diagnostic.
|
||||
- `library/modules/std/atomic.sx`: `Ordering` enum, `Atomic($T)` struct (`init`/`load`/
|
||||
`store`, **seq_cst-only** — see capability gap below), `atomic_load`/`atomic_store`
|
||||
`#builtin` decls. **Opt-in import**, NOT in the universal `std.sx` facade (mirrors
|
||||
@@ -64,3 +72,6 @@ diagnostic (exit 1). Suite green (710 examples, 0 failed; 476 units).
|
||||
AtomicOrdering) + recognizer + print/vm arms + emit BAIL; locked `examples/1700` to the
|
||||
bail diagnostic. Reverted a universal-facade wiring that churned 37 `.ir` snapshots
|
||||
(Ordering would bloat every program's type table). Suite green (710/0).
|
||||
- **A.0b** — real atomic load/store emission (LLVMBuildLoad2/Store + SetOrdering +
|
||||
SetAlignment; explicit sx→LLVM ordering switch). 1700 green (7/42/43, `load atomic …
|
||||
seq_cst, align 8`). Unit test added. Suite green (710 + units).
|
||||
|
||||
Reference in New Issue
Block a user