| 76 | } |
| 77 | |
| 78 | Expect<void> |
| 79 | Executor::runTableCopyOp(Runtime::StackManager &StackMgr, |
| 80 | Runtime::Instance::TableInstance &TabInstDst, |
| 81 | Runtime::Instance::TableInstance &TabInstSrc, |
| 82 | const AST::Instruction &Instr) { |
| 83 | // Pop the length, source, and destination from the stack. |
| 84 | const auto AddrType1 = TabInstSrc.getTableType().getLimit().getAddrType(); |
| 85 | const auto AddrType2 = TabInstDst.getTableType().getLimit().getAddrType(); |
| 86 | uint64_t Len = extractAddr(StackMgr.pop(), std::min(AddrType1, AddrType2)); |
| 87 | uint64_t Src = extractAddr(StackMgr.pop(), AddrType2); |
| 88 | uint64_t Dst = extractAddr(StackMgr.pop(), AddrType1); |
| 89 | |
| 90 | // Replace tab_dst[Dst : Dst + Len] with tab_src[Src : Src + Len]. |
| 91 | return TabInstSrc.getRefs(0, Src + Len) |
| 92 | .and_then( |
| 93 | [&](auto Refs) { return TabInstDst.setRefs(Refs, Dst, Src, Len); }) |
| 94 | .map_error([&Instr](auto E) { |
| 95 | spdlog::error( |
| 96 | ErrInfo::InfoInstruction(Instr.getOpCode(), Instr.getOffset())); |
| 97 | return E; |
| 98 | }); |
| 99 | } |
| 100 | |
| 101 | Expect<void> |
| 102 | Executor::runTableGrowOp(Runtime::StackManager &StackMgr, |
nothing calls this directly
no test coverage detected