Skip to content

compiler: keep raw memory ABI out of user symbol tables - #206

Merged
dslsdzc merged 1 commit into
developfrom
raw-abi-boundary
Oct 26, 2026
Merged

dslsdzc merged 1 commit into
developfrom
raw-abi-boundary

Conversation

@dslsdzc

@dslsdzc dslsdzc commented Oct 26, 2026

Copy link
Copy Markdown
Owner

概要

把前端的 ABI 内建分成公开 ABI与raw/系统 ABI 两层。raw 名不再进入用户符号表。

  • load8 / store8 / load64 / w32 / _dyncpy / load_str_ptr / store_str_ptr:
    用户代码调用 → N06 Undefined function;LSP 补全不提供;@std / @core 正常使用。
  • cell_load / cell_store / alloc / syscall3 / syscall4 / get_arg 等保持公开 ABI。
  • prelude_builtin_add 增加可见性列;只有公开 ABI 注册为 SYM_FN,raw 名仅通过
    prelude 查询在库上下文中解析。删除了 checker 末尾绕过可见性的 builtin 回退循环。
  • 库归属不再依赖 pub 层开关:普通用户程序也记录当前函数所属库,raw 可见性据此判定。
    编译器实现域(src/arch、src/runtime、src/os、src/format、src/lsp、src/targets 等)
    归入 @core。
  • 主文件路径写入 file 表;空虚拟路径读取前先做空槽保护(purity self-test 曾在此崩溃)。
  • 内部夹具改用公开 rawbuf 包装或 cell_load,新增 test_raw_abi_boundary 钉边界。
  • test_lsp.py 补断言:补全候选不包含 load8 / store8。

验证

  • selfhost-tests 全绿
  • bootstrap-tests 全绿
  • check 全绿
  • canary 5/5,值与上一代逐字节相同(raw 名不注册不改变 .ccr / ELF)
  • 新判据:用户 load8(...) / store8(...) → N06;rawbuf.rawRead8 公开包装 build+run rc=42

- Split prelude builtins into public ABI and raw/system ABI. Only public
  names are registered as SYM_FN; raw names resolve solely through the
  prelude query in @std/@core library context.
- User code now gets N06 for load8/store8/load64/w32/_dyncpy/
  load_str_ptr/store_str_ptr. cell_load/cell_store/alloc/syscall3 remain
  public ABI.
- Always track the owning library of a compilation unit (not only when
  the pub layer is on) so raw visibility has an owner even in ordinary
  programs. Compiler implementation trees (src/arch, src/runtime, ...)
  belong to @core.
- Record the main source path; guard empty virtual file paths before
  reading a stored path string (purity self-test crashed on the empty
  slot).
- Update internal fixtures that used raw names to public rawbuf wrappers
  or cell_load; pin the boundary with test_raw_abi_boundary and the LSP
  completion test.
@dslsdzc
dslsdzc merged commit 0db2885 into develop Oct 26, 2026
4 checks passed
@dslsdzc
dslsdzc deleted the raw-abi-boundary branch October 26, 2026 09:01
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