| 516 | } |
| 517 | |
| 518 | Expect<RefVariant> |
| 519 | Executor::arrayNewElem(Runtime::StackManager &StackMgr, const uint32_t TypeIdx, |
| 520 | const uint32_t ElemIdx, const uint32_t Start, |
| 521 | const uint32_t Length) const noexcept { |
| 522 | const auto &VType = getArrayStorageTypeByIdx(StackMgr, TypeIdx); |
| 523 | auto *ElemInst = getElemInstByIdx(StackMgr, ElemIdx); |
| 524 | assuming(ElemInst); |
| 525 | auto ElemSrc = ElemInst->getRefs(); |
| 526 | if (static_cast<uint64_t>(Start) + static_cast<uint64_t>(Length) > |
| 527 | ElemSrc.size()) { |
| 528 | return Unexpect(ErrCode::Value::TableOutOfBounds); |
| 529 | } |
| 530 | std::vector<ValVariant> Refs(ElemSrc.begin() + Start, |
| 531 | ElemSrc.begin() + Start + Length); |
| 532 | Runtime::Instance::ModuleInstance *ModInst = |
| 533 | const_cast<Runtime::Instance::ModuleInstance *>(StackMgr.getModule()); |
| 534 | WasmEdge::Runtime::Instance::ArrayInstance *Inst = |
| 535 | ModInst->newArray(TypeIdx, packVals(VType, std::move(Refs))); |
| 536 | return RefVariant(Inst->getDefType(), Inst); |
| 537 | } |
| 538 | |
| 539 | Expect<ValVariant> Executor::arrayGet(Runtime::StackManager &StackMgr, |
| 540 | const RefVariant &Ref, |
nothing calls this directly
no test coverage detected