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 警告
This commit is contained in:
2026-08-22 08:46:00 +08:00
parent 8e47168168
commit c66dd81134
2 changed files with 93 additions and 27 deletions
+9
View File
@@ -748,6 +748,15 @@ impl Vm {
for value in &self.regs {
f(*value);
}
// immutables 缓存含 session BigInt(new_bigint 分配),未入根则被 sweep 释放
// → 常量池加载时悬垂。perm 字符串无害(不在 session 集合中)。
for once_lock in &self.immutables_cache {
if let Some(immutable_vec) = once_lock.get() {
for &value in immutable_vec.iter() {
f(value);
}
}
}
for frame in &self.frames {
f(frame.saved_this);
f(frame.saved_new_target);