| 110 | } |
| 111 | |
| 112 | Expect<void> |
| 113 | Executor::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 |
nothing calls this directly
no test coverage detected