Skip to main content

RegOp

Enum RegOp 

Source
pub enum RegOp {
Show 34 variants Mov { dst: u16, src: u16, }, LoadConst { dst: u16, k: u32, }, LoadGlobal { dst: u16, slot: u32, }, StoreGlobal { slot: u32, src: u16, }, LoadUpvalue { dst: u16, idx: u32, }, StoreUpvalue { idx: u32, src: u16, }, Bin { op: BinKind, dst: u16, lhs: u16, rhs: u16, }, Un { op: UnKind, dst: u16, src: u16, }, Cmp { op: CmpKind, dst: u16, lhs: u16, rhs: u16, }, CmpImm { op: CmpKind, dst: u16, lhs: u16, imm: i64, }, BinImm { op: BinKind, dst: u16, lhs: u16, imm: i64, }, Jump { target: u32, }, JumpIfFalse { target: u32, cond: u16, }, JumpIfTrue { target: u32, cond: u16, }, Call { dst: u16, func: u16, args: u16, argc: u8, }, TailCall { func: u16, args: u16, argc: u8, }, Ret { src: u16, }, GetProp { dst: u16, obj: u16, name: u32, }, SetProp { obj: u16, name: u32, src: u16, }, Invoke { dst: u16, obj: u16, name: u32, args: u16, argc: u8, }, BuildArr { dst: u16, start: u16, count: u16, }, BuildMap { dst: u16, start: u16, count: u16, }, IndexGet { dst: u16, obj: u16, idx: u16, }, IndexSet { obj: u16, idx: u16, src: u16, }, CreateClass { dst: u16, k: u32, }, CreateInstance { dst: u16, class: u16, args: u16, argc: u8, }, MakeClosure { dst: u16, func: u16, upvals: u16, count: u8, }, Wrap { kind: WrapKind, dst: u16, src: u16, }, Unwrap { kind: WrapKind, dst: u16, flag: u16, src: u16, }, TryQ { dst: u16, src: u16, }, Argc { dst: u16, }, CallChunk { dst: u16, chunk: u32, args: u16, argc: u8, }, Nop, Halt { src: u16, },
}
Expand description

Three-address register instruction. Registers are u16 indices into a flat frame-local register file. Constants live in the chunk const table.

Variants§

§

Mov

dst = src

Fields

§dst: u16
§src: u16
§

LoadConst

dst = constants[k]

Fields

§dst: u16
§

LoadGlobal

dst = globals[slot]

Fields

§dst: u16
§slot: u32
§

StoreGlobal

globals[slot] = src

Fields

§slot: u32
§src: u16
§

LoadUpvalue

dst = upvalues[idx]

Fields

§dst: u16
§idx: u32
§

StoreUpvalue

upvalues[idx] = src

Fields

§idx: u32
§src: u16
§

Bin

dst = lhs <op> rhs

Fields

§dst: u16
§lhs: u16
§rhs: u16
§

Un

dst = <op> src

Fields

§dst: u16
§src: u16
§

Cmp

dst = lhs <cmp> rhs

Fields

§dst: u16
§lhs: u16
§rhs: u16
§

CmpImm

dst = lhs <cmp> imm (fused int immediate)

Fields

§dst: u16
§lhs: u16
§imm: i64
§

BinImm

dst = lhs <op> imm

Fields

§dst: u16
§lhs: u16
§imm: i64
§

Jump

Unconditional jump to instruction index target (in this chunk).

Fields

§target: u32
§

JumpIfFalse

Jump if cond register is falsy.

Fields

§target: u32
§cond: u16
§

JumpIfTrue

Jump if cond register is truthy.

Fields

§target: u32
§cond: u16
§

Call

dst = call(func, args[argc]) — args live in consecutive registers.

Fields

§dst: u16
§func: u16
§args: u16
§argc: u8
§

TailCall

Tail call: same as Call but reuses the frame.

Fields

§func: u16
§args: u16
§argc: u8
§

Ret

return src

Fields

§src: u16
§

GetProp

dst = obj.name

Fields

§dst: u16
§obj: u16
§name: u32
§

SetProp

obj.name = src

Fields

§obj: u16
§name: u32
§src: u16
§

Invoke

dst = obj.name(args[argc])

Fields

§dst: u16
§obj: u16
§name: u32
§args: u16
§argc: u8
§

BuildArr

dst = [regs[start] .. start+count)

Fields

§dst: u16
§start: u16
§count: u16
§

BuildMap

dst = { k/v pairs from regs[start] .. }

Fields

§dst: u16
§start: u16
§count: u16
§

IndexGet

dst = obj[idx]

Fields

§dst: u16
§obj: u16
§idx: u16
§

IndexSet

obj[idx] = src

Fields

§obj: u16
§idx: u16
§src: u16
§

CreateClass

Class / instance helpers (operand carries the same meaning as stack IR).

Fields

§dst: u16
§

CreateInstance

Fields

§dst: u16
§class: u16
§args: u16
§argc: u8
§

MakeClosure

Fields

§dst: u16
§func: u16
§upvals: u16
§count: u8
§

Wrap

dst = wrap(src) for Ok/Err/Some

Fields

§dst: u16
§src: u16
§

Unwrap

Unwrap Ok/Err/Some: dst = inner (bool success in flag)

Fields

§dst: u16
§flag: u16
§src: u16
§

TryQ

? operator: dst = inner or early-return

Fields

§dst: u16
§src: u16
§

Argc

Current frame argc (for default-parameter prologues)

Fields

§dst: u16
§

CallChunk

Call a known chunk by index (lowered from stack CallDirect).

Fields

§dst: u16
§chunk: u32
§args: u16
§argc: u8
§

Nop

No-op

§

Halt

Stop and return src

Fields

§src: u16

Trait Implementations§

Source§

impl Clone for RegOp

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for RegOp

Source§

impl Debug for RegOp

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for RegOp

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for RegOp

Auto Trait Implementations§

§

impl Freeze for RegOp

§

impl RefUnwindSafe for RegOp

§

impl Send for RegOp

§

impl Sync for RegOp

§

impl Unpin for RegOp

§

impl UnsafeUnpin for RegOp

§

impl UnwindSafe for RegOp

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.