#![allow(missing_docs)]
use std::sync::Arc;
use std::time::Duration;
use crate::bytecode::{CapId, Value};
use super::fault::Fault;
#[derive(Debug)]
pub enum VmResult {
Complete(Value),
Yield,
Sleep(Duration),
Spawn {
function: u32,
args: Vec<Value>,
dest_reg: u8,
requested_rights: crate::bytecode::CapRights,
},
SelfPid { dest_reg: u8 },
Send { target_cap: CapId, message: Value },
Receive {
dest_reg: u8,
timeout: Option<Duration>,
match_tag: Option<u16>,
match_request_id: Option<u64>,
match_payload_kind: Option<u8>,
match_payload_eq: Option<i64>,
match_payload_value: Option<Arc<Value>>,
match_payload_cmp: Option<(crate::bytecode::IntCmp, i64)>,
},
TableOpen { dest_reg: u8, name: Arc<str> },
TableGet {
dest_reg: u8,
cap: CapId,
key: Value,
},
TablePut {
cap: CapId,
key: Value,
value: Value,
},
SendRemote {
node: u64,
name: Arc<str>,
message: Value,
},
StartSupervisor { strategy: u8 },
Ask {
dest_reg: u8,
target_cap: CapId,
request: Value,
timeout: Option<Duration>,
},
Monitor { dest_reg: u8, target_cap: CapId },
Demonitor { monitor_reg: u8 },
Link { dest_reg: u8, target_cap: CapId },
Unlink { link_reg: u8 },
SetTrapExit { enabled: bool },
SetRestartPolicy { policy: u8 },
HostAwait { dest_reg: u8, op: u32, args: Value },
RegisterName { name: Arc<str> },
Whereis { dest_reg: u8, name: Arc<str> },
IsAlive { dest_reg: u8, target_cap: CapId },
ExitSignal { target_cap: CapId, reason: u64 },
StartChild {
dest_reg: u8,
function: u32,
policy: u8,
},
Delegate {
dest_reg: u8,
src_cap: CapId,
want_rights: crate::bytecode::CapRights,
want_native_cap: Option<CapId>,
},
Trap(Fault),
}