feat: notify Endor objects of mount lifecycle transitions
Verify Tessera GUI / verify (push) Failing after 7m23s

This commit is contained in:
2026-10-21 02:29:46 +08:00
parent 8886bdbd2d
commit d2f167e71f
10 changed files with 373 additions and 49 deletions
+3 -23
View File
@@ -2,9 +2,8 @@
//! function sequences calls, so all handlers share one execution budget.
use crate::{block, mount::Mount, ui_bridge::attach_desktop_type};
use endor_core::{
CodeLayout, ContextNativeFunction, EndorCode, EndorCodeObject, Instruction, NativeCallable,
NativeContext, NativeResult, ObjectPayload, ObjectRef, Opcode, Value, Vm, VmError,
WeakObjectRef,
ContextNativeFunction, NativeCallable, NativeContext, NativeResult, ObjectPayload, ObjectRef,
Value, Vm, VmError, WeakObjectRef,
};
const MAX_DELIVERIES: usize = 10_000;
@@ -407,26 +406,7 @@ pub fn dispatch(
vec![event_ref, guard],
))?;
calls.push(finish);
let mut instructions = Vec::with_capacity(calls.len() * 4 + 1);
for index in 0..calls.len() {
instructions.push(Instruction::new(Opcode::LoadConst, index as u32));
instructions.push(Instruction::simple(Opcode::PushNull));
instructions.push(Instruction::new(Opcode::Call, 0));
if index + 1 != calls.len() {
instructions.push(Instruction::simple(Opcode::PopTop));
}
}
instructions.push(Instruction::simple(Opcode::ReturnValue));
let code = EndorCode::from_instructions(
&instructions,
calls.into_iter().map(Value::Object).collect(),
CodeLayout::default(),
)?
.with_location("<event dispatch>", "<tessera>", 1);
let code = cx.allocate(EndorCodeObject::new(code))?;
let globals = cx.new_dict()?;
let driver = cx.new_function("event dispatch", code, globals)?;
attach_desktop_type(cx, driver, "Function", desktop)?;
let driver = crate::vm_sequence::build(cx, calls, "<event dispatch>", desktop)?;
event.dispatch = Some(cx.store().downgrade(guard)?);
event.group = 0;
event.stopped_at = None;