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

Method runTableGrowOp

lib/executor/engine/tableInstr.cpp:101–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99}
100
101Expect<void>
102Executor::runTableGrowOp(Runtime::StackManager &StackMgr,
103 Runtime::Instance::TableInstance &TabInst) {
104 // Pop N for the growing size and Val for the initial reference value.
105 const auto AddrType = TabInst.getTableType().getLimit().getAddrType();
106 uint64_t N = extractAddr(StackMgr.pop(), AddrType);
107 RefVariant Ref = StackMgr.pop().get<RefVariant>();
108
109 // Grow size and push result.
110 const uint64_t CurrSize = TabInst.getSize();
111 if (TabInst.growTable(N, Ref)) {
112 StackMgr.push(emplaceAddr(CurrSize, AddrType));
113 } else {
114 StackMgr.push(emplaceAddr(static_cast<uint64_t>(-1), AddrType));
115 }
116 return {};
117}
118
119Expect<void>
120Executor::runTableSizeOp(Runtime::StackManager &StackMgr,

Callers

nothing calls this directly

Calls 7

extractAddrFunction · 0.85
emplaceAddrFunction · 0.85
getAddrTypeMethod · 0.80
popMethod · 0.80
growTableMethod · 0.80
pushMethod · 0.80
getSizeMethod · 0.45

Tested by

no test coverage detected