pjh123
|
d2572682dc
|
fix: generator/async native 状态 session 字符串 GC 标记修复
|
2026-08-22 08:50:41 +08:00 |
|
pjh123
|
c66dd81134
|
perf: BigInt 参与回收——对齐字符串 GC 路径
- SessionGc 新增 live_bigints 集合,mark 阶段扫描根与对象边标记存活 BigInt
- process_edge 扩展 BigInt 值处理,scan_edges_for_mark 透传 live_bigints
- 新增 sweep_session_bigints:按存活标记清扫不活跃 BigInt box
- collect/collect_strings_only 收集流程接入 BigInt 清扫
- should_collect/should_collect_gc/should_collect_strings 纳入 BigInt 存在性判定
- for_each_value 新增 immutables_cache 根扫描,防止常量池 BigInt 被误回收
- 13 个 gc_runtime_tests 全部 PASS,无新增 clippy 警告
|
2026-08-22 08:46:00 +08:00 |
|
pjh123
|
8e47168168
|
perf: mark 边收集去临时 Vec、合并双遍遍历
|
2026-08-22 08:23:31 +08:00 |
|
pjh123
|
469ef7543b
|
perf: GC 字节账目补齐 + is_epoch_ptr O(1) + 分配热路径触发
|
2026-08-22 08:10:32 +08:00 |
|
pjh123
|
7c02d3ece1
|
feat: DisposableStack 内置对象(状态盒 + use/adopt/defer/dispose/move + GC 六处接线 + 绑定三时机)
|
2026-08-16 19:22:57 +08:00 |
|
pjh123
|
744899aae9
|
fix: for-of/for-in 提前退出时按规范顺序完成 IteratorClose
return/break/continue 逃出 for-of 时此前完全不执行 IteratorClose:
BREAK/CONTINUE/RETURN 指令现在经 ext 字携带词法逃出的迭代器层数
(for-of + for-in 各 16 位),运行时在全部 finally 穿越之后、真正
跳转/返回之前按 LIFO 关闭——与规范 §13.7.5.4(循环体完成值已含
内部 try-finally 处理,IteratorClose 在后)顺序一致。
- emit 词法:LabelCtx 增加 for-of/for-in 深度计数,loop/switch/label
打开时快照,break/continue/return 按当前深度减目标深度计算逃出层数
(switch 内 break 以 switch 打开点为基准,目标循环自身不计入)
- 指令编码:brk/cont/ret 三参构造,lower 跳转路径补发 ext 字
- 运行时:dispatch_break/continue/return 读取逃出计数,无 finally 时
直接关闭后跳转/返回,有 finally 时随 Completion 悬挂由 TRY_FINALLY_END
在穿越完成后消费;生成器 .return()/.throw() 注入经 complete_generator_return
全关快照栈迭代器;return() 抛错经 unwind 替代完成值并关闭剩余迭代器
- 顺带:for-in 逃出残留(无 return() 语义,仅弹栈);for-await-of 的
异步迭代器不做同步关闭(return() promise 须 await,走异步机制)
- 新增 15 项回归测试:return/labeled break/continue/switch/while/finally
顺序/抛错优先/生成器注入/for-in/for-await-of 嵌套
|
2026-08-16 09:31:39 +08:00 |
|
pjh123
|
2e16b63d9b
|
feat: for-of 迭代器栈条目化:迭代器与最近 next 结果配对存放
单一 last_for_of_result 槽被嵌套迭代覆盖,CLOSE 判定本迭代器是否
自然 done 时误读他者结果,导致数组解构/spread/嵌套 for-of 提前退出
漏调或误调 return()。改为栈条目 (iterator, last_result) 配对:
- IterState.for_of_iters 元素改 ForOfEntry,删除 last_for_of_result
- INIT 压条目,DONE 写本条目,NEXT/CLOSE 读本条目结果判 done
- GC mark/rewrite、inline save/restore、挂起帧快照同步配对遍历
- for-await-of 数组解构提前 break 现正确触发 return()(任务 40 样例)
|
2026-08-16 04:00:06 +08:00 |
|
pjh123
|
8c4b766e70
|
fix: 构造帧 super 状态改显式标志修复多层继承与 return 语义
derived 构造器 super 状态改由 CallFrame.super_called 显式标志承载,
取代依赖 regs[254] 值判定:多层继承中间 derived 帧由 SUPER_CALL 压入
this=构造对象,值判定三重失效(未调 super 不报错 / this-before-super
失效 / 合法 super() 误判 more-than-once)。父构造器正常返回经
construct_result_reg==Some(254) 识别置位调用方帧(该 ABI 不变量仅
SUPER_CALL 压帧满足),抛错走 unwind 不置位。
do_return 检查放宽为非对象返回值(含 undefined/null/原始值)且未调
super 时抛 ReferenceError(规范 §9.2.2.2),调过 super 回退构造 this。
super 构造器改取当前帧 callee 原型而非 newTarget 原型:newTarget 跨
SUPER_CALL 压帧保持为最外层类,取其原型在中间 derived 层解析回同一
父类导致无限压帧。
|
2026-08-16 01:23:52 +08:00 |
|
pjh123
|
0e32d663ce
|
fix: matchAll 空匹配推进至少一个字符,RegExp 补 GC 搬移深拷贝
matchAll 迭代器在空匹配(range.start == range.end)后把游标停在原位置,
同一位置反复空匹配导致死循环;改为按 UTF-8 字符边界推进(与 regress
find_iter 的 next_right_pos 一致),串尾空匹配把游标推到串长之后保证下轮
耗尽。
另修 RegExp 在 GC sweep 与 epoch 晋升中的指针别名:克隆只复制 native_fn 槽
的 Box 指针,源对象释放后克隆持悬垂指针,teardown 双重释放(heap 损坏)。
新增 clone_regexp_native 深拷贝已编译正则,sweep/promote 两处挂接,与
drop 配对保证单次释放。
|
2026-08-15 20:31:51 +08:00 |
|
pjh123
|
18aaa0fb0f
|
fix: Vm 增加 Drop 收尾释放全部 session 堆数据消除逐实例泄漏
test262 每测试新建 Vm 直接 drop,此前对象堆数据/串/BigInt/cell 全部
泄漏。新增 teardown 收尾函数(epoch+session 对象堆数据、串、BigInt、
cell 统一释放)供 full_reset 与 Drop 共用。连带补齐 promote 分支的
ArrayBuffer 字节缓冲深拷贝(与 sweep 对齐,消除共享所有权 double-free),
并修正依赖旧泄漏行为跨 Vm 解析字符串的 error 测试。
|
2026-08-15 19:13:51 +08:00 |
|
pjh123
|
9e8ee96491
|
fix: 生成器状态盒深拷贝消除 sweep/promote 共享所有权 UAF,full_reset 补释放 session 堆数据
GeneratorState 状态盒此前由 epoch 原对象独占释放,promote 与 sweep 克隆
浅拷贝 native_data 共享同一盒,旧对象 drop 即悬垂。新增 clone 深拷贝
(参照 async_generator),promote/sweep 两处接入,恢复执行读新盒;
full_reset 在 session arena 重置前遍历 session 对象释放堆数据,
配合深拷贝形成单所有权。补 sweep/promote/full_reset 三回归与
生成器捕获闭包跨 GC 回归。
|
2026-08-15 19:02:39 +08:00 |
|
pjh123
|
f81b7bca46
|
fix: upvalue cell 改独立堆分配消除 GC sweep 后悬垂
upvalue cell 原先分配于 session_epoch bump arena,对象 sweep 替换 arena
后旧 Bump drop,全部闭包 cell 悬垂:后续分配复用其内存导致 upvalue 值
被覆盖(私有字段 brand 检查跨语句误报、release 下可致 SIGSEGV)。
cell 改为 Box::into_raw 独立堆分配并登记进 session_cell_ptrs 追踪表,
与 arena 生命周期解耦:sweep 搬移对象时 cell 指针稳定,只重写
cell.value 中的对象引用;full_reset 统一释放,无 double-free。
|
2026-08-15 18:50:07 +08:00 |
|
pjh123
|
350b65c091
|
perf: 字符串 +/+= 二元拼接改 Cons rope 惰性扁平化消除 O(n²)
JsString 拆 Flat/Cons 变体:Cons 经独立 ConsNode 保存左右子节点 + O(1)
字节长 + 惰性扁平化产物缓存(OnceLock 原子发布,产物挂节点生命周期)。
concat_strings 接线:总长 ≤ 128B 的小链急切扁平(与 rope 前同款,拼接即
消费场景零开销),大链 O(1) 链接——大段重复拼接从 O(n²) 拷贝降为 O(n)
链接,文本在消费点(.length/==/string_ref/方法族)首次扁平化后缓存。
GC 兼容:mark 收口 mark_string_live 传播 Cons 子节点与产物闭包(显式栈
防深链爆栈);sweep/full_reset 共用 drop 辅助连带释放产物;节点字节记账
用 O(1) byte_len。rope 节点登记 session 字符串表,与执行期字符串 GC
(指令边界触发)天然兼容。JsString 结构 32B 与 rope 前同 bin,小串路径
零结构回退;unsafe impl Send/Sync 论证同 StringPtr(perm 恒 Flat)。
|
2026-08-15 14:32:08 +08:00 |
|
pjh123
|
517aef7fba
|
fix: release 构建下 debug 断言调用点补 cfg 守卫
collect_strings_only 中 debug 兜底断言调用点无 cfg 守卫,release
(无 debug_assertions)下方法不存在导致编译失败;与定义侧守卫对齐。
|
2026-08-15 14:31:43 +08:00 |
|
pjh123
|
a0788b363b
|
fix: 执行期字符串 GC 触发点移到指令边界,消除 builtin 局部活串悬垂
分配点触发会把仅存于 builtin 函数栈上局部 JsValue 与构造中未登记对象的
存活串判死释放(temporal 槽、regexp exec 构造中数组、replace 回调参数
Vec),长会话超阈值即悬垂。触发改在 dispatch 指令边界,此时所有局部值已
落地为执行根;分配点只留账目。水位采用上次收集存活字节加阈值增量,活串
超阈值时不会每指令重复白跑;reset 完整收集仍按阈值直接比较。debug 构建下
收集后断言存活对象字符串边已登记。补低阈值回归:regexp exec 旧行为直接
SIGABRT,temporal 与 replace 结果断言守护。
|
2026-08-15 13:20:04 +08:00 |
|
pjh123
|
e5d6d1e4d7
|
fix: strings-only 收集结尾清对象 mark 位,恢复完整收集 mark 不变量
collect_strings_only 只清位开头、mark 后不还原,残留 marked 对象会让
后续 reset 完整收集的 mark DFS 短路漏标其字符串边,存活串被误释放、
存活对象持悬垂指针。结尾与 sweep 同点 clear_all_marks 收尾,并补
strings-only 后接完整收集的回归(单测 + 集成,覆盖 global 子树串跨
reset 存活)。
|
2026-08-15 13:14:09 +08:00 |
|
pjh123
|
354ab2f192
|
perf: 执行期 session 字符串 GC 阈值回收(超 32MiB 触发,跳过对象 sweep)
new_string_owned 分配前做廉价阈值检查(1 次 usize 比较 + 阈值读取),
超 session_gc_threshold 即调 collect_strings_only:clear_all_marks →
完整 mark(现成)→ sweep_session_strings(现成),跳过对象 sweep 搬移,
builtin 层对象裸指针跨分配点零悬垂面。触发检查在登记之前——返回值
尚未根化,登记后回收会被本次 GC 判死致悬垂。分配前触发亦使 GC 期间
新串仍在栈上未登记,天然安全。
长循环字符串累积场景(REPL 常驻 / test262 长测试 / kernel_batch 复用)
session 内存从无界变为有界(≤ 阈值 + 存活串);bench gc_trigger_count
恢复有效(string_build 由 0 → 2 次触发)。07.2 rope 死节点回收依赖本机制。
|
2026-08-15 12:12:03 +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
|
aadc0a376d
|
fix: session_gc sweep 测试改读 rewrite 后新指针消除 UAF
|
2026-08-14 21:54:48 +08:00 |
|
pjh123
|
d8952a59fa
|
perf: 数组元素独立存储区,push 改为摊销 O(1) 尾插
|
2026-08-10 16:01:09 +08:00 |
|
pjh123
|
b95e7b1628
|
refactor: VM 统一 GC 遍历 for_each_value/rewrite_values(双子清单收敛三处手写清单)
|
2026-08-10 13:57:13 +08:00 |
|
pjh123
|
71c6c1532e
|
refactor: AsyncGeneratorState 收敛到 SuspendedFrame(save/restore/GC 遍历/string 边/深拷贝)
|
2026-08-10 13:49:05 +08:00 |
|
pjh123
|
d536617f23
|
refactor: AsyncState 收敛到 SuspendedFrame(save/restore/GC 遍历/string 边/深拷贝)
|
2026-08-10 13:36:34 +08:00 |
|
pjh123
|
9d18eb2533
|
refactor: GeneratorState 收敛到 SuspendedFrame(save/restore/GC 遍历/string 边)
|
2026-08-10 13:28:14 +08:00 |
|
pjh123
|
a1e6c27fa2
|
fix: GC 根清单补齐信号字段与 pending_completion 重写(收敛前置)
|
2026-08-10 13:00:15 +08:00 |
|
pjh123
|
5ced83e8c0
|
feat: async-generator 语义(async function*),yield/await 共存 + next 返回 Promise
- emit 识别 generator+async 组合,模块同时标记 is_generator/is_async
- 新增 AsyncGeneratorState:帧快照 + 请求队列 + 当前请求
- next/return/throw 返回 Promise,请求入队逐条处理
- YIELD 让出经 promise unwrap 后交付(yield rejected promise 关闭生成器)
- AWAIT 挂起保留当前请求,微任务恢复后继续执行
- %AsyncGeneratorPrototype% / %AsyncGeneratorFunction.prototype% 内建
- session GC / promote 支持异步生成器状态盒
- 普通 async 函数嵌套调用隔离外层异步生成器上下文
|
2026-08-10 01:52:03 +08:00 |
|
pjh123
|
fd47cd56d0
|
feat: async/await 语法支持(AWAIT 帧快照挂起/恢复 + 微任务驱动 + AsyncFunction intrinsics)
|
2026-08-09 22:02:15 +08:00 |
|
pjh123
|
538a5670dc
|
feat: Promise 基础子系统 + 微任务队列(resolve/reject/then/catch/finally + run() drain)
|
2026-08-09 21:08:53 +08:00 |
|
pjh123
|
783e89e4cb
|
feat: 生成器基础支持(YIELD 帧快照挂起/恢复 + GeneratorPrototype next/return/throw)
- 新增 YIELD/SUSPEND_BODY opcode;function* 识别与 yield emit
- GeneratorState 全量快照 VM 执行上下文(regs/pc/bytecode/spill/save/try/cell 栈段/迭代器)
- 调用时参数初始化(默认值/解构副作用与异常在 g() 时刻生效)
- %GeneratorPrototype%/%GeneratorFunction.prototype% 内建对象与 next/return/throw
- session GC trace 生成器状态 JsValues;闭包捕获分析补 yield/赋值目标扫描
|
2026-08-09 18:02:08 +08:00 |
|
pjh123
|
7a559978f0
|
feat: Set/Map 构造器接收可迭代实参 + size 访问器 + ES2024 set-methods
|
2026-08-08 18:01:00 +08:00 |
|
pjh123
|
bfcf132d73
|
feat: arguments 对象绑定(CREATE_ARGUMENTS + 帧实参 spill 区)
|
2026-08-08 00:01:22 +08:00 |
|
pjh123
|
31e28a03a6
|
docs: 补充注释与格式化
|
2026-08-06 23:10:27 +08:00 |
|
pjh123
|
fd267816f4
|
feat: 新增 MOV/SPILL/UNSPILL 执行语义 + spill 栈帧边界(D-06/D-07/D-08)
|
2026-08-06 16:51:01 +08:00 |
|
pjh123
|
263fd255b6
|
docs: 添加 Rustdoc 注释
|
2026-08-05 21:46:47 +08:00 |
|
pjh123
|
c58aae4862
|
feat: 搭建闭包捕获基础设施
|
2026-06-30 19:58:58 +08:00 |
|
pjh123
|
9c4a169c33
|
fix: for-in 整数索引升序+字符串插入序枚举,null/undefined 空遍历
|
2026-06-27 17:15:32 +08:00 |
|
pjh123
|
3e7c082293
|
feat: 为 VM 添加结构化日志
|
2026-06-26 20:50:05 +08:00 |
|
pjh123
|
e4abfd7599
|
refactor: 迁出日志宏,移除直接依赖
|
2026-06-26 18:53:48 +08:00 |
|
pjh123
|
f23d4e61b2
|
feat: 提取 oxide_builtins 独立 crate,泛型化 <H: VmHost>
|
2026-06-25 22:38:23 +08:00 |
|
pjh123
|
d195d7615c
|
refactor: Vm 状态分组、dispatch 拆分为分发表、IC 辅助函数独立成模块
|
2026-06-25 19:22:16 +08:00 |
|
pjh123
|
00c38ba5f9
|
feat: 迁移 NativeResult
|
2026-06-25 18:32:09 +08:00 |
|
pjh123
|
1cab5bde65
|
perf: 不可变常量改 OnceLock 一次性缓存,删 Constant 死变体并移出 GC 根
|
2026-06-25 14:32:49 +08:00 |
|
pjh123
|
12bfe551cf
|
perf: 寄存器保存改用共享 save_stack,消除 Box<[JsValue]> 堆分配
|
2026-06-24 22:20:34 +08:00 |
|
pjh123
|
967ac32378
|
feat: JsString 添加标记清除 GC
|
2026-06-24 21:15:31 +08:00 |
|
pjh123
|
ddffa8504e
|
refactor: 字符串值改用 JsString 指针表示,键与字面量改用 PermInterner
|
2026-06-24 20:15:15 +08:00 |
|
pjh123
|
9a62cf1610
|
perf: for_each_root 迭代器替代 gc_roots,复用 Vec DFS mark 栈消除每轮 GC 堆分配
|
2026-06-24 19:01:51 +08:00 |
|
pjh123
|
4535f70f80
|
fix: GC sweep 复用 Vm.forwarding,消除每轮 HashMap 分配
|
2026-06-24 15:59:55 +08:00 |
|
pjh123
|
f0da49a54c
|
fix: GC eprintln! 改为 vm_debug!,release 下零 stderr
|
2026-06-24 15:47:35 +08:00 |
|
pjh123
|
1815958b11
|
refactor: 清理未使用符号,合并bind_constructor宏,统一init/rebind绑定列表,bind_number改为表驱动
|
2026-06-24 12:12:44 +08:00 |
|
pjh123
|
69500513b3
|
fix: 修复同步调用参数限制与内建语义错误
|
2026-06-23 14:38:58 +08:00 |
|