Commit Graph

108 Commits

Author SHA1 Message Date
pjh123 1ec72a832e docs: 修正结构哈希口径注释并展开编译管线黑话 2026-09-17 14:43:54 +00:00
pjh123 68d2974eb5 kernel/builtins/test262: 本批新码 clippy 三则 + fmt 归净——obfuscated_if_else(source_escape_to_key 值域判定改 if/else)、needless_range_loop(decode_uri_units 保留字符原样段改 extend_from_slice)、needless_borrows_for_generic_args(844f2f4 rename 调用两处冗余借用);fmt 漂移(compiler.rs/vm.rs 构造体折行)一并归净。七 crate clippy 零告警、fmt --check 净、七 crate 2879/1(唯一失败 compile_class_declaration 既有)、release 子集 8/8 + 2/2 终验 2026-09-14 08:18:38 +00:00
pjh123 6f70d7d09f vm/kernel/emit/builtins: 动态源编码重设计 + 数值键 2^32 边界 + 单元域解码/Source 面——14 头独占 test262 回归 13 修 0 新增
全量 A/B 差分撞出 14 个头独占回归,本提交闭合 13(text-self.js 双树同败归 pre-existing):

数值键 u32 回绕(release 态,debug 为 panic 故单测未现):canonical_index_str/
units 的 v.checked_mul(10)? + d as u32 在乘积合法而和溢出 2^32 时静默回绕
(10 位数字串 "4294967296".."4294967299" 误判整数键 0..3,属性查找回
退、Object.keys 串键),改 checked_mul+checked_add 双段防溢出;str/units 各
钉一枚 2^30-1/2^30/2^32-1/2^32 边界(Group B 5 文件:defineProperty/
defineProperties 2^32 键族 + Array property-cast-number)。

decodeURI/decodeURIComponent 单元域重写(Group A 2 文件):decode_uri_units
按单元扫描(非 % 单元原样透传——孤立 surrogate 往返不再被 lossy 串值面
打碎),%XX 解单元入缓冲;string_arg_units 经 to_units_full 取单元。

动态源编码(eval/Function/$262.evalScript)重设计(Group A 6 文件 + value-u):
source_escape 旧设计把源码域反斜杠恒双写(与 marker 起始区分),但源码即
JS 程序、反斜杠恒为字面量内转义序列起始,双写改变程序语义——
/\u{1d306}/u 变 /\\u{1d306}/u,u 模式撞裸 { 直接 SyntaxError(value-u 回归
根因)。现反斜杠原样透传;孤立 surrogate/FFFD 单元仍以 \\uXXXX 转义文本
注入(Rust str 无法承载裸孤立 surrogate,转义文本是唯一注入形态);
source_escape_to_key 逆路径仅还原注入 marker(\\ud800..\\udfff/\\ufffd
小写转义文本 → FFFD+hex4 池键形态,物化 decode_key 还原原始单元,正则
.source 按原始源返回;用户转义文本 \\u0041/\\u{1d306} 等逐字透传),
\\+marker 拼接形态(数据反斜杠紧邻注入,S7.8.5_A1.4 族 cu=d800 断言)按
前瞻还原 [数据反斜杠, 单元]。source_encoded 标志经 Compiler→Emitter→CompileCtx
(嵌套继承)贯通,仅动态编译入口置位;静态源切片维持 pool_key_plain 不变。

RegExp [[Source]]/[[Flags]] 单元域(regexp 构造器):to_units_full →
new_string_units_owned 入键(旧 lossy to_string 把孤立 surrogate 单元打成
FFFD,src_match 探针 false);regress 编译仍 lossy(既有缺口,另行报告)。

三并钉:source_escape marker 形态 / 反斜杠透传 / decode_key∘to_key∘escape
闭环(含 \\+marker 相邻与 astral 对)。实测:Group A 8/8、Group B 5/5、
value-u 1/1;8178 文件回归子集(13 目录)双树 A/B 差分 HEAD-only=∅、
13 文件转双树同 pass;text-self.js 双树同 compile 败
(requested module export is not exported: default)归 pre-existing;
七 crate 单测 2879/1(唯一失败 compile_class_declaration_emits_constructor
为 HEAD~0 既有,本提交未引入)。
2026-09-14 07:16:00 +00:00
pjh123 3f393b6acb fix: eval 脚本 var 声明落全局 configurable:true——is_eval_script 穿透 2026-09-09 19:17:57 +08:00
pjh123 355230b745 fix: REPL 变量跨轮次丢失 —— let/const 脚本顶层写全局对象 2026-08-21 22:44:48 +08:00
pjh123 d9acda7417 perf: 字节码调用压帧窗口按调用点存活上界拷贝减少整窗搬移
RegAlloc 改写后补第三次 liveness,为每条 CALL/NEW/SUPER_CALL 计算调用点
存活上界(最大存活物理槽号 + 1,254/255 由帧单独保存不计入),编码进
ext 高 8 位(nargs 低 8 位不变)。三处手写压帧窗口 = min(调用方活动寄存
器, 存活上界),restore_frame 按窗口回拷;CallFrame 新增
caller_active_reg_limit 保存调用方真实活动上限,恢复时不随截断窗口缩水。
生成器/异步函数体调用点保持全量窗口。spread 调用与运行时发起压帧
(accessor/内联)走全量路径不受影响。
2026-08-15 09:56:22 +08:00
pjh123 df23fdff39 feat: compiler/test262 runner 接线 + 模块顶层 this 绑定
- Compiler::compile_module:Emitter::emit_program_module → 统一 IR 管线(DCE/regalloc/lower/flatten)
- CompiledModule.is_es_module:VM run 时模块顶层 this=undefined(脚本仍为全局对象)
- 全局注册 __moduleLinkGet
- test262 runner:Test262ModuleLoader(相对路径解析 + import attributes 判定 json/text/bytes),is_module 走 compile_module
2026-08-12 17:37:33 +08:00
pjh123 8a53bfb584 feat: 编译管线/类型层 crate 补全多级日志宏 + 关键路径日志 2026-08-10 17:56:28 +08:00
pjh123 fd94ff6931 fix: 子模块全局扁平化根治逃逸闭包上下文错位 2026-08-07 10:49:15 +08:00
pjh123 31e28a03a6 docs: 补充注释与格式化 2026-08-06 23:10:27 +08:00
pjh123 d3385bc838 feat: 管线接入 liveness/精确DCE/RegAlloc + --no-regalloc flag(D-17/D-18) 2026-08-06 17:56:55 +08:00
pjh123 d1bfae2723 feat: Compiler 增加 enable_dce 字段与 with_dce 开关(D-10)
- unit struct 改带字段 struct,new() 默认开启 DCE
- compile 在 emit 与 lower 之间插入 oxide_dce::dce(nested 不递归 D-03)
- Cargo.toml 追加 oxide_dce path 依赖;dev 环经 resolver v2 解析通过
2026-08-06 11:45:26 +08:00
pjh123 263fd255b6 docs: 添加 Rustdoc 注释 2026-08-05 21:46:47 +08:00
pjh123 7c8f19f61a refactor: 拆分 oxide_emit 为独立 emit pass crate(依赖倒置) 2026-08-05 20:13:18 +08:00
pjh123 4f670eb7fd refactor: 拆分 oxide_ir 为独立 crate 2026-08-05 19:34:44 +08:00
pjh123 3ae2eeee42 refactor: 拆分闭包分析与预扫描模块,拆分函数体编译子步骤 2026-08-05 19:29:02 +08:00
pjh123 050f75c952 fix: 完善闭包捕获(cell 索引稳定、参数遮蔽、函数/类名捕获、b 槽立即数) 2026-08-05 19:19:29 +08:00
pjh123 179960ed75 fix: 重写闭包捕获分析为 AST 级,修复 MAKE_CELL 时序 2026-08-05 18:41:48 +08:00
pjh123 0028a1787e chore: 清理过时 dead_code 标注与空代码块 2026-08-05 18:26:46 +08:00
pjh123 76e650ce82 refactor: 抽取 assemble_ir 共用出口组装 2026-08-05 17:55:32 +08:00
pjh123 f34f791b9a refactor: 原子切换 emit 产出符号化 IR 2026-08-05 17:52:42 +08:00
pjh123 c250f5cb2b fix: 修复编译阶段缺失的预注册顶层 var 名步骤 2026-08-05 15:21:00 +08:00
pjh123 94576d60c5 fix: 编译阶段预扫描 builtin 避免寄存器分配问题 2026-08-05 13:28:51 +08:00
pjh123 77d11fb18c refactor: 单趟编译收尾 2026-08-05 10:27:30 +08:00
pjh123 489fe5e6bb refactor: 移除 class 计数辅助 2026-08-05 10:27:29 +08:00
pjh123 76fb0b5b88 refactor: 移除表达式计数辅助 2026-08-05 10:27:29 +08:00
pjh123 c4ea84bda1 refactor: 移除迭代计数辅助 2026-08-05 10:27:29 +08:00
pjh123 fd978b7ef8 refactor: 移除语句跳转计数辅助 2026-08-05 10:27:28 +08:00
pjh123 dfc14cfce9 refactor: 移除简单表达式计数辅助 2026-08-05 10:27:28 +08:00
pjh123 198bb7d428 refactor: 移除语句计数辅助 2026-08-05 10:27:28 +08:00
pjh123 c4ea281985 refactor: 模块编译改单趟完成 2026-08-05 00:49:13 +08:00
pjh123 b413bd7890 feat: 编译器新增延迟跳转 fixup 机制 2026-08-04 21:10:10 +08:00
pjh123 ea70e3965d refactor: 清除旧代码并展开 crate 2026-07-05 18:43:22 +08:00
pjh123 194d65c2b5 refactor: 拆分编译流水线过程以避免逻辑漂移 2026-07-05 14:41:08 +08:00
pjh123 435674d961 fix: 接通透传闭包值链路 2026-06-30 23:57:22 +08:00
pjh123 991e6040e5 fix: 修复闭包值传递链路 2026-06-30 22:52:25 +08:00
pjh123 655bc8516e fix: 分析时跳过继承作用域,避免将外层 var 误判为嵌套函数本地变量 2026-06-30 22:05:46 +08:00
pjh123 77a52bf7e8 fix: 修复嵌套函数调用并接通闭包捕获链路 2026-06-30 21:52:18 +08:00
pjh123 c9016ee662 style: 自动格式化 2026-06-30 20:49:56 +08:00
pjh123 f9449c52e3 fix: 修复嵌套函数调用并接通闭包捕获链路 2026-06-30 20:49:23 +08:00
pjh123 c58aae4862 feat: 搭建闭包捕获基础设施 2026-06-30 19:58:58 +08:00
pjh123 ccc527af71 fix: 顶层 count pass 镜像 emit 的函数提升顺序,消除跳转目标漂移导致的死循环 2026-06-30 16:01:00 +08:00
pjh123 8d23c83ce2 fix: 对齐 ?? 与静态成员复合赋值的 counter/emitter 计数,并加 projected_pc 断言 2026-06-27 21:07:16 +08:00
pjh123 03c9809c30 fix: 对齐 class 体 counter/emitter 指令条数,修私有方法、计算键、派生构造器字段注入位置的跳转漂移 2026-06-27 20:50:12 +08:00
pjh123 3794ae3fd5 fix: 对齐 counter/emitter 指令条数,修解构参数、数组赋值元素、解构catch、for-init 无初始化的跳转漂移 2026-06-27 20:32:33 +08:00
pjh123 f2002d6bae feat: 为 Array/String 原型方法添加入口和错误路径结构化日志,编译器添加阶段边界日志 2026-06-26 21:24:18 +08:00
pjh123 f7bcfd3846 refactor: CompileCtx 拆分为 LabelCtx/ScopeCtx,字面量域改用注册表入口 2026-06-25 19:46:35 +08:00
pjh123 1cab5bde65 perf: 不可变常量改 OnceLock 一次性缓存,删 Constant 死变体并移出 GC 根 2026-06-25 14:32:49 +08:00
pjh123 c378b92d1a feat: 增加 CreateClosure 字节码,函数字面量每次执行创建新闭包 2026-06-25 10:16:32 +08:00
pjh123 94405f50d7 refactor: 移除代码注释中的文档内部编号引用 2026-06-24 16:03:53 +08:00