Files
not-python2/src/vm/inst.rs

33 lines
909 B
Rust
Raw Normal View History

use crate::obj::ObjPtr;
use crate::vm::name::Name;
#[derive(Debug, Clone)]
pub enum Inst {
/// Pushes an object to the stack.
Push(ObjPtr),
/// Loads a local value in a name and pushes it to the stack.
Load(Name),
/// Pops the top item off of the stack and stores it in a name.
Store(Name),
/// Get an attribute from the top item of the stack.
GetAttr(String),
/// Pops the top item off of the stack, discarding it.
Pop,
/// Pops the top N function arguments off the stack, and attempt to call the
/// next stack item.
Call(usize),
/// Exits the current function stack frame and returns control to the
/// calling function.
///
/// This will take the last value on top of the stack (the return value),
/// resize the stack to its last size (pre-call), and push the return value
/// back to the top of the stack.
Return,
}