b842f9337b344673c36e80a993ee3ded17148692
Adds lib/memio/vstream.ww with three new constructors — fixed_vstream / dynamic_vstream / dynamicfrom_vstream — that return io.vstream (= *io.vtable, from lib/io/stream.ww) alongside the pre-vtable memio.fixed / dynamic / dynamicfrom shape in memio.ww. Hare's memio::fixed/dynamic return a `stream` whose first field IS io::stream (= *vtable); ww mirrors that intrusively with fixed_ctx + dynamic_ctx structs whose first field is `vt: io.vtable`. A heap-alloc'd *fixed_ctx is castable to vstream via `&c.vt`, and callbacks recover the outer ctx via `s: *fixed_ctx` (same pattern as lib/bufio.stream over io.stream and lib/log.stdlogger over logger). ptr/len/cap kept flat (memio.ww:39 SOP) to dodge the chained-dot-through-pointer-into-slice-subfield miscompile family. Constructor flow: alloc with vt zero-initialised via a local, then chained `c.vt.X = …` field-assigns through the *ctx pointer. Struct-lit init via `vt = local_vt` (with local pre-set) silently drops tagged-union slots past the first — sibling task filed, workaround is the alloc-then-assign route (proven byte-id between both stages). *ctx is a plain pointer-to-struct, not an aliased pointer, so the chained-store path doesn't hit #195. Cast workaround per #206 at each vtable-fn-ptr-slot init (8 sites across the 3 constructors): bare `&fn_name` does not type-check as `(*<alias> | void)`. Same `(&fn): *io.<role>` shape that test/wcc/775_io_vtable_run.c uses. Drops out when #206 closes. OLD memio surface is UNCHANGED. fold-eFinal (task #50) atomically flips the package shape: deletes OLD constructors + callbacks and renames `_vstream` suffix off. Probe test/wcc/776_memio_vstream_run.c: 4 rows (fixed_read_5 / dynamic_write_grow / dynamicfrom_alt_rw / branched_fixed) exercise both vtable flavours through the io.st_read / st_write / st_close dispatchers. Each row drives cs runtime + ww runtime + cs.s == ww.s byte-id — 12 fixtures total, all green. Pre-existing wwstage gap surfaced + documented inline: ww_ww's combined.ww concat order trips the wwstage checker on os.tryread / trywrite / tryopen's bare `return r;` over `(int | oserror)` when os is checked after rt/io. Each probe row places `import os;` FIRST to match the ordering selfhost uses (time → os → rt → …) where the checker resolves cleanly. Sibling task; resolves the ordering-sensitivity in the wwstage checker drops the workaround.
Description
No description provided
Languages
C
89.4%
Python
7.2%
Makefile
2.3%
Shell
0.8%
Assembly
0.3%