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

Method proxyMemGrow

lib/executor/engine/proxy.cpp:510–529  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

508}
509
510Expect<uint64_t> Executor::proxyMemGrow(Runtime::StackManager &StackMgr,
511 const uint32_t MemIdx,
512 const uint64_t NewSize) noexcept {
513 auto *MemInst = getMemInstByIdx(StackMgr, MemIdx);
514 assuming(MemInst);
515 const auto AddrType = MemInst->getMemoryType().getLimit().getAddrType();
516 const uint64_t CurrPageSize = MemInst->getPageSize();
517 if (MemInst->growPage(NewSize)) {
518 return CurrPageSize;
519 } else {
520 switch (AddrType) {
521 case AddressType::I32:
522 return static_cast<uint32_t>(-1);
523 case AddressType::I64:
524 return static_cast<uint64_t>(-1);
525 default:
526 assumingUnreachable();
527 }
528 }
529}
530
531Expect<uint64_t> Executor::proxyMemSize(Runtime::StackManager &StackMgr,
532 const uint32_t MemIdx) noexcept {

Callers

nothing calls this directly

Calls 3

getAddrTypeMethod · 0.80
getPageSizeMethod · 0.80
growPageMethod · 0.80

Tested by

no test coverage detected