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

Method runMemoryFillOp

lib/executor/engine/memoryInstr.cpp:112–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110}
111
112Expect<void>
113Executor::runMemoryFillOp(Runtime::StackManager &StackMgr,
114 Runtime::Instance::MemoryInstance &MemInst,
115 const AST::Instruction &Instr) {
116 // Pop the length, value, and offset from the stack.
117 const auto AddrType = MemInst.getMemoryType().getLimit().getAddrType();
118 uint64_t Len = extractAddr(StackMgr.pop(), AddrType);
119 uint8_t Val = static_cast<uint8_t>(StackMgr.pop().get<uint32_t>());
120 uint64_t Off = extractAddr(StackMgr.pop(), AddrType);
121
122 // Fill data with Val.
123 return MemInst.fillBytes(Val, Off, Len).map_error([&Instr](auto E) {
124 spdlog::error(
125 ErrInfo::InfoInstruction(Instr.getOpCode(), Instr.getOffset()));
126 return E;
127 });
128}
129
130} // namespace Executor
131} // namespace WasmEdge

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected