refactor: realm 与 Vm 生命周期解耦,Vm 持 Arc<Realm>

This commit is contained in:
2026-10-07 01:35:16 +00:00
parent 14ef287a75
commit c6bc93a076
39 changed files with 796 additions and 676 deletions
+5 -1
View File
@@ -103,7 +103,11 @@ pub trait VmHost {
// 内核访问器
fn kernel_core(&self) -> &Arc<KernelCore>;
fn session(&self) -> &KernelSession;
/// 只读访问当前 session(builtin world 与 global object)。
///
/// 返回 `Ref` 守卫(session 入 `RefCell` 后无法再给稳定 `&`):调用方
/// 在单表达式内消费,不跨 `borrow_mut` 长存。
fn session(&self) -> std::cell::Ref<'_, KernelSession>;
// 属性解析
fn property_key_si(&mut self, val: JsValue) -> u32;