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

Method runTableGetOp

lib/executor/engine/tableInstr.cpp:9–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7namespace Executor {
8
9Expect<void> Executor::runTableGetOp(Runtime::StackManager &StackMgr,
10 Runtime::Instance::TableInstance &TabInst,
11 const AST::Instruction &Instr) {
12 // Pop Idx from the stack.
13 const auto AddrType = TabInst.getTableType().getLimit().getAddrType();
14 uint64_t Idx = extractAddr(StackMgr.pop(), AddrType);
15
16 // Get table[Idx] and push it to the stack.
17 return TabInst.getRefAddr(Idx)
18 .map_error([&Instr, &Idx](auto E) {
19 spdlog::error(ErrInfo::InfoInstruction(Instr.getOpCode(),
20 Instr.getOffset(), {Idx},
21 {ValTypeFromType<uint32_t>()}));
22 return E;
23 })
24 .and_then([&](auto Ref) -> Expect<void> {
25 StackMgr.push(Ref);
26 return {};
27 });
28}
29
30Expect<void> Executor::runTableSetOp(Runtime::StackManager &StackMgr,
31 Runtime::Instance::TableInstance &TabInst,

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected