Login
Check-in [496ed9c188]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Merge S.8c: emit for the first nodes, run on QEMU's Cortex-M0

Reviewed against docs/tasks/S.8c.md; verdict merge after one change (arena by pointer).

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

Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 496ed9c1881cc702767a6ca775809cbb605fcad3b54a9e924f32de78ab48f0d9
User & Date: x86-1-glint 2026-11-09 15:00:00.923
Context
2026-11-09
16:02
Task 3.6 runs on x86_64 now; S.8 parked after S.8c

Claim: docs/tasks/3.6.md is handed out without waiting for the seed. Everything that runs on the host is done now, for both machines: both fixtures (the tool writes bytes), the parser's checks and every hostile header. The steps that need a built aarch64 image are pending specs, and the reviewer runs them when x86-1's LLVM has AArch64. The plan's S.8 says it is parked after S.8a-c.

Passage: the maintainer, ocx-console 363063f81e: 'Try to let Glint get through the book implementation.' Relayed with the choice of route in glint b142e85cea.

Demonstration: llvm-config --targets-built on x86-1 prints X86, so bin/glint-build aarch64 can't run here; tools/make_test_guest.cr is a host tool and needs no target compiler.

Size: 4 changes to one task, 2 lines in the plan.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TUH8KMXZyLk8eDgCjvQ9hX check-in: 5e0694da5a user: x86-1-glint tags: trunk

15:00
Merge S.8c: emit for the first nodes, run on QEMU's Cortex-M0

Reviewed against docs/tasks/S.8c.md; verdict merge after one change (arena by pointer).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TUH8KMXZyLk8eDgCjvQ9hX check-in: 496ed9c188 user: x86-1-glint tags: trunk

15:00
S.8c: emit writes Cortex-M0+ code for the first nodes, run on QEMU's Cortex-M0

Claim: Emit.function turns a tree of S.8a's nodes into one BL-callable ARMv6-M Thumb function, with its result in r0 and up to 8 locals in its frame. It writes into a caller's buffer with no heap and returns its size, or FULL, RANGE or BAD_TREE. It keeps Crystal's meaning: ADD and SUB branch to an overflow handler on signed overflow, as Crystal raises OverflowError. LT, a Bool, is only a condition. WHILE, which gives nil, is only SEQ's first child. IF needs an else, and reading a local before it's assigned in evaluation order is refused. src/glint/shell/thumb.cr encodes only ARMv6-M instructions.

Passage: the maintainer, ocx-console 5091084ac5: 'an emit method that walks the ast to generate m0+ code that can be saved, loaded and run for fast performance.'

Demonstration: crystal spec spec/shell/emit_spec.cr spec/shell/tree_spec.cr spec/qemu/microbit_spec.cr: 26 examples, 0 failures, 0 pending. All ten programs in the task's table run under qemu-system-aarch64 -M microbit and print the expected value or 'overflow' with the expected exit status. The 1000-iteration sum prints 00079f2c from 114 bytes of emitted code. The task's seven encodings match what QEMU executes, and an undefined instruction reaches the HardFault stub, so a non-ARMv6-M encoding would fail rather than pass. Not yet checked with a disassembler, because x86-1's LLVM has no ARM target. Codex wrote it from docs/tasks/S.8c.md. Review change: Emit.function takes the arena by pointer, because by value it copied the whole arena (3 KiB at 256 nodes) onto the stack. Known limits, not hidden: every literal takes 14 bytes (no small-value form yet); the overflow branch is a B, so the handler must be within 2 KiB, or emit returns RANGE.

Size: emit.cr 137 lines, thumb.cr 150; harness 95 and spec 184.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TUH8KMXZyLk8eDgCjvQ9hX Leaf check-in: 9426e034ca user: x86-1-glint tags: slice/S.8c

14:52
Merge S.8b: QEMU's microbit machine in Glint's qemu-system-aarch64

Reviewed against docs/tasks/S.8b.md; verdict merge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TUH8KMXZyLk8eDgCjvQ9hX check-in: afb4181acf user: x86-1-glint tags: trunk

Changes
Unified Diff Side-by-Side Diff Patch
Added spec/shell/emit_spec.cr.
Added spec/support/thumb_image.cr.
Added src/glint/shell/emit.cr.
Added src/glint/shell/thumb.cr.