Skip to main content

Instruction

Enum Instruction 

Source
pub enum Instruction {
Show 37 variants LoadConst { dst: Register, constant: ConstantId, }, Move { dst: Register, src: Register, }, Unary { dst: Register, op: UnaryOp, operand: Register, }, Binary { dst: Register, op: BinaryOp, left: Register, right: Register, }, CreateObject { dst: Register, }, CreateArray { dst: Register, }, CreateCell { dst: Register, }, CreateClosure { dst: Register, function: FunctionId, captures: Register, }, GetProperty { dst: Register, object: Register, key: Register, }, SetProperty { object: Register, key: Register, value: Register, }, DeleteProperty { dst: Register, object: Register, key: Register, }, DefineAccessor { object: Register, key: Register, accessor: Register, kind: AccessorKind, }, Call { dst: Register, callee: Register, this_value: Register, arguments: Register, }, Construct { dst: Register, callee: Register, arguments: Register, }, LoadGlobal { dst: Register, name: ConstantId, }, StoreGlobal { name: ConstantId, value: Register, }, TypeOfGlobal { dst: Register, name: ConstantId, }, LoadThis { dst: Register, }, LoadArguments { dst: Register, }, LoadNewTarget { dst: Register, }, ArrayPush { array: Register, value: Register, }, ArrayExtend { array: Register, iterable: Register, }, ObjectSpread { target: Register, source: Register, }, SetPrototype { object: Register, prototype: Register, }, CreatePrivateName { dst: Register, description: ConstantId, }, CreateRegExp { dst: Register, pattern: ConstantId, flags: ConstantId, }, GetIterator { dst: Register, src: Register, kind: IteratorKind, }, IteratorNext { done: Register, value: Register, iterator: Register, }, Jump { target: Pc, }, JumpIfTrue { condition: Register, target: Pc, }, JumpIfFalse { condition: Register, target: Pc, }, Return { value: Register, }, Throw { value: Register, }, Suspend { dst: Register, src: Register, resume: Pc, }, Import { dst: Register, specifier: ConstantId, }, Export { name: ConstantId, src: Register, }, Halt,
}
Expand description

The production instruction algebra. Opcodes 0..=36 are stable wire tags.

Variants§

§

LoadConst

Load a constant into dst (refines the formal Load).

Fields

§constant: ConstantId
§

Move

Copy src into dst.

Fields

§

Unary

Apply a unary operator to operand, writing dst.

Fields

§operand: Register
§

Binary

Apply a binary operator (generalizes the formal Add), writing dst.

Fields

§right: Register
§

CreateObject

Create a fresh empty object in dst.

Fields

§

CreateArray

Create a fresh empty array in dst.

Fields

§

CreateCell

Create a compiler-private one-element array cell seeded with the runtime-only uninitialized sentinel.

Fields

§

CreateClosure

Materialize a closure over function, binding the captured cells held in the array register captures, into dst. The captured cells initialize the callee’s leading capture_count registers.

Fields

§function: FunctionId
§captures: Register
§

GetProperty

dst = object[key], with the property key taken from a register.

Fields

§object: Register
§

SetProperty

object[key] = value, with the property key taken from a register.

Fields

§object: Register
§value: Register
§

DeleteProperty

dst = delete object[key], with the property key taken from a register.

Fields

§object: Register
§

DefineAccessor

Install a getter or setter accessor under key on object.

Fields

§object: Register
§accessor: Register
§

Call

Call callee with receiver this_value and the dynamic argument array in arguments, writing the result to dst. Spread and any arity lower through the single arguments array.

Fields

§callee: Register
§this_value: Register
§arguments: Register
§

Construct

Construct with callee and the dynamic argument array in arguments, writing the instance to dst.

Fields

§callee: Register
§arguments: Register
§

LoadGlobal

dst = globalThis[name], where name is a string constant. Throws a ReferenceError at runtime for an undeclared global.

Fields

§

StoreGlobal

globalThis[name] = value, where name is a string constant.

Fields

§value: Register
§

TypeOfGlobal

dst = typeof globalThis[name], where name is a string constant. Yields "undefined" for an undeclared global rather than throwing.

Fields

§

LoadThis

Load the receiver binding this into dst.

Fields

§

LoadArguments

Load the arguments exotic object into dst.

Fields

§

LoadNewTarget

Load new.target into dst.

Fields

§

ArrayPush

Append value to the array in array.

Fields

§array: Register
§value: Register
§

ArrayExtend

Spread every element of iterable onto the end of the array in array.

Fields

§array: Register
§iterable: Register
§

ObjectSpread

Copy the own enumerable properties of source onto target ({ ...source }).

Fields

§target: Register
§source: Register
§

SetPrototype

Set the [[Prototype]] of object to prototype.

Fields

§object: Register
§prototype: Register
§

CreatePrivateName

Create a fresh private name described by the string constant description, writing it to dst. The result is used as a register key for private-field access via the property instructions.

Fields

§description: ConstantId
§

CreateRegExp

Create a RegExp from the string-constant pattern and flags.

Fields

§pattern: ConstantId
§

GetIterator

Acquire an iterator over src using protocol kind, writing it to dst.

§

IteratorNext

Advance iterator one step: write whether iteration is done to done and the produced value to value (two writes).

Fields

§value: Register
§iterator: Register
§

Jump

Unconditional control transfer (identical to the formal Jump).

Fields

§target: Pc
§

JumpIfTrue

Branch to target when condition is truthy, else fall through.

Fields

§condition: Register
§target: Pc
§

JumpIfFalse

Branch to target when condition is falsy, else fall through.

Fields

§condition: Register
§target: Pc
§

Return

Return value to the caller (terminator).

Fields

§value: Register
§

Throw

Throw value (terminator; caught by an enclosing handler if any).

Fields

§value: Register
§

Suspend

Yield src and resume at resume, receiving the resumed value in dst (refines the formal Suspend). See the module-level resume contract.

Fields

§resume: Pc
§

Import

Import the module named by the string constant specifier into dst.

Fields

§specifier: ConstantId
§

Export

Export the local value in src under the string constant name.

Fields

§

Halt

Terminate the current activation (identical to the formal Halt).

Trait Implementations§

Source§

impl Clone for Instruction

Source§

fn clone(&self) -> Instruction

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 Instruction

Source§

impl Debug for Instruction

Source§

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

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

impl Eq for Instruction

Source§

impl PartialEq for Instruction

Source§

fn eq(&self, other: &Instruction) -> 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 Instruction

Auto Trait Implementations§

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.