fix(native): canonical Number round-trip text for self-host parity - #168
Open
xingxuling wants to merge 7 commits into
Open
fix(native): canonical Number round-trip text for self-host parity#168xingxuling wants to merge 7 commits into
xingxuling wants to merge 7 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
中文摘要
修复 RCL native runtime 的
text(Number)只使用%.15g导致的 self-host 编译器浮点语义漂移,并同步重建受 source-hash 约束的 Windows 原生分发。根因
Self-host compiler 在解析 NUMBER 时会经过:
token text -> number_from_text -> text(number) -> LiteralExprJS runtime 的
text(Number)使用String(value);native VM 原实现使用snprintf("%.15g")。长小数因此损失 1-10 ULP,并同时造成:programRoot/sourceRoot连锁变化;sourceRoot本身在 native VM 中只做索引校验/输出,不参与 opcode 执行或 semantic state root;但这次 parity failure 不是纯 metadata,因为 Number Pool 中 9 个初始 MLP 参数也真实漂移。修复
native VM 现在:
Number::toString的 fixed/scientific 阈值规范化文本;-0规范化为0;NaN/Infinity文本语义。这不是把 parity gate 降级,而是修复 native 数字文本 ABI,使 self-host 输出重新和 JS canonical compiler 对齐。
新回归
tests/native-number-text-parity.test.mjs同时验证:text(number_from_text(...))与 JSString(Number(...))逐字一致;1e-6 / 1e-7 / 1e20 / 1e21 / 0.5000 / -0等边界;.rcl经 nativerclc与 JS reference compiler 再次产生整份 byte-identical RBC。Windows 原生分发
修改
native/rclvm.c后,旧 Windows prebuilt manifest 正确以source hash不一致拒绝旧二进制;没有绕过该保护。随后在 Windows runner + Zig 0.16.0 上重新构建并记录:
rclvm.exerclc.exerclvmd.exeprovider_demo.exerclfoundation.exelibrclvm.arclvm.dllrclvm.libnative-windows-manifest.json重建后
scripts/build-native.mjs的 prebuilt/source verification PASS。已执行验证
Ubuntu one-shot:
Windows rebuild runner:
DWAC v0.18 集成验证也已在 Ubuntu 直接恢复完整
.rcl -> native rclc -> RBC -> native rclvm -> register -> Live AIPASS,bytecode divergence diagnostic 不再触发。临时 one-shot patch/rebuild workflows 已删除,不进入主线。
权威边界