fn candidate_instructions(
        &mut self,
        state: AbstractState,
        locals_len: usize,
    ) -> Vec<(StackEffect, Bytecode)> {
        let mut matches: Vec<(StackEffect, Bytecode)> = Vec::new();
        let instructions = &self.instructions;
        for (stack_effect, instruction) in instructions.iter() {
            let instruction: Bytecode = match instruction {
                BytecodeType::NoArg(instruction) => instruction.clone(),
                BytecodeType::U8(instruction) => {
                    // Generate a random index into the locals
                    let local_index: u8 = self.rng.gen_range(0, locals_len as u8);
                    instruction(local_index)
                }
                BytecodeType::U64(instruction) => {
                    // Generate a random u64 constant to load
                    let value = self.rng.gen_range(0, u64::max_value());
                    instruction(value)
                }
                BytecodeType::StringPoolIndex(instruction) => {
                    // TODO: Determine correct index
                    instruction(StringPoolIndex::new(0))
                }
                BytecodeType::AddressPoolIndex(instruction) => {
                    // TODO: Determine correct index
                    instruction(AddressPoolIndex::new(0))
                }
                BytecodeType::ByteArrayPoolIndex(instruction) => {
                    // TODO: Determine correct index
                    instruction(ByteArrayPoolIndex::new(0))
                }
            };
            let summary = summaries::instruction_summary(instruction.clone());
            let unsatisfied_preconditions = summary
                .preconditions
                .iter()
                .any(|precondition| !precondition(&state));
            if !unsatisfied_preconditions {
                matches.push((*stack_effect, instruction));
            }
        }
        matches
    }
/// Given an `AbstractState`, `state`, and a the number of locals the function has,
/// this function returns a list of instructions whose preconditions are satisfied for
/// the state.
Given an `AbstractState`, `state`, and a the number of locals the function has,
this function returns a list of instructions whose preconditions are satisfied for
the state.
Given an ` AbstractState ` ` state ` and a the number of locals the function has this function returns a list of instructions whose preconditions are satisfied for the state .
fn candidate_instructions(
        &mut self,
        state: AbstractState,
        locals_len: usize,
    ) -> Vec<(StackEffect, Bytecode)> {
        let mut matches: Vec<(StackEffect, Bytecode)> = Vec::new();
        let instructions = &self.instructions;
        for (stack_effect, instruction) in instructions.iter() {
            let instruction: Bytecode = match instruction {
                BytecodeType::NoArg(instruction) => instruction.clone(),
                BytecodeType::U8(instruction) => {
                    // Generate a random index into the locals
                    let local_index: u8 = self.rng.gen_range(0, locals_len as u8);
                    instruction(local_index)
                }
                BytecodeType::U64(instruction) => {
                    // Generate a random u64 constant to load
                    let value = self.rng.gen_range(0, u64::max_value());
                    instruction(value)
                }
                BytecodeType::StringPoolIndex(instruction) => {
                    // TODO: Determine correct index
                    instruction(StringPoolIndex::new(0))
                }
                BytecodeType::AddressPoolIndex(instruction) => {
                    // TODO: Determine correct index
                    instruction(AddressPoolIndex::new(0))
                }
                BytecodeType::ByteArrayPoolIndex(instruction) => {
                    // TODO: Determine correct index
                    instruction(ByteArrayPoolIndex::new(0))
                }
            };
            let summary = summaries::instruction_summary(instruction.clone());
            let unsatisfied_preconditions = summary
                .preconditions
                .iter()
                .any(|precondition| !precondition(&state));
            if !unsatisfied_preconditions {
                matches.push((*stack_effect, instruction));
            }
        }
        matches
    }
fn candidate_instructions ( & mut self , state : AbstractState , locals_len : usize , ) -> Vec < ( StackEffect , Bytecode ) > { let mut matches : Vec < ( StackEffect , Bytecode ) > = Vec :: new ( ) ; let instructions = & self . instructions ; for ( stack_effect , instruction ) in instructions . iter ( ) { let instruction : Bytecode = match instruction { BytecodeType :: NoArg ( instruction ) => instruction . clone ( ) , BytecodeType :: U8 ( instruction ) => { // Generate a random index into the locals let local_index : u8 = self . rng . gen_range ( 0 , locals_len as u8 ) ; instruction ( local_index ) } BytecodeType :: U64 ( instruction ) => { // Generate a random u64 constant to load let value = self . rng . gen_range ( 0 , u64 :: max_value ( ) ) ; instruction ( value ) } BytecodeType :: StringPoolIndex ( instruction ) => { // TODO: Determine correct index instruction ( StringPoolIndex :: new ( 0 ) ) } BytecodeType :: AddressPoolIndex ( instruction ) => { // TODO: Determine correct index instruction ( AddressPoolIndex :: new ( 0 ) ) } BytecodeType :: ByteArrayPoolIndex ( instruction ) => { // TODO: Determine correct index instruction ( ByteArrayPoolIndex :: new ( 0 ) ) } } ; let summary = summaries :: instruction_summary ( instruction . clone ( ) ) ; let unsatisfied_preconditions = summary . preconditions . iter ( ) . any ( | precondition | ! precondition ( & state ) ) ; if ! unsatisfied_preconditions { matches . push ( ( * stack_effect , instruction ) ) ; } } matches }
Given an `AbstractState`, `state`, and a the number of locals the function has,
this function returns a list of instructions whose preconditions are satisfied for
the state.
Given an ` AbstractState ` ` state ` and a the number of locals the function has this function returns a list of instructions whose preconditions are satisfied for the state .
&mut self
state
AbstractState
locals_len
usize
&mut self
state
AbstractState
locals_len
usize