MCPcopy Create free account
hub / github.com/WasmEdge/WasmEdge / runTableCopyOp

Method runTableCopyOp

lib/executor/engine/tableInstr.cpp:78–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76}
77
78Expect<void>
79Executor::runTableCopyOp(Runtime::StackManager &StackMgr,
80 Runtime::Instance::TableInstance &TabInstDst,
81 Runtime::Instance::TableInstance &TabInstSrc,
82 const AST::Instruction &Instr) {
83 // Pop the length, source, and destination from the stack.
84 const auto AddrType1 = TabInstSrc.getTableType().getLimit().getAddrType();
85 const auto AddrType2 = TabInstDst.getTableType().getLimit().getAddrType();
86 uint64_t Len = extractAddr(StackMgr.pop(), std::min(AddrType1, AddrType2));
87 uint64_t Src = extractAddr(StackMgr.pop(), AddrType2);
88 uint64_t Dst = extractAddr(StackMgr.pop(), AddrType1);
89
90 // Replace tab_dst[Dst : Dst + Len] with tab_src[Src : Src + Len].
91 return TabInstSrc.getRefs(0, Src + Len)
92 .and_then(
93 [&](auto Refs) { return TabInstDst.setRefs(Refs, Dst, Src, Len); })
94 .map_error([&Instr](auto E) {
95 spdlog::error(
96 ErrInfo::InfoInstruction(Instr.getOpCode(), Instr.getOffset()));
97 return E;
98 });
99}
100
101Expect<void>
102Executor::runTableGrowOp(Runtime::StackManager &StackMgr,

Callers

nothing calls this directly

Calls 9

extractAddrFunction · 0.85
InfoInstructionClass · 0.85
getAddrTypeMethod · 0.80
popMethod · 0.80
setRefsMethod · 0.80
errorFunction · 0.50
getRefsMethod · 0.45
getOpCodeMethod · 0.45
getOffsetMethod · 0.45

Tested by

no test coverage detected