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

Method runTableSetOp

lib/executor/engine/tableInstr.cpp:30–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28}
29
30Expect<void> Executor::runTableSetOp(Runtime::StackManager &StackMgr,
31 Runtime::Instance::TableInstance &TabInst,
32 const AST::Instruction &Instr) {
33 // Pop Ref from the stack.
34 RefVariant Ref = StackMgr.pop().get<RefVariant>();
35
36 // Pop Idx from the stack.
37 const auto AddrType = TabInst.getTableType().getLimit().getAddrType();
38 uint64_t Idx = extractAddr(StackMgr.pop(), AddrType);
39
40 // Set table[Idx] with Ref.
41 return TabInst.setRefAddr(Idx, Ref).map_error([&Instr, &Idx](auto E) {
42 spdlog::error(ErrInfo::InfoInstruction(Instr.getOpCode(), Instr.getOffset(),
43 {Idx},
44 {ValTypeFromType<uint32_t>()}));
45 return E;
46 });
47}
48
49Expect<void>
50Executor::runTableInitOp(Runtime::StackManager &StackMgr,

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected