Skip to content

ruff_r2il: harvest_6502 — the Probe C intake leg, run on real Elite images - #106

Merged
AdaWorldAPI merged 1 commit into
mainfrom
claude/c64-6502-falsifier-shztkk
Aug 25, 2026
Merged

AdaWorldAPI merged 1 commit into
mainfrom
claude/c64-6502-falsifier-shztkk

Conversation

@AdaWorldAPI

Copy link
Copy Markdown
Owner

What

The C64/6502 intake leg of C64-rs's Probe C, as a new lift-gated example in the workspace-excluded ruff_r2il crate: compile the sibling checkout's unmodified Ghidra 6502.slaspec at run time (sleigh-compiler dev-dep — the same crate C64-rs uses at build time; this crate vendors nothing), lift PRG-headed C64 images, partition at JSR targets, and run every partition through the existing ore → furnace → slag pipeline. No library code changes — the arm was already architecture-agnostic, which is the point being proven.

Default corpus: the Elite reference binaries (gma4/5/6.bin = COMLOD/LOCODE/HICODE) in the sibling elite-source-code-commodore-64 checkout. Licensing posture (operator-ruled): read locally, never redistributed — artifacts carry FNV hashes and counts only; a missing corpus file is a printed skip, never a failure, so the example runs on any checkout.

Two measured findings (each fixed a real collapse)

  1. A whole PRG as ONE function loses everything the SSA entry cannot reach. CFG::from_blocks takes blocks[0].addr as entry; first run measured 52 KB of Elite → 38 classified facts. Fix: JSR targets partition the image — the 6502 stand-in for STT_FUNC on a symtab-less format.
  2. 6502 direct JSR/branch targets lift with SpaceId::Ram, not Const. The Const filter copied from the x86 harvest silently discarded every call target (a probe printed the space distribution before the filter changed). Both find_call_targets and find_leaders now accept Const | Ram, with the finding recorded at the filter.

Measured result

image load JSR-partitioned fns facts residual
gma4 (COMLOD) $4000 31 629 1758
gma5 (LOCODE) $1D00 8 340 789
gma6 (HICODE) $6A00 23 487 1195

Conservation: 5198 harvested / 1456 classified / 3742 residual / 0 dropped. Slag is dominated by opcode_not_in_convention — the pass-1 seven excludes 6502 flag arithmetic by design, so the top slag shapes ARE pass 2's named work queue, not a defect. Artifacts under .claude/harvest/r2il-6502/ — evidence, never a re-ingest path.

Context

Companion PRs this session: OGAR astral-sh#284 (mints 0xC6XX Mmio, C64 founding tenant), C64-rs #11 (fence widening + Probe C route record). The harvest lives HERE because ruff_r2il's path deps escape the ruff repo (sibling-checkout-only crate) — consuming it from c64-rs as a git dep would create two r2il SourceIds and two incompatible type universes.

Gates: example builds + runs (--features lift), clippy --example harvest_6502 -- -D warnings clean, cargo fmt clean (crate-scoped — workspace-excluded).


Generated by Claude Code

…mages

New lift-gated example: compile the sibling checkout's unmodified Ghidra
6502.slaspec at run time (sleigh-compiler dev-dep, the same crate C64-rs
uses at build time), lift PRG-headed C64 images (2-byte LE load address,
no symtab, no sections), partition each image at JSR targets — the 6502
stand-in for STT_FUNC — and run every partition through the existing
ore -> furnace -> slag pipeline. Default corpus: the Elite reference
binaries in the sibling elite-source checkout, read locally and never
redistributed (artifacts carry FNV hashes and counts only); a missing
corpus is a printed skip, never a failure.

Two measured findings, each of which halved-then-fixed a collapse:

1. A whole PRG as ONE function loses everything the SSA entry cannot
   reach (CFG::from_blocks takes blocks[0].addr as entry) — first run
   measured 52 KB of Elite -> 38 classified facts. JSR partitioning is
   the fix, and the example's doc says why.
2. 6502 direct JSR/branch targets lift with SpaceId::Ram, not Const —
   the x86 harvest's Const filter silently discarded every call target
   (a probe printed the space distribution before the filter changed).

Measured result on gma4/5/6 (COMLOD/LOCODE/HICODE): 62 JSR-partitioned
functions, conservation 5198 harvested / 1456 classified / 3742 residual
/ 0 dropped. The slag is dominated by opcode_not_in_convention — the
pass-1 seven excludes 6502 flag arithmetic by design, so the top slag
shapes are pass 2's named work queue, not a defect.

Artifacts under .claude/harvest/r2il-6502/ (ore.tsv / census.md /
slag.tsv / convention.toml / PROVENANCE.md) — evidence, never a
re-ingest path.
@coderabbitai

coderabbitai Bot commented Aug 25, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 911878c0-bd54-4a14-a3ab-8028e20911d3


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cursor

cursor Bot commented Aug 25, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_def4f78b-b5a8-45d8-b262-a9009107fe24)

@AdaWorldAPI
AdaWorldAPI marked this pull request as ready for review August 25, 2026 19:07
@AdaWorldAPI
AdaWorldAPI merged commit aababec into main Aug 25, 2026
31 of 34 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.

2 participants