MCPcopy Create free account
hub / github.com/apache/tvm / typeKey2Index

Method typeKey2Index

web/src/runtime.ts:1719–1737  ·  view source on GitHub ↗

* Get type index from type key. * @param typeKey The type key. * @returns The corresponding type index.

(
    typeKey: string
  )

Source from the content-addressed store, hash-verified

1717 * @returns The corresponding type index.
1718 */
1719 typeKey2Index(
1720 typeKey: string
1721 ): number {
1722 const stack = this.lib.getOrAllocCallStack();
1723 const typeKeyOffset = stack.allocByteArrayForString(typeKey);
1724 const outOffset = stack.allocPtrArray(1);
1725 const outPtr = stack.ptrFromOffset(outOffset);
1726
1727 stack.commitToWasmMemory(outOffset);
1728 this.lib.checkCall(
1729 (this.lib.exports.TVMFFITypeKeyToIndex as ctypes.FTVMFFITypeKeyToIndex)(
1730 stack.ptrFromOffset(typeKeyOffset),
1731 outPtr
1732 )
1733 );
1734 const typeIndex = this.memory.loadU32(outPtr);
1735 this.lib.recycleCallStack(stack);
1736 return typeIndex;
1737 }
1738
1739 /**
1740 * Register an object constructor.

Callers 1

Calls 8

getOrAllocCallStackMethod · 0.80
allocPtrArrayMethod · 0.80
ptrFromOffsetMethod · 0.80
commitToWasmMemoryMethod · 0.80
loadU32Method · 0.80
recycleCallStackMethod · 0.80
checkCallMethod · 0.45

Tested by

no test coverage detected