Skip to content

refactor(ccr): v10 目标无关格形态迁移 - #181

Merged
dslsdzc merged 58 commits into
developfrom
refactor/lattice-ccr-v10
Oct 24, 2026
Merged

dslsdzc merged 58 commits into
developfrom
refactor/lattice-ccr-v10

Conversation

@dslsdzc

@dslsdzc dslsdzc commented Oct 23, 2026

Copy link
Copy Markdown
Owner

概要

把 .ccr 从 v9.1 槽格式迁移到 v10 目标无关格形态:

  • v10 header/9 段/canonical 顺序:STR → TYPE → IFACE → SYM → NOD → ENT → REG → EDG → CASE;v9 整类拒绝。
  • NOD 40B type_id/flags,移除宽度/stride/偏移;ENT 24B 无 home,补全局/参数存在行。
  • loader 前向消费,无后向 seek;SYM/REG/NOD 操作数/opcode/STR/TYPE/LABEL 校验;opt_meta 不再从 wire 执行寄存器分配。
  • 前端去布局:ir_gen/ptr_analysis/provenance_verify/ccr_lower/interp 不再直接调用 mp_*;corearch 按 target layout 重建。
  • w64/r64 公共内建移除;raw 字节内建保留为显式 SYSTEM runtime ABI。
  • 新增 tools/ccrb.py 分发层;.coi 可选、不透明、可删除;corearch 不依赖 zstd。
  • 测试 oracle/负向 fixture/CI hook 已接入;.ccr canary 仅按 header flags/ENT 存在行归因重锁,ELF canary 不变。

验证

最终 head 0cdf35cc:

build_selfhost_native.py        PASS
corec check src/compiler         ok
test_ccr_v10_format.py          46/46
test_ccr_v10_stream.py           5/5
test_ccr_types.py               53/53
test_ccr_v7.py                  27/27
test_backend_bootstrap.py        PASS
test_opt_dex.py                  PASS
test_bigint_arith.py             PASS
test_native_memory.py            9/9
test_interp_parity.py           26/26
test_ci_hook_coverage.py         PASS
canary_check.sh                  5/5
corec2/corec3 cmp                clean

ELF canary:826d74cf7f099f9758e11a64d443695ff8360327a88e7eb5922ddfd617e0dce5(53430 B)。

已知后续

  • 公共 Bytes API 迁移后,普通程序才能重新产生 PORTABLE .ccr;当前注入 runtime 调 raw ABI,故 e2e 均为 SYSTEM。
  • .coi 完整记录格式仍归独立计划;本 PR 只保证 .ccrb 可选 opaque sidecar。
  • .ccrb CI 因未声明 zstd 依赖暂列 allowlist。
  • test_hit_table.py 及若干迁移前已红套件不在本 PR 范围。

Delete tag2l.cr, the g_x86_mw_* frame/tag state, jo/oc tail blocks, and
test_mw_task1-6. Raw compiler paths now use plain 64-bit values; user
programs continue on tagged BigInt.

Also box TI_DEX_S -> TI_INT stores for @raw_int under tagged mode, so
raw dex payloads are not misread as tagged immediates.

Relock canary_elf: the removed compiler globals shift intern ids; all
four .ccr values are unchanged. D1 determinism is 5/5.
Add a debug marker to CLI flag records and print hidden debug channels
in their own help group. Update corec debug flag registrations.
- split target-owned ABI builtins across x86_64, linux, and runtime; the
  target root only composes them
- move classic value mapping to src/arch/x86_64 and keep the compiler
  mapping.cr as a target-neutral interface
- add the kernel cell API; frontend table accesses no longer call
  w64/r64/w32/r32/load8/store8/_dyncpy directly
- make the target descriptor own the backend command, import roots, and
  runtime source path
- rename the combination root to x86_64-linux-elf (arch x system x
  container) and record all three in Core.toml
- relock the four .ccr canaries after the compiler-side global order
  changed; ELF canary is unchanged
Use src/targets/x86_64/linux/elf/ instead of one hyphenated target name.
The root only composes the three axes; architecture, OS, and container
implementations remain in their own trees. Update the build manifest,
project-mode import root, tests, and parity script.
Keep the declared dex? row on call results, struct-field reads, and enum
match payloads. The existing match lowering only recovered the payload
form from irv_decl_ti; without propagation, @raw_int saw a raw scaled
integer as a plain int and produced 3 instead of 7.

test_opt_dex is now 30/30; BigInt, backend bootstrap, corec2/corec3,
and canary remain green.
Define .ccr v10 as a lattice/existence representation, not a linear
slot instruction stream. NOD/EDG/ENT/REG are the semantic backbone; file
order is a topological projection. Remove width/offset/stride/ABI/home
from the authoritative format, keep TYPE as semantic domains, reserve
CASE, and leave target layout to corearch/HIT while .coi remains optional
optimization knowledge.
Do not spell wire fields as u32/i32. The format needs fixed byte widths,
but those are file-format contracts, not language types or target word
sizes. Use semantic roles (count, id, imm, flags, ...) plus a separate
wire-role table.
Order the canonical segments as STR, TYPE, IFACE, SYM, NOD, ENT, REG,
EDG, CASE so a reader can consume forward with no backward seeks. Add
the streaming-reader contract and the zstd/tar .ccrb distribution bundle
rules. Raw .ccr remains uncompressed and target-neutral.
Replace ASCII pipeline arrows with Mermaid flowcharts for the lattice
pipeline, canonical segment order, bundle layout, and consumer flow.
Remove the w64 and r64 builtin names from the frontend ABI table and
backend dispatch. Internal byte-buffer access now uses cell_store and
cell_load, which the compiler and stdlib share as low-level runtime
accessors. This is the first step toward removing fixed-width names from
the ordinary surface; v10 typed/layout IR migration remains separate.
@dslsdzc
dslsdzc merged commit 9f37883 into develop Oct 24, 2026
2 of 4 checks passed
@dslsdzc
dslsdzc deleted the refactor/lattice-ccr-v10 branch October 24, 2026 03:06
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