refactor: 收集路径原地化退役移动式sweep与门控

This commit is contained in:
2026-10-01 09:06:23 +00:00
parent 1711ae948b
commit 5c8699733d
14 changed files with 309 additions and 573 deletions
+1 -10
View File
@@ -697,20 +697,11 @@ fn async_state_mut(obj: &JsObject) -> Option<&mut AsyncState> {
None
} else {
// SAFETY: native_data 在 create_async_context 中由 Box::into_raw 分配,
// 生命周期与异步上下文对象一致;GC 路径(mark 边收集、执行期门控扫描)只读状态盒。
// 生命周期与异步上下文对象一致;GC 路径(mark 边收集)只读状态盒。
Some(unsafe { &mut *ptr })
}
}
/// 异步挂起帧是否持有 for-in 迭代器:执行期收集门控按指针扫描
/// (迭代器体是堆上 Box,门控是保守门)。
pub(crate) fn async_holds_suspended_for_in(obj: &JsObject) -> bool {
let Some(state) = async_state_mut(obj) else {
return false;
};
!state.suspended.for_in_iters.is_empty()
}
/// 异步状态内全部引用边的扁平列表(GC mark 边):对象/字符串/BigInt 均产出,
/// 消费侧按值类型分发到对象栈与存活集。
pub(crate) fn async_native_edges(obj: &JsObject) -> Vec<JsValue> {