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

Method arrayGet

lib/executor/engine/refInstr.cpp:539–553  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

537}
538
539Expect<ValVariant> Executor::arrayGet(Runtime::StackManager &StackMgr,
540 const RefVariant &Ref,
541 const uint32_t TypeIdx,
542 const uint32_t Idx,
543 const bool IsSigned) const noexcept {
544 const auto *Inst = Ref.getPtr<Runtime::Instance::ArrayInstance>();
545 if (Inst == nullptr) {
546 return Unexpect(ErrCode::Value::AccessNullArray);
547 }
548 if (Idx >= Inst->getLength()) {
549 return Unexpect(ErrCode::Value::ArrayOutOfBounds);
550 }
551 const auto &VType = getArrayStorageTypeByIdx(StackMgr, TypeIdx);
552 return unpackVal(VType, Inst->getData(Idx), IsSigned);
553}
554
555Expect<void> Executor::arraySet(Runtime::StackManager &StackMgr,
556 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