Commit 2bad703
authored
Phase 1: real codegen — layout engine + typed-access lowering (#146)
Real codegen, replacing representative stub bodies, harvested from the Zig twasmc reference (PR #136, closed superseded with credit):
- layout engine (field offsets, element stride, alignment, inline embedded regions — Players slot 48B, nested .pos.x into @vec2 at offset 16)
- typed-access lowering (Body::Typed/Stmt/Access): real loads/stores at base + index*stride (+ offsets), via a base-pointer local read once per handle (keeps &mut/own clean under the verifier)
- example 01 now carries &/&mut ownership; example 03 reads via base locals
ADR-0004 ratified (Proposed -> Accepted) recording the Rust-vs-Zig decision + harvest; CHANGELOG + crate README updated. Verified locally (cargo test --workspace --locked: codegen 22 + verifier 80; fmt + clippy clean; no new deps) since Actions credit is exhausted. Closes the representative-bodies gap from #127 (front-end -> IR seam still deferred). Part of Phase 1 (#49).
https://claude.ai/code/session_01Rq4da8i2uGnDUfanSB1Hx41 parent 8de427e commit 2bad703
6 files changed
Lines changed: 585 additions & 308 deletions
File tree
- crates/typed-wasm-codegen
- src
- tests
- docs/decisions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
25 | 42 | | |
26 | 43 | | |
27 | 44 | | |
| |||
51 | 68 | | |
52 | 69 | | |
53 | 70 | | |
54 | | - | |
55 | | - | |
56 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
57 | 75 | | |
58 | 76 | | |
59 | 77 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
60 | | - | |
| 61 | + | |
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
| |||
0 commit comments