remacs/remacs at a684a4c · static read-only analysis + GitHub API history · why-not-rust method 2.0remacs/remacs @ a684a4c · 静态只读分析 + GitHub API 历史 · why-not-rust 方法 2.0
Repository: github.com/remacs/remacs at commit a684a4c282f98fbe21df551030f1859f52f3ac6d, dated 2021-04-07, shallow clone, 3,847 tracked files. The fork's base is GNU Emacs 26.2.90 per configure.ac. Scope: the C core in src/ is the assessed target; rust_src/ is treated as the completed trial of the proposal. Sampling and counting basis: 88 tracked .rs files hold 30,133 lines. Of those, 3,308 lines across 15 files are port machinery — remacs-macros, remacs-bindings, remacs-util, remacs-lib/docfile.rs and lib.rs, build.rs, and inside rust_src/src the files remacs_sys.rs, lib.rs, ffi.rs, functions.rs, eval_macros.rs, vector_macros.rs and lisp.rs, plus alloc_unexecmacosx and lib-src/hashdir. The remaining 26,825 lines are converted Emacs behaviour. Against that, src/*.c is 309,205 lines across 119 files and src/*.h is 36,970 across 75. Every Rust-versus-C comparison here uses tracked-file wc -l on both sides, never a whole-tree total against a subtree. Rust is 1.5% of the 1,997,194 code-extension lines in the tree, counting .rs .c .h .el .m .java .py .sh; that percentage is reported with its denominator because it is easy to misread. Primitives: 666 #[lisp_fn] attributes in rust_src/src against 748 line-initial DEFUN in src/*.c, so 47% of Lisp-callable primitives had moved. Two DEFUN-shaped strings were excluded after inspection: one inside a comment block in alloc.c and one commented out in xml.c. Nine #[lisp_fn] matches in build.rs, docfile.rs and attributes.rs are tooling that scans for the attribute, not primitives, and are excluded. A further 51 primitives remain in Objective-C under src/*.m. Boundary cost: 919 unsafe occurrences, counted with grep -o rather than grep -c, across 66 of the 75 files in rust_src/src; 164 staticpro GC-root registrations in src/*.c; 9 unstable feature gates and a rust-toolchain pinned to nightly-2020-08-14. The generated/ directory holding bindgen output is gitignored, so the full FFI surface could not be measured and is recorded as a gap. File retirements were established by diffing git ls-files 'src/*.c' against the emacs-26.2 src tree fetched from the GitHub API: 126 files upstream, 119 here, of which five went to Rust and four went with dropped MS-DOS support. History facts — created 2016-11-22, merged pull requests of 318, 372, 197, 15 and 0 across 2017 to 2021, 902 merged in total, 268 contributors, last code commit 2020-08-17, README notice 2021-04-07, reset-to-emacs-27 last touched 2020-03-16 — come from the GitHub API, because the shallow clone makes git log unusable and the fork carries all of GNU Emacs's own commit history, which would contaminate any local per-year count. Maintainer statements are quoted from issues #1532 and #1571 with dates. Objective: no RFC was supplied and the project never stated a threshold, so D1 and G1 are recorded UNKNOWN rather than filled in. User-supplied facts: none. No Amdahl calculation appears, because the proposal stated no performance objective and converting a line share into a time share is a method error. The decision turns on G2, G3 and G4, all FAIL on measured facts and first-party maintainer statements, which is why the result is REJECT rather than DEFER-MEASURE despite G1 being UNKNOWN. Confidence is HIGH because this is an outcome rather than a forecast. No build, test, benchmark or network call was made against the project itself. This is a structured decision protocol, not a statistical predictor.仓库:github.com/remacs/remacs,commit a684a4c282f98fbe21df551030f1859f52f3ac6d,日期 2021-04-07,shallow clone,3,847 个纳管文件。按 configure.ac,分叉基线是 GNU Emacs 26.2.90。范围:评估对象是 src/ 里的 C 内核,rust_src/ 被当作这个提案已经跑完的试验。采样与计数口径:88 个纳管 .rs 文件共 30,133 行。其中 15 个文件、3,308 行是移植脚手架——remacs-macros、remacs-bindings、remacs-util、remacs-lib/docfile.rs 和 lib.rs、build.rs,以及 rust_src/src 里的 remacs_sys.rs、lib.rs、ffi.rs、functions.rs、eval_macros.rs、vector_macros.rs、lisp.rs,再加 alloc_unexecmacosx 和 lib-src/hashdir。剩下 26,825 行是转换过的 Emacs 行为。对面,src/*.c 是 119 个文件 309,205 行,src/*.h 是 75 个文件 36,970 行。本报告里所有 Rust 对 C 的比较,两边都用纳管文件的 wc -l,不拿整棵树的总数去比一个子树。Rust 占全树 1,997,194 行代码扩展名(.rs .c .h .el .m .java .py .sh)的 1.5%;这个百分比连分母一起给出,因为它很容易被读错。Primitive:rust_src/src 里 666 个 #[lisp_fn],对 src/*.c 里行首的 748 个 DEFUN,也就是 47% 的可被 Lisp 调用的 primitive 已经搬走。有两处形似 DEFUN 的字符串在人工检查后排除:一处在 alloc.c 的注释块里,一处在 xml.c 里被注释掉。build.rs、docfile.rs、attributes.rs 里另有 9 处 #[lisp_fn] 匹配,那是扫描这个属性的工具代码,不是 primitive,已排除。src/*.m 里还有 51 个 primitive 停在 Objective-C。边界成本:919 处 unsafe,用 grep -o 计数而不是 grep -c,分布在 rust_src/src 的 75 个文件里的 66 个;src/*.c 里 164 处 staticpro GC 根注册;9 个不稳定特性开关,rust-toolchain 钉在 nightly-2020-08-14。放 bindgen 产物的 generated/ 目录被 gitignore 掉了,完整的 FFI 面量不出来,作为证据缺口记录在案。文件退役是用 git ls-files 'src/*.c' 和 GitHub API 取回的 emacs-26.2 src 树做 diff 得到的:上游 126 个文件,这里 119 个,其中 5 个去了 Rust,4 个随 MS-DOS 支持一起走。历史数据——2016-11-22 建库,2017 到 2021 年合并 PR 分别为 318、372、197、15、0,累计 902,268 个贡献者,最后一次代码提交 2020-08-17,README 公告 2021-04-07,reset-to-emacs-27 最后一次改动 2020-03-16——都来自 GitHub API,因为 shallow clone 让 git log 用不了,而且这个分叉带着 GNU Emacs 自己全部的提交历史,本地按年统计会被污染。维护者的原话引自 issue #1532 和 #1571,都带日期。目标:没有人给出 RFC,项目自己也从未定过阈值,所以 D1 和 G1 记为 UNKNOWN,不去替它填。用户提供的事实:无。本报告没有 Amdahl 计算,因为提案没有提出性能目标,而把行数占比换算成时间占比是方法错误。决策落在 G2、G3、G4 上,这三道门都在实测事实和第一方维护者陈述上失败,所以结论是 REJECT 而不是 DEFER-MEASURE,尽管 G1 是 UNKNOWN。置信度 HIGH,因为这是一个已经发生的结果,不是预测。没有对项目本身做过任何构建、测试、基准或网络调用。这是一套结构化决策流程,不是统计预测器。
| What we don't know证据缺口 | What it would change会改变什么 |
| A build of remacs at this commit on current hardware在当前硬件上构建这个 commit 的 remacs | No build, test or benchmark was run. Every claim here is static structure, maintainer statement, or repository metadata. A working build would settle whether the macOS breakage is the collector problem or something else.没有做过任何构建、测试或基准。这里的每条主张要么是静态结构,要么是维护者的陈述,要么是仓库元数据。一个能跑起来的构建能确定 macOS 上的问题是收集器那件事还是别的。 |
| The size of the generated FFI surface生成出来的 FFI 面到底多大 | rust_src/.gitignore excludes generated/, so the bindgen output that remacs_sys.rs includes is not in the checkout. The interop surface is therefore larger than the 170 lines that are visible, by an amount this report cannot state.rust_src/.gitignore 把 generated/ 排除在外,所以 remacs_sys.rs 里 include 进来的 bindgen 产物不在检出目录里。互操作面因此比看得见的那 170 行更大,大多少,本报告说不出来。 |
| A root-cause classification of Emacs's own advisory history对 Emacs 自身安全公告做根因分类 | This would turn D1 from UNKNOWN into a stated requirement, and it would tell the leaf-extraction option which files to aim at first.这能把 D1 从 UNKNOWN 变成一条写明的需求,也能告诉叶子抽取方案该先打哪几个文件。 |