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

Method runTableInitOp

lib/executor/engine/tableInstr.cpp:49–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47}
48
49Expect<void>
50Executor::runTableInitOp(Runtime::StackManager &StackMgr,
51 Runtime::Instance::TableInstance &TabInst,
52 Runtime::Instance::ElementInstance &ElemInst,
53 const AST::Instruction &Instr) {
54 // Pop the length, source, and destination from the stack.
55 // Currently, the length and source offset from the element instance are
56 // 32-bit.
57 uint64_t Len = static_cast<uint64_t>(StackMgr.pop().get<uint32_t>());
58 uint64_t Src = static_cast<uint64_t>(StackMgr.pop().get<uint32_t>());
59 const auto AddrType = TabInst.getTableType().getLimit().getAddrType();
60 uint64_t Dst = extractAddr(StackMgr.pop(), AddrType);
61
62 // Replace tab[Dst : Dst + Len] with elem[Src : Src + Len].
63 return TabInst.setRefs(ElemInst.getRefs(), Dst, Src, Len)
64 .map_error([&Instr](auto E) {
65 spdlog::error(
66 ErrInfo::InfoInstruction(Instr.getOpCode(), Instr.getOffset()));
67 return E;
68 });
69}
70
71Expect<void>
72Executor::runElemDropOp(Runtime::Instance::ElementInstance &ElemInst) {

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected