MCPcopy Create free account
hub / github.com/asymptotic-code/sui-prover / execute

Method execute

crates/move-stackless-bytecode/src/usage_analysis.rs:219–273  ·  view source on GitHub ↗
(&self, state: &mut Self::State, code: &Bytecode, _offset: CodeOffset)

Source from the content-addressed store, hash-verified

217 const BACKWARD: bool = false;
218
219 fn execute(&self, state: &mut Self::State, code: &Bytecode, _offset: CodeOffset) {
220 use Bytecode::*;
221 use Operation::*;
222 use PropKind::*;
223
224 match code {
225 // memory accesses in operations
226 Call(_, _, oper, _, _) => match oper {
227 Function(mid, fid, inst)
228 | OpaqueCallBegin(mid, fid, inst)
229 | OpaqueCallEnd(mid, fid, inst) => {
230 let callee_id = mid.qualified(*fid);
231 if let Some(summary) = self
232 .cache
233 .get::<UsageState>(callee_id, &FunctionVariant::Baseline)
234 {
235 state.subsume_callee(summary, inst);
236 }
237 }
238 MoveTo(mid, sid, inst)
239 | MoveFrom(mid, sid, inst)
240 | BorrowGlobal(mid, sid, inst) => {
241 let mem = mid.qualified_inst(*sid, inst.to_owned());
242 state.add_direct_modified(mem);
243 }
244 WriteBack(BorrowNode::GlobalRoot(mem), _) => {
245 state.add_direct_modified(mem.clone());
246 }
247 Exists(mid, sid, inst) | GetGlobal(mid, sid, inst) => {
248 let mem = mid.qualified_inst(*sid, inst.to_owned());
249 state.add_direct_accessed(mem);
250 }
251 _ => {}
252 },
253 // memory accesses in expressions
254 Prop(_, kind, _exp) => match kind {
255 // Assume => state.add_direct_assumed_iter(
256 // exp.used_memory(self.cache.global_env())
257 // .into_iter()
258 // .map(|(usage, _)| usage),
259 // ),
260 Assume => {}
261 // Assert => state.add_direct_asserted_iter(
262 // exp.used_memory(self.cache.global_env())
263 // .into_iter()
264 // .map(|(usage, _)| usage),
265 // ),
266 Assert => {}
267 Modifies => {
268 // do nothing, as the `modifies` memories are captured by other sets
269 }
270 },
271 _ => {}
272 }
273 }
274}
275pub struct UsageProcessor();
276

Callers 2

execute_blockMethod · 0.45
state_per_instructionMethod · 0.45

Calls 4

qualifiedMethod · 0.80
subsume_calleeMethod · 0.80
qualified_instMethod · 0.80
cloneMethod · 0.45

Tested by

no test coverage detected