Enum sage::vm::StandardOp
source · pub enum StandardOp {
Show 23 variants
CoreOp(CoreOp),
Set(Vec<f64>),
Alloc,
Free,
ToInt(usize),
ToFloat(usize),
Add(usize),
Sub(usize),
Mul(usize),
Div(usize),
Rem(usize),
Neg(usize),
IsNonNegative(usize),
Sin(usize),
Cos(usize),
Tan(usize),
ASin(usize),
ACos(usize),
ATan(usize),
Pow(usize),
Peek,
Poke,
Call(FFIBinding),
}
Expand description
An individual standard virtual machine instruction.
Variants§
CoreOp(CoreOp)
Execute a core instruction.
Set(Vec<f64>)
Set the register equal to a constant floating point value.
Alloc
Take the value of the register, and allocate that number of cells in memory. Set the register to the lowest address of the allocated memory.
Free
Free the memory pointed to by the register.
ToInt(usize)
Convert the register from a float to an integer.
ToFloat(usize)
Convert the register from an integer to a float.
Add(usize)
Add the value pointed to on the tape to the register (as floats).
Sub(usize)
Subtract the value pointed to on the tape from the register (as floats).
Mul(usize)
Multiply the register by the value pointed to on the tape (as floats).
Div(usize)
Divide the register by the value pointed to on the tape (as floats).
Rem(usize)
Store the remainder of the register and the value pointed to in the tape (as floats) into the register.
Neg(usize)
Negate the value of the register (as a float).
IsNonNegative(usize)
Make the register equal to the integer 1 if the register (as a float) is not negative, otherwise make it equal to 0.
Sin(usize)
Store the sine of the register (as a float) into the register. The argument is the size of the register vector.
Cos(usize)
Store the cosine of the register (as a float) into the register.
Tan(usize)
Store the tangent of the register (as a float) into the register.
ASin(usize)
Store the inverse-sine of the register (as a float) into the register.
ACos(usize)
Store the inverse-cosine of the register (as a float) into the register.
ATan(usize)
Store the inverse-tangent of the register (as a float) into the register.
Pow(usize)
Store the value of the register (as a float) to the power of the value pointed to on the tape (as a float) into the register.
Peek
Get a value from the input interface / device and store it in the register. This is intended to function something like system calls for using any external functionality that can’t be implemented in the virtual machine, such as I/O or OS operations.
Whenever a value is returned from the foreign function interface, it is stored in the FFI buffer of cells. Whenever an FFI function is called, it will receive its arguments from this buffer.
Poke
Write the value of the register to the output interface / device. This is intended to function something like system calls for using any external functionality that can’t be implemented in the virtual machine, such as I/O or OS operations.
Whenever a value is returned from the foreign function interface, it is stored in the FFI buffer of cells. Whenever an FFI function is called, it will receive its arguments from this buffer.
Call(FFIBinding)
Call a foreign function interface function.
Trait Implementations§
source§impl Clone for StandardOp
impl Clone for StandardOp
source§fn clone(&self) -> StandardOp
fn clone(&self) -> StandardOp
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for StandardOp
impl Debug for StandardOp
source§impl Display for StandardOp
impl Display for StandardOp
source§impl PartialEq for StandardOp
impl PartialEq for StandardOp
source§fn eq(&self, other: &StandardOp) -> bool
fn eq(&self, other: &StandardOp) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for StandardOp
impl PartialOrd for StandardOp
source§fn partial_cmp(&self, other: &StandardOp) -> Option<Ordering>
fn partial_cmp(&self, other: &StandardOp) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more