Skip to content

examples: make 30_stream_test portable to eZ80 (pointer-typed descriptor field) - #378

Merged
oisee merged 1 commit into
mainfrom
fix/stream-test-portable
Dec 1, 2026
Merged

oisee merged 1 commit into
mainfrom
fix/stream-test-portable

Conversation

@oisee

@oisee oisee commented Dec 1, 2026

Copy link
Copy Markdown
Owner

Before this change, 30_stream_test.nanz stored &buf in a u16 cell of a byte-array descriptor. Under the eZ80 ADL ABI (ADR 0054) that truncates the pointer to bank 0, so two asserts failed on eZ80.

The descriptor is now a struct: struct BufStream { data: ^u8, pos: u16, cap: u16 }.

  • All four asserts and their expected values are unchanged.
  • Z80: 4/4 pass.
  • eZ80 sweep: 4/4 pass (was 2 failing).
  • On 16-bit targets the struct packs to the same 6-byte layout, so showcase_stream_oracle_test.go checks the same behaviour unchanged. The pinned record in reviewed-updates.json has an updated hash and boundary text.

Example source only; no compiler change. Written by a GLM worker session (claude-z) and reviewed by the coordinator.

🤖 Generated with Claude Code

https://claude.ai/code/session_01N957godRAhTkyy1mTB6roS

…tor field

The BufStream descriptor kept the buffer address in a u16 cell of a byte
array (`var p: ^u16 = s; p[0] = b`). On Z80 that works (16-bit pointers);
on eZ80 ADL the 24-bit pointer truncates to bank 0, the writes miss buf,
and the asserts at lines 63 and 75 read 0 instead of 42/20.

Give the descriptor a struct with a pointer-typed field instead:

    struct BufStream { data: ^u8, pos: u16, cap: u16 }
    global stream: BufStream

bufstream_init/write_u8/pos now take ^BufStream and use s.data/s.pos/s.cap,
so the program is correct on both targets with the same four asserts and
expected values. No compiler changes.

Oracle evidence: the showcase_stream_oracle_test.go driver needed no
change — the packed struct layout on the 16-bit oracle targets is still
the 6 bytes [data:2][pos:2][cap:2] it already checked, and the test still
verifies the same full 64-byte buffer and relocated-pointer descriptor on
VM and native Z80 across all five capacities. The reviewed record in
docs/grace-integration-338/reviewed-updates.json gets the new source
SHA256 and an accurate boundary describing the struct descriptor.

Gates: Z80 asserts 4/4; eZ80 sweep (scripts/agon/ez80_sweep.sh) 4/4
asserts pass, 0 fail (was 2/4); go test ./pkg/pipeline -run Showcase;
go test ./pkg/nanz; run_stable_pipeline.py --profile fast (2 shards,
exit 0 both).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N957godRAhTkyy1mTB6roS
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

PR tests: 🟢 pass

Commit: 536dd711 · Full test log

Check Result
Complete fresh Ruby/Crystal native pipeline 🟢 pass
Inherited compiler and complete frozen native gates 🟢 pass
Build mz, mza, mze, mzv 🟢 pass
Fast compiler regressions (deep suites run separately) 🟢 pass
Fibonacci compile + assemble 🟢 pass
Nanz language regressions 🟢 pass
Z3 West of House demo 🟢 pass
Z3 small conformance fixtures 🟢 pass

Deep pipeline domains and the full assertion corpus run on release tags, nightly and manual audits.
The external CZECH and full Zork I stories are not part of this PR gate.

@oisee
oisee merged commit 06f21a2 into main Dec 1, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant