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

Method runMemoryGrowOp

lib/executor/engine/memoryInstr.cpp:20–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18}
19
20Expect<void>
21Executor::runMemoryGrowOp(Runtime::StackManager &StackMgr,
22 Runtime::Instance::MemoryInstance &MemInst) {
23 // Pop N, the number of pages to grow.
24 const auto AddrType = MemInst.getMemoryType().getLimit().getAddrType();
25 uint64_t N = extractAddr(StackMgr.pop(), AddrType);
26
27 // Grow the page and push the result.
28 const uint64_t CurrPageSize = MemInst.getPageSize();
29 if (MemInst.growPage(N)) {
30 StackMgr.push(emplaceAddr(CurrPageSize, AddrType));
31 } else {
32 StackMgr.push(emplaceAddr(static_cast<uint64_t>(-1), AddrType));
33 }
34 return {};
35}
36
37Expect<void> Executor::runMemoryInitOp(
38 Runtime::StackManager &StackMgr, Runtime::Instance::MemoryInstance &MemInst,

Callers

nothing calls this directly

Calls 7

extractAddrFunction · 0.85
emplaceAddrFunction · 0.85
getAddrTypeMethod · 0.80
popMethod · 0.80
getPageSizeMethod · 0.80
growPageMethod · 0.80
pushMethod · 0.80

Tested by

no test coverage detected