Phase 8a: finish typed indexing — fixeds/ptrs buffers (retire peekf/pokef/peekp/pokep/str_len)
The last peek/poke pairs were the same "typed buffer access wearing a C name" as peek8/peek32, so they become indexing too: peekf(sc_x, i) -> sc_x[i] (a `fixeds` buffer -> a fixed) pokep(gc_bmp, s,b) -> gc_bmp[s] = b (a `ptrs` buffer -> a pointer) str_len(s) -> len(s) (len is polymorphic since 7f; str_len was dead) Two new element-typed buffers join words: `fixeds` (32-bit fixed) and `ptrs` (pointer, 8-byte stride). emit_index_addr dispatches on the base type; IR is byte-identical to the old intrinsics. The peekf/peekp buffers (ed_x0/ed_x1/ol_x/sc_x fixed coords; gc_bmp/img_px/ tt_data/ui_text pointer arrays) were retyped scope-aware, then the 33 sites migrated to indexing. Two bugs found via a menu golden diff / a link-time type error and fixed: the buffer-name regex truncated digit suffixes (ed_x0 -> ed_x), and the char-literal brace-miscount skipped a few module declarations (same class as 7j). Reseeded (22371 lines); C-free fixpoint holds; goldens byte-identical; 18/18; vocab (fixeds/ptrs types in, 5 intrinsics out) + doc-fences clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
ae65acde33
commit
5a9e8cb2da
13 changed files with 2992 additions and 3206 deletions
|
|
@ -147,9 +147,12 @@ See `examples/menu.ludic` for a complete title screen.
|
|||
| `ptr` | raw address (runtime/FFI) | `ptr` |
|
||||
| `byte` | pointer to bytes — `p[i]` reads/writes one byte | `ptr` |
|
||||
| `words` | pointer to 32-bit words — `w[i]` reads/writes an `int` | `ptr` |
|
||||
| `fixeds` | buffer of `fixed` values — `f[i]` reads/writes a `fixed` | `ptr` |
|
||||
| `ptrs` | buffer of pointers — `p[i]` reads/writes a `ptr` | `ptr` |
|
||||
|
||||
Allocate raw buffers with `bytes(n)` (n bytes) or `words(n)` (n 32-bit words);
|
||||
both return a pointer you index with `buf[i]`.
|
||||
both return a pointer you index with `buf[i]` — retype the binding (`words` /
|
||||
`fixeds` / `ptrs`) to pick the element size.
|
||||
|
||||
Numeric literals: `42` and `0x1affff` are `int`; a literal with a decimal
|
||||
point (`1.5`) is `fixed`. Arithmetic on two `fixed` values lowers to
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue