Commit Graph

424 Commits

Author SHA1 Message Date
爱特每羊队 eb65a26142 fix(cfg): 无条件 JMP 后继位置切成块头,修复跳转边丢失
Pass 1 仅对条件跳转切 fallthrough 后继,无条件 JMP 与其后指令
融块导致块尾判定错、Jump 边丢失,DCE 可达性误删 break 出口块
(label 悬空报 'Label not found')。JMP 后继同样置块头。
2026-08-06 12:16:58 +08:00
爱特每羊队 be52064765 test(compiler): compile_multiple_stmts 锚按 D-11 放宽为存在性断言
DCE 默认开启删除死 '1; 2' 链的 LOAD_CONST,仅剩顶层值 '3'。
精确计数断言 load_count >= 3 实测失败,放宽为 any(LOAD_CONST)。
2026-08-06 12:16:51 +08:00
爱特每羊队 1a235f748b feat(cli): compile 子命令新增 --no-dce flag 透传 Compiler(D-10)
- Commands::Compile 追加 #[arg(long)] no_dce 字段
- compile(expr, file, no_dce) 按 flag 选择 Compiler::new().with_dce(false)
- eval/run/repl 走默认 enable_dce=true 不变
2026-08-06 11:48:30 +08:00
爱特每羊队 bbba23b93a feat(compiler): 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
爱特每羊队 319610ec7b test(dce): 新增运行时等价对比集成测试(D-08 主验证)
- parse→emit→(dce 开/关)→lower→Vm::run 双管线对比
- 覆盖语句丢弃/重复赋值/if(false)/死闭包/try-catch/对象算术/顶层返回值/先调用后丢弃/const 重赋值
2026-08-06 11:43:39 +08:00
爱特每羊队 7c87953b63 test(dce): 补全 Pass C 单测与不动域断言(D-13/D-14/D-04/D-03)
- pass_c_sweep 尾部加 debug_assert 越界防御(T-04-03,空尾块映射合法透传)
- 存活 label 新旧下标对应、死 label 置 None、原 None 保持
- 空函数退化、幂等性(dce 两次一致)
- label_count/n_registers/constants/nested 不动断言
2026-08-06 11:35:58 +08:00
爱特每羊队 1a8e7ca9f5 feat(dce): 实现 Pass A 可达性 + Pass B use 计数迭代删除
- Pass A 消费 build_cfg,entry 沿 succs DFS(含 Exception 边保守,Pitfall 4)展开指令粒度 keep
- Pass B 可达存活指令聚合 use 计数,def 无 use 且 is_pure 迭代删至不动点(D-02 连锁)
- Pass C 最小 mark-sweep 重建 insts + label_pos 重映射(死 label 置 None)
- 依赖 oxide_bytecode(测试需 OpCode 常量,Rust 无 crate 传递可见性,与 oxide_cfg 骨架一致)
- 单测 8 条:死链/负例/STORE_VAR 特判/if-else/死块/Exception 保守/死闭包/连锁
2026-08-06 11:33:27 +08:00
爱特每羊队 c2a64a2df8 feat(dce): 新建 oxide_dce crate 骨架并接入 workspace
- workspace.members 在 oxide_cfg 后追加 crates/oxide_dce
- Cargo.toml 骨架照抄 oxide_cfg(oxide_ir + oxide_cfg 依赖,dev-deps parser/emit/vm)
- lib.rs 中文文档头 + pub fn dce 入口(空函数退化先例,非空路径 Task 2/3 骨架)
2026-08-06 11:27:44 +08:00
爱特每羊队 d33ec31532 feat(ir): 实现 is_pure 精确纯表(Pattern 1 全表 + LOAD_VAR/STORE_VAR 特判) 2026-08-06 10:50:18 +08:00
爱特每羊队 c7b5df23ea test(ir): 新增 is_pure 纯表单测(Pattern 1 各族正负例 + 特判分支) 2026-08-06 10:49:08 +08:00
爱特每羊队 2e74124ba0 feat(ir): 实现 def_reg/use_regs 寄存器扫描契约(Pattern 2 全表) 2026-08-06 10:47:56 +08:00
爱特每羊队 69d139af74 test(ir): 新增 def_reg/use_regs 契约单测(Pattern 2 反直觉槽位) 2026-08-06 10:45:10 +08:00
爱特每羊队 a9f63b9200 refactor(cfg): 拆分 build_cfg 四阶段为独立模块纯函数链 2026-08-06 01:10:56 +08:00
爱特每羊队 e66e247ea5 fix(vm): 修复 date_to_json 测试时区敏感断言(UTC+8 下用显式 UTC 时间戳) 2026-08-06 01:05:56 +08:00
爱特每羊队 f2e0bef405 test(cfg): 新增真实编译产物集成回归锚(parse→emit→build_cfg) 2026-08-06 00:49:07 +08:00
爱特每羊队 8711b51af7 fix(emit): 修复 clippy 阻塞(doc comment 空行 + single_match_else) 2026-08-06 00:45:49 +08:00
爱特每羊队 1bd7a82e8f feat(cfg): 新建 oxide_cfg crate(BB 划分 + CFG 构建 pass) 2026-08-06 00:45:48 +08:00
爱特每羊队 91badd6af9 fix(test262): 修复 main.rs:20 悬空 doc comment 恢复 workspace 构建 2026-08-06 00:39:33 +08:00
爱特每羊队 f461235f04 docs: 添加 Rustdoc 注释 2026-08-05 21:46:47 +08:00
爱特每羊队 bbdfca1a1c refactor(compiler): 拆分 oxide_emit 为独立 emit pass crate(依赖倒置) 2026-08-05 20:13:18 +08:00
爱特每羊队 9f02985a82 refactor(ir): 拆分 oxide_ir 为独立 crate 2026-08-05 19:34:44 +08:00
爱特每羊队 b93847564e refactor(compiler): 拆分闭包分析与预扫描模块,拆分函数体编译子步骤 2026-08-05 19:29:02 +08:00
爱特每羊队 b611e26f11 fix(compiler): 完善闭包捕获(cell 索引稳定、参数遮蔽、函数/类名捕获、b 槽立即数) 2026-08-05 19:19:29 +08:00
爱特每羊队 3390b61453 fix(compiler): 重写闭包捕获分析为 AST 级,修复 MAKE_CELL 时序 2026-08-05 18:41:48 +08:00
爱特每羊队 845ba2884a chore(compiler): 清理过时 dead_code 标注与空代码块 2026-08-05 18:26:46 +08:00
爱特每羊队 f12c2a451e test(ir): 补 IR 结构测试 2026-08-05 18:03:21 +08:00
爱特每羊队 28ccfce1b7 test(compiler): 补薄弱域字节码断言测试 2026-08-05 18:01:42 +08:00
爱特每羊队 3931d2062e refactor(compiler): 抽取 assemble_ir 共用出口组装 2026-08-05 17:55:32 +08:00
爱特每羊队 1c328f5081 refactor(compiler): 原子切换 emit 产出符号化 IR 2026-08-05 17:52:42 +08:00
爱特每羊队 097153ec08 feat(ir): 实现 IRFunction 到字节码的 lowering 转换 2026-08-05 17:24:35 +08:00
爱特每羊队 2a3a9a1412 feat(ir): 新增 Operand/Inst/IRFunction 类型系统与构造 API 2026-08-05 17:17:51 +08:00
爱特每羊队 c9e4248a02 fix: 修复不符合 JS 语义约束的错误行为测试 2026-08-05 15:44:22 +08:00
爱特每羊队 22f1275f6b fix: 修复编译阶段缺失的预注册顶层 var 名步骤 2026-08-05 15:21:00 +08:00
爱特每羊队 0d16d509b2 fix: 逐个按顺序处理 field 与 block 以符合 JS 类元素源码顺序语义 2026-08-05 15:04:44 +08:00
爱特每羊队 211cbe2f5d fix: 编译阶段预扫描 builtin 避免寄存器分配问题 2026-08-05 13:28:51 +08:00
爱特每羊队 8ee6781795 refactor(compiler): finalize single pass compilation 2026-08-05 10:27:30 +08:00
爱特每羊队 0f78f341fa refactor(compiler): remove class count helpers 2026-08-05 10:27:29 +08:00
爱特每羊队 fd4172203e refactor(compiler): remove expression count helpers 2026-08-05 10:27:29 +08:00
爱特每羊队 b8bb208825 refactor(compiler): remove iteration count helpers 2026-08-05 10:27:29 +08:00
爱特每羊队 4a2bf09f78 refactor(compiler): remove statement jump count helpers 2026-08-05 10:27:28 +08:00
爱特每羊队 faa326c039 refactor(compiler): remove simple expression count helpers 2026-08-05 10:27:28 +08:00
爱特每羊队 3ce7fd587d refactor(compiler): remove statement count helpers 2026-08-05 10:27:28 +08:00
爱特每羊队 638da1f481 refactor(compiler): compile modules in one pass 2026-08-05 00:49:13 +08:00
爱特每羊队 f4897c30bc refactor(compiler): resolve logical assignments through fixups 2026-08-05 00:42:02 +08:00
爱特每羊队 01bcde2656 refactor(compiler): emit optional chain jumps through fixups 2026-08-05 00:38:11 +08:00
爱特每羊队 58b998a32d refactor(compiler): emit logical jumps through fixups 2026-08-05 00:34:39 +08:00
爱特每羊队 510a0dd96e refactor(compiler): emit loop jumps through fixups 2026-08-05 00:30:45 +08:00
爱特每羊队 ff400c47c2 refactor(compiler): emit control jumps through fixups 2026-08-05 00:24:12 +08:00
爱特每羊队 ac818b0821 feat(compiler): add deferred jump fixups 2026-08-04 21:10:10 +08:00
爱特每羊队 3389fe40ef refactor: 拆分 class 相关编译逻辑 2026-07-05 19:13:58 +08:00