MCPcopy Create free account
hub / github.com/MultiFuzz/MultiFuzz / get_loads

Method get_loads

hail-fuzz/src/load_resizer.rs:94–119  ·  view source on GitHub ↗
(
        &mut self,
        cpu: &mut Cpu,
        code: &BlockTable,
        block: usize,
    )

Source from the content-addressed store, hash-verified

92 }
93
94 pub fn get_loads(
95 &mut self,
96 cpu: &mut Cpu,
97 code: &BlockTable,
98 block: usize,
99 ) -> Result<Vec<(u64, LoadMetadata)>, Error> {
100 self.compute_load_usage(cpu, code, block)?;
101
102 let mut output = vec![];
103 let pcode = &code.blocks[block].pcode;
104
105 let mut current_pc = 0;
106 for (idx, stmt) in pcode.instructions.iter().enumerate() {
107 if stmt.op == pcode::Op::InstructionMarker {
108 current_pc = stmt.inputs.first().as_u64();
109 }
110
111 if let Some(metadata) = self.state.loads.values().find(|x| x.offset == idx) {
112 if metadata.required_bits() < stmt.output.size * 8 {
113 output.push((current_pc, metadata.clone()));
114 }
115 }
116 }
117
118 Ok(output)
119 }
120
121 /// Applies resize operations to all loads where upper bits are unused. Note: this approach is
122 /// unable to remove unused low bits from the operation, to allow the starting address to

Callers 3

injectMethod · 0.80
checkFunction · 0.80
check_multiblockFunction · 0.80

Calls 3

compute_load_usageMethod · 0.80
required_bitsMethod · 0.80
cloneMethod · 0.80

Tested by

no test coverage detected