| 47 | } |
| 48 | |
| 49 | Expect<void> |
| 50 | Executor::runTableInitOp(Runtime::StackManager &StackMgr, |
| 51 | Runtime::Instance::TableInstance &TabInst, |
| 52 | Runtime::Instance::ElementInstance &ElemInst, |
| 53 | const AST::Instruction &Instr) { |
| 54 | // Pop the length, source, and destination from the stack. |
| 55 | // Currently, the length and source offset from the element instance are |
| 56 | // 32-bit. |
| 57 | uint64_t Len = static_cast<uint64_t>(StackMgr.pop().get<uint32_t>()); |
| 58 | uint64_t Src = static_cast<uint64_t>(StackMgr.pop().get<uint32_t>()); |
| 59 | const auto AddrType = TabInst.getTableType().getLimit().getAddrType(); |
| 60 | uint64_t Dst = extractAddr(StackMgr.pop(), AddrType); |
| 61 | |
| 62 | // Replace tab[Dst : Dst + Len] with elem[Src : Src + Len]. |
| 63 | return TabInst.setRefs(ElemInst.getRefs(), Dst, Src, Len) |
| 64 | .map_error([&Instr](auto E) { |
| 65 | spdlog::error( |
| 66 | ErrInfo::InfoInstruction(Instr.getOpCode(), Instr.getOffset())); |
| 67 | return E; |
| 68 | }); |
| 69 | } |
| 70 | |
| 71 | Expect<void> |
| 72 | Executor::runElemDropOp(Runtime::Instance::ElementInstance &ElemInst) { |
nothing calls this directly
no test coverage detected