pub struct VirtualMachine {
pub heap: Vec<u8>,
pub stack: Vec<VermilionObject>,
pub call_stack: Vec<i64>,
pub symbols: HashMap<i64, VermilionSymbol>,
pub sections: HashMap<i64, VermilionSection>,
pub pc: usize,
pub exit_code: Option<i64>,
}
Expand description
A Vermilion 2021 R2 compliant virtual machine.
Fields§
§heap: Vec<u8>
The memory accessible to the virtual machine. Due to restrictions in the Vermilion 2021 R2 specification, there is a maximum of 4 GB of memory available.
stack: Vec<VermilionObject>
The stack, as specified in the Vermilion 2021 R2 specification.
call_stack: Vec<i64>
A call stack, used for resolving where a return instruction should jump to.
symbols: HashMap<i64, VermilionSymbol>
The list of symbols accessible to the virtual machine.
sections: HashMap<i64, VermilionSection>
List of allocated memory sections
pc: usize
The program counter, the current position in memory that the virtual machine is reading bytecode from.
exit_code: Option<i64>
The exit code of the virtual machine.
Implementations§
Source§impl VirtualMachine
impl VirtualMachine
An implementation of the Vermilion 2021 R2 specification.
Sourcepub fn call_function_id(&mut self, id: i64)
pub fn call_function_id(&mut self, id: i64)
Calls a function based on its symbol ID.
Sourcepub fn call_function(&mut self, name: String)
pub fn call_function(&mut self, name: String)
Calls an internal function.
Auto Trait Implementations§
impl Freeze for VirtualMachine
impl RefUnwindSafe for VirtualMachine
impl Send for VirtualMachine
impl Sync for VirtualMachine
impl Unpin for VirtualMachine
impl UnwindSafe for VirtualMachine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more