feat: BroadcastChannel 内核接线两 P 字段加 BuiltinId 加脏家族位加注册表字段

This commit is contained in:
2026-10-09 04:26:22 +00:00
parent a84f430739
commit dd373ef3f0
11 changed files with 82 additions and 26 deletions
+1
View File
@@ -143,6 +143,7 @@ impl oxide_runtime_api::VmHost for Vm {
ProtoKind::BigInt64ArrayConstructor => &world.bigint64array_constructor,
ProtoKind::BigUint64ArrayConstructor => &world.biguint64array_constructor,
ProtoKind::MessagePortProto => &world.message_port_proto,
ProtoKind::BroadcastChannelProto => &world.broadcast_channel_proto,
};
P::as_ptr(p) as *mut JsObject
}
+5
View File
@@ -61,6 +61,11 @@ pub(crate) struct GcState {
/// 开启后每个顶层指令边界做一次完整收集,与强制收集共用同一安全点入口,
/// 同时跳过两个水位触发的档(完整收集已涵盖其全部工作)。
pub(crate) gc_pressure_mode: bool,
/// BroadcastChannel per-realm 弱引用注册表:通道名 → 通道对象裸指针列表
/// (弱引用,不保活)。构造器分配后登记、close 注销、GC sweep 按 mark 位
/// 剪枝。当前仅声明,不填不读(登记与剪枝由后续任务接线)。
#[allow(dead_code)]
pub(crate) broadcast_channels: HashMap<String, Vec<*mut JsObject>>,
}
impl GcState {
+2
View File
@@ -101,6 +101,7 @@ impl Vm {
gc_watermark: gc_threshold,
pending_forced_collect: false,
gc_pressure_mode: gc_pressure_mode_from_env(),
broadcast_channels: std::collections::HashMap::new(),
}),
symbols: RefCell::new(SymbolState {
symbol_descriptions: Vec::new(),
@@ -257,6 +258,7 @@ impl Vm {
gc_watermark: gc_threshold,
pending_forced_collect: false,
gc_pressure_mode: gc_pressure_mode_from_env(),
broadcast_channels: std::collections::HashMap::new(),
}),
symbols: RefCell::new(SymbolState {
symbol_descriptions: Vec::new(),