Opcode facts in one X-macro table; retire the three opcode-comment gates (#1275)
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 28/100
- Issue 类型
- 重构
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 领域
- compilers, testing-qa
调研方向
Start by reading src/vm.h, src/chunk.c, and the three gate scripts: tools/obs_marker_check.sh, tools/obs_reader_sync_check.sh, and tools/vm_operand_width_check.sh. Trace the opcode enum, observer lookup, and verifier role table before assessing the X-macro design. Done means the generated facts replace the duplicated checks, bytecode remains identical, and the full suite, ASan, JIT checks, and calibration plant pass.
由索引模型根据 Issue 内容生成。
描述
Split out of #1275 (item 7, "the rest"), as its definition of done requires for rows that need a product-code change.
Problem
Three gate scripts check hand-written opcode comments against the C (1,277 lines together at 94c4c5b). None has a recorded catch of a product bug:
tools/obs_marker_check.sh(550): every opcode insrc/vm.hhas an/*obs:READS|NONE|…*/marker (#972).tools/obs_reader_sync_check.sh(448): those markers agree with thecase OP_…:arms ofopcode_is_observer_reader()insrc/chunk.c(#915/#972).tools/vm_operand_width_check.sh(279): the[kind:N]operand-width comments insrc/vm.hagree with the VM's decoder sites and chunk.c'sVR_*verifier table (#958).
Each property lives in two or three homes: a comment, a switch and a table. The scripts only exist to keep those homes in step.
Proposal (structural, principle 5)
One X-macro opcode table, for example src/opcodes.def, with one row per opcode carrying NAME, observer-class, operand roles/widths. The rest is generated from it by the preprocessor:
- the
enumin vm.h; opcode_is_observer_reader()(a lookup of the observer-class column);- the verifier's role table.
The per-opcode facts then have one home. The compiler enforces the agreement that the three scripts check today, and they are deleted. What remains is at most a small check that the decoder's read_uN widths match the table's widths (the one fact the preprocessor cannot tie). Measure whether it is needed before keeping it.
Touches the opcode ABI (see the eigenscript-extend-vm skill and the operand-width-is-ABI note): the bytecode and the JIT must be byte-identical before and after.
Done when
- Opcode name, observer class and operand roles/widths are declared in exactly one table;
enum,opcode_is_observer_reader()and the verifier roles are generated from it. -
tools/obs_marker_check.sh,tools/obs_reader_sync_check.shandtools/vm_operand_width_check.share deleted along with their suite sections andtools/selftests.txtrows, or one survivor is ≤ 150 lines and the PR shows why it is needed. - The compiled bytecode is byte-identical before and after on the corpus:
--dump, or a hash of every compiledtests/*.eigschunk, compared old against new. - Full suite, ASan-with-leaks and
tools/jit_diff.share green;make jit-smokepasses. - One calibration plant: flipping one opcode's observer class in the table changes
opcode_is_observer_reader()and makes the suite's observer section fail. The result is recorded in the PR.
- 主要语言
- C
- 星标
- 3
- 派生
- 7
- 平均合并
- 4 小时 7 分钟
- 30 天内合并 PR
- 112
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
InauguralSystems/EigenScript 的其他 Issue
-
area:embed kind:silent-wrong
难度 2/5 1-3 小时 新手友好度 78/100
InauguralSystems/EigenScript#1387 ·
维护者通常 1 天内回复
-
area:stdlib kind:silent-wrong
难度 2/5 1-3 小时 新手友好度 86/100
InauguralSystems/EigenScript#1378 ·
维护者通常 1 天内回复
-
area:gates kind:gate-defect
难度 2/5 1-3 小时 新手友好度 78/100
InauguralSystems/EigenScript#1374 ·
维护者通常 1 天内回复
-
Error carets pad multi-byte UTF-8 byte-for-byte, so the ^ lands right of the token on a terminal未关闭area:lint-tooling kind:silent-wrong
难度 2/5 1-3 小时 新手友好度 84/100
InauguralSystems/EigenScript#1373 ·
维护者通常 1 天内回复
-
area:gates kind:docs-drift
难度 1/5 1 小时以内 新手友好度 88/100
InauguralSystems/EigenScript#1372 ·
维护者通常 1 天内回复
查看 InauguralSystems/EigenScript 的全部 Issue
相似的 Issue
-
feature request
难度 1/5 1 小时以内 新手友好度 86/100
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
FujiNetWIFI/fujinet-firmware#1730 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
-
难度 1/5 1 小时以内 新手友好度 92/100
-
category:port-update
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 2 天内回复