Function TVMFFITypeGetOrAllocIndex#
Defined in File c_api.h
Function Documentation#
-
int32_t TVMFFITypeGetOrAllocIndex(const TVMFFIByteArray *type_key, int32_t static_type_index, int32_t type_depth, int32_t num_child_slots, int32_t child_slots_can_overflow, int32_t parent_type_index)#
Initialize the type info during runtime.
When the function is first called for a type, it will register the type to the type table in the runtime. If the static_tindex is non-negative, the function will allocate a runtime type index. Otherwise, we will populate the type table and return the static index. If parent_type_index is -2, the function queries the existing type index: it returns the registered index for type_key, or -2 if type_key is not registered.
- Parameters:
type_key – The type key.
type_depth – The type depth.
static_type_index – Static type index if any, can be -1, which means this is a dynamic index
num_child_slots – Number of slots reserved for its children.
child_slots_can_overflow – Whether to allow child to overflow the slots.
parent_type_index – Parent type index, pass in -1 if it is root, or -2 to query only.
- Returns:
The existing or allocated type index; -2 when query-only mode misses.