Function TVMFFITypeGetOrAllocIndex

Function TVMFFITypeGetOrAllocIndex#

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.

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.

Returns:

The allocated type index.