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

Method proxyCallRef

lib/executor/engine/proxy.cpp:206–230  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

204}
205
206Expect<void> Executor::proxyCallRef(Runtime::StackManager &StackMgr,
207 const RefVariant Ref,
208 const ValVariant *Args,
209 ValVariant *Rets) noexcept {
210 const auto *FuncInst = retrieveFuncRef(Ref);
211 const auto &FuncType = FuncInst->getFuncType();
212 const uint32_t ParamsSize =
213 static_cast<uint32_t>(FuncType.getParamTypes().size());
214 const uint32_t ReturnsSize =
215 static_cast<uint32_t>(FuncType.getReturnTypes().size());
216
217 for (uint32_t I = 0; I < ParamsSize; ++I) {
218 StackMgr.push(Args[I]);
219 }
220
221 auto Instrs = FuncInst->getInstrs();
222 EXPECTED_TRY(auto StartIt, enterFunction(StackMgr, *FuncInst, Instrs.end()));
223 EXPECTED_TRY(execute(StackMgr, StartIt, Instrs.end()));
224
225 for (uint32_t I = 0; I < ReturnsSize; ++I) {
226 Rets[ReturnsSize - 1 - I] = StackMgr.pop();
227 }
228
229 return {};
230}
231
232Expect<RefVariant> Executor::proxyRefFunc(Runtime::StackManager &StackMgr,
233 const uint32_t FuncIdx) noexcept {

Callers

nothing calls this directly

Calls 8

retrieveFuncRefFunction · 0.85
getParamTypesMethod · 0.80
pushMethod · 0.80
popMethod · 0.80
EXPECTED_TRYFunction · 0.70
sizeMethod · 0.45
getInstrsMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected