pub struct BytecodeGenerator<'a> { /* private fields */ }Expand description
Generates a sequence of bytecode instructions. This generator has:
instructions: A list of bytecode instructions to use for generationrng: A random number generator for uniform random choice of next instruction
Implementations
sourceimpl<'a> BytecodeGenerator<'a>
impl<'a> BytecodeGenerator<'a>
sourcepub fn new(rng: &'a mut StdRng) -> Self
pub fn new(rng: &'a mut StdRng) -> Self
The BytecodeGenerator is instantiated with a seed to use with
its random number generator.
sourcepub fn apply_instruction(
&self,
fn_context: &mut FunctionGenerationContext,
state: AbstractState,
bytecode: &mut Vec<Bytecode>,
instruction: Bytecode,
exact: bool
) -> Option<AbstractState>
pub fn apply_instruction(
&self,
fn_context: &mut FunctionGenerationContext,
state: AbstractState,
bytecode: &mut Vec<Bytecode>,
instruction: Bytecode,
exact: bool
) -> Option<AbstractState>
Transition an abstract state, state to the next state and add the instruction
to the bytecode sequence
sourcepub fn generate_block(
&mut self,
fn_context: &mut FunctionGenerationContext,
abstract_state_in: AbstractState,
abstract_state_out: AbstractState,
module: &CompiledModule
) -> Option<(Vec<Bytecode>, AbstractState)>
pub fn generate_block(
&mut self,
fn_context: &mut FunctionGenerationContext,
abstract_state_in: AbstractState,
abstract_state_out: AbstractState,
module: &CompiledModule
) -> Option<(Vec<Bytecode>, AbstractState)>
Given a valid starting state abstract_state_in, generate a valid sequence of
bytecode instructions such that abstract_state_out is reached.
sourcepub fn generate(
&mut self,
fn_context: &mut FunctionGenerationContext,
locals: &[SignatureToken],
fh: &FunctionHandle,
acquires_global_resources: &[StructDefinitionIndex],
module: &mut CompiledModule,
call_graph: &mut CallGraph
) -> Option<Vec<Bytecode>>
pub fn generate(
&mut self,
fn_context: &mut FunctionGenerationContext,
locals: &[SignatureToken],
fh: &FunctionHandle,
acquires_global_resources: &[StructDefinitionIndex],
module: &mut CompiledModule,
call_graph: &mut CallGraph
) -> Option<Vec<Bytecode>>
Generate the body of a function definition given a set of starting locals and a target
return signature. The sequence should contain at least target_min and at most
target_max instructions.
pub fn generate_module(
&mut self,
module: CompiledModule
) -> Option<CompiledModule>
sourcepub fn inhabit_with_bytecode_seq(
module: &mut InstantiableModule,
token: &SignatureToken
) -> Vec<Bytecode>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn inhabit_with_bytecode_seq(
module: &mut InstantiableModule,
token: &SignatureToken
) -> Vec<Bytecode>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Generate a sequence of instructions whose overall effect is to push a single value of type token on the stack, specifically without consuming any values that existed on the stack prior to the execution of the instruction sequence.
Trait Implementations
Auto Trait Implementations
impl<'a> RefUnwindSafe for BytecodeGenerator<'a>
impl<'a> Send for BytecodeGenerator<'a>
impl<'a> Sync for BytecodeGenerator<'a>
impl<'a> Unpin for BytecodeGenerator<'a>
impl<'a> !UnwindSafe for BytecodeGenerator<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more