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

Method arraySet

lib/executor/engine/refInstr.cpp:555–569  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

553}
554
555Expect<void> Executor::arraySet(Runtime::StackManager &StackMgr,
556 const RefVariant &Ref, const ValVariant &Val,
557 const uint32_t TypeIdx,
558 const uint32_t Idx) const noexcept {
559 auto *Inst = Ref.getPtr<Runtime::Instance::ArrayInstance>();
560 if (Inst == nullptr) {
561 return Unexpect(ErrCode::Value::AccessNullArray);
562 }
563 if (Idx >= Inst->getLength()) {
564 return Unexpect(ErrCode::Value::ArrayOutOfBounds);
565 }
566 const auto &VType = getArrayStorageTypeByIdx(StackMgr, TypeIdx);
567 Inst->getData(Idx) = packVal(VType, Val);
568 return {};
569}
570
571Expect<void> Executor::arrayFill(Runtime::StackManager &StackMgr,
572 const RefVariant &Ref, const ValVariant &Val,

Callers

nothing calls this directly

Calls 3

UnexpectFunction · 0.85
getLengthMethod · 0.80
getDataMethod · 0.45

Tested by

no test coverage detected