Struct ketos::bytecode::CodeBlock [] [src]

pub struct CodeBlock {
    pub jump: Option<(JumpInstruction, u32)>,
    pub next: Option<u32>,
    // some fields omitted
}

Contains a series of bytecode instructions

Fields

Jump instruction added to the end of the block

Refers to the block that immediately follows this block

Methods

impl CodeBlock
[src]

Creates an empty CodeBlock with a small reserved buffer.

Creates an empty CodeBlock without reserving data.

Returns the final size of the block, including all encoded instructions and final jump instruction. short indicates whether jump instruction offsets are encoded in short format.

If there is an unencoded instruction, its size is estimated.

Returns the size of all encoded instructions.

Returns whether any intruction was encoded.

Returns encoded bytecode data.

flush should be called first to ensure all instructions are encoded.

Returns whether the code block is mostly empty, permitting the compiler to prune it in some cases.

Sets the block which will immediately follow this block.

May only be called once.

Sets the jump instruction at the end of the block.

May only be called once.

Write stored jump instruction to buffer, if present.

Forcibly encodes a pending instruction. Does not encode a jump instruction.

Adds an instruction the block. The instruction may be stored until later to be merged into a combination instruction.

Trait Implementations

impl Debug for CodeBlock
[src]

Formats the value using the given formatter.