MCPcopy Create free account
hub / github.com/diem/move / execute

Method execute

language/move-prover/bytecode/src/read_write_set_analysis.rs:428–604  ·  view source on GitHub ↗
(&self, state: &mut Self::State, instr: &Bytecode, _offset: CodeOffset)

Source from the content-addressed store, hash-verified

426 const BACKWARD: bool = false;
427
428 fn execute(&self, state: &mut Self::State, instr: &Bytecode, _offset: CodeOffset) {
429 use Bytecode::*;
430 use Operation::*;
431
432 let func_env = &self.func_env;
433 match instr {
434 Call(_, rets, oper, args, _abort_action) => match oper {
435 BorrowField(_mid, _sid, _types, fld) => {
436 if state.locals.local_exists(args[0], func_env) {
437 state.assign_offset(rets[0], args[0], Offset::field(*fld), None, func_env);
438 }
439 }
440 ReadRef => {
441 if state.locals.local_exists(args[0], func_env) {
442 // rets[0] = args[0]
443 state.assign_local(rets[0], args[0], func_env)
444 }
445 }
446 WriteRef => {
447 state.record_access(args[0], Access::Write, func_env);
448 // *args[0] = args1
449 state.write_ref(args[0], args[1], func_env)
450 }
451 FreezeRef | BorrowLoc => state.assign_local(rets[0], args[0], func_env),
452 BorrowGlobal(mid, sid, types) => {
453 // borrow_global<T>(a). bind ret to a/T
454 let addrs = state
455 .locals
456 .get_local(args[0], func_env)
457 .expect("Unbound address local")
458 .clone();
459 let offset = Offset::global(mid, *sid, types.clone());
460 let mut extended_aps: AbsAddr = AbsAddr::default();
461 for p in addrs.iter() {
462 match p {
463 Addr::Footprint(ap) => {
464 let mut extended_ap = ap.clone();
465 extended_ap.add_offset(offset.clone());
466 extended_aps.insert(Addr::Footprint(extended_ap.clone()));
467 state.locals.update_access_path(extended_ap.clone(), None);
468 }
469 Addr::Constant(c) => {
470 let extended_ap = AccessPath::new_address_constant(
471 c.clone(),
472 mid,
473 *sid,
474 types.clone(),
475 );
476 extended_aps.insert(Addr::footprint(extended_ap));
477 }
478 }
479 }
480 state.locals.bind_local(rets[0], extended_aps, func_env)
481 }
482 MoveFrom(mid, sid, types) => {
483 state.add_global_access(args[0], mid, *sid, types, Access::Write, func_env);
484 state.remove_global(args[0], mid, *sid, types, func_env)
485 }

Callers

nothing calls this directly

Calls 15

fieldFunction · 0.85
call_native_functionFunction · 0.85
assign_offsetMethod · 0.80
record_accessMethod · 0.80
expectMethod · 0.80
update_access_pathMethod · 0.80
add_global_accessMethod · 0.80
remove_globalMethod · 0.80
qualifiedMethod · 0.80
get_functionMethod · 0.80
apply_summaryMethod · 0.80
get_identifierMethod · 0.80

Tested by

no test coverage detected