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

Method execute

language/move-prover/bytecode/src/borrow_analysis.rs:526–644  ·  view source on GitHub ↗
(&self, state: &mut BorrowInfo, instr: &Bytecode, code_offset: CodeOffset)

Source from the content-addressed store, hash-verified

524 const BACKWARD: bool = false;
525
526 fn execute(&self, state: &mut BorrowInfo, instr: &Bytecode, code_offset: CodeOffset) {
527 use Bytecode::*;
528 let livevar_annotation_at = self
529 .livevar_annotation
530 .get_live_var_info_at(code_offset)
531 .expect("livevar annotation");
532 match instr {
533 Assign(_, dest, src, kind) => {
534 let dest_node = self.borrow_node(*dest);
535 let src_node = self.borrow_node(*src);
536 match kind {
537 AssignKind::Move | AssignKind::Store => {
538 self.remap_borrow_node(state, &src_node, &dest_node);
539 state.moved_nodes.insert(src_node);
540 }
541 AssignKind::Copy => {
542 state.add_node(dest_node.clone());
543 state.add_edge(src_node, dest_node, BorrowEdge::Direct);
544 }
545 }
546 }
547 Call(id, dests, oper, srcs, _) => {
548 use Operation::*;
549 match oper {
550 // In the borrows below, we only create an edge if the
551 // borrowed value is actually alive. For a dead borrow we would
552 // otherwise never end live time, because we cannot see a node
553 // being created and dying at the very same instruction.
554 BorrowLoc if livevar_annotation_at.after.contains(&dests[0]) => {
555 let dest_node = self.borrow_node(dests[0]);
556 let src_node = self.borrow_node(srcs[0]);
557 state.add_node(dest_node.clone());
558 state.add_edge(src_node, dest_node, BorrowEdge::Direct);
559 }
560 BorrowGlobal(mid, sid, inst)
561 if livevar_annotation_at.after.contains(&dests[0]) =>
562 {
563 let dest_node = self.borrow_node(dests[0]);
564 let src_node = BorrowNode::GlobalRoot(QualifiedInstId {
565 module_id: *mid,
566 id: *sid,
567 inst: inst.to_owned(),
568 });
569 state.add_node(dest_node.clone());
570 state.add_edge(src_node, dest_node, BorrowEdge::Direct);
571 }
572 BorrowField(mid, sid, inst, field)
573 if livevar_annotation_at.after.contains(&dests[0]) =>
574 {
575 let dest_node = self.borrow_node(dests[0]);
576 let src_node = self.borrow_node(srcs[0]);
577 state.add_node(dest_node.clone());
578 state.add_edge(
579 src_node,
580 dest_node,
581 BorrowEdge::Field(mid.qualified_inst(*sid, inst.to_owned()), *field),
582 );
583 }

Callers

nothing calls this directly

Calls 15

FieldClass · 0.85
native_annotationFunction · 0.85
expectMethod · 0.80
get_live_var_info_atMethod · 0.80
borrow_nodeMethod · 0.80
remap_borrow_nodeMethod · 0.80
add_nodeMethod · 0.80
to_ownedMethod · 0.80
qualified_instMethod · 0.80
get_function_qidMethod · 0.80
qualifiedMethod · 0.80

Tested by

no test coverage detected