MCPcopy Index your code
hub / github.com/apache/tvm / createPackedFuncFromSafeCallType

Method createPackedFuncFromSafeCallType

web/src/runtime.ts:2013–2037  ·  view source on GitHub ↗
(
    func: ctypes.FTVMFFIWasmSafeCallType
  )

Source from the content-addressed store, hash-verified

2011 }
2012
2013 private createPackedFuncFromSafeCallType(
2014 func: ctypes.FTVMFFIWasmSafeCallType
2015 ): PackedFunc {
2016 let findex = this.env.packedCFuncTable.length;
2017 if (this.env.packedCFuncTableFreeId.length != 0) {
2018 findex = this.env.packedCFuncTableFreeId.pop() as number;
2019 } else {
2020 this.env.packedCFuncTable.push(undefined);
2021 }
2022 this.env.packedCFuncTable[findex] = func;
2023
2024 const stack = this.lib.getOrAllocCallStack();
2025 const outOffset = stack.allocPtrArray(1);
2026 const outPtr = stack.ptrFromOffset(outOffset);
2027 this.lib.checkCall(
2028 (this.exports
2029 .TVMFFIWasmFunctionCreate as ctypes.FTVMFFIWasmFunctionCreate)(
2030 findex,
2031 outPtr
2032 )
2033 );
2034 const ret = this.makePackedFunc(this.memory.loadPointer(outPtr));
2035 this.lib.recycleCallStack(stack);
2036 return ret;
2037 }
2038
2039 /**
2040 * Set packed function arguments into the location indicated by argsValue and argsCode.

Callers 1

toPackedFuncInternalMethod · 0.95

Calls 8

makePackedFuncMethod · 0.95
getOrAllocCallStackMethod · 0.80
allocPtrArrayMethod · 0.80
ptrFromOffsetMethod · 0.80
loadPointerMethod · 0.80
recycleCallStackMethod · 0.80
popMethod · 0.45
checkCallMethod · 0.45

Tested by

no test coverage detected