30#define REDUCT_ITEM_TYPE_NONE 0
31#define REDUCT_ITEM_TYPE_ATOM 1
32#define REDUCT_ITEM_TYPE_ARENA 2
33#define REDUCT_ITEM_TYPE_LIST 3
34#define REDUCT_ITEM_TYPE_FUNCTION 4
35#define REDUCT_ITEM_TYPE_CLOSURE 5
36#define REDUCT_ITEM_TYPE_RVSDG_NODE 6
37#define REDUCT_ITEM_TYPE_RVSDG_EDGE 7
38#define REDUCT_ITEM_TYPE_RVSDG_REGION 8
39#define REDUCT_ITEM_TYPE_RVSDG_USER 9
40#define REDUCT_ITEM_TYPE_RVSDG_ORIGIN 10
41#define REDUCT_ITEM_TYPE_FUTURE 11
44#define REDUCT_ITEM_FLAG_NONE 0
45#define REDUCT_ITEM_FLAG_MARKED (1 << 0)
46#define REDUCT_ITEM_FLAG_RETAINED (1 << 1)
48#define REDUCT_ITEM_PAYLOAD_MAX 56
58typedef struct reduct_item
86#define REDUCT_ITEM_BLOCK_MAX 127
94typedef struct reduct_item_block
97 struct reduct_item_block*
next;
98 uint8_t _padding[
REDUCT_ALIGNMENT -
sizeof(
void*) -
sizeof(
struct reduct_item_block*)];
104 "reduct_item_block_t must be a power of two");
211 assert(item != NULL);
222 assert(item != NULL);
Atom representation and operations.
#define REDUCT_ALIGNMENT
The memory alignment for items.
uint16_t reduct_input_id_t
Identifies a reduct_input_t within a Reduct structure.
#define REDUCT_ALWAYS_INLINE
static REDUCT_ALWAYS_INLINE void reduct_item_release(struct reduct_item *item)
Release an item, potentially allowing the garbage collector to collect it.
REDUCT_API void reduct_item_local_deinit(reduct_item_local_t *local)
Deinitialize a local item state.
REDUCT_API void reduct_item_global_init(reduct_item_global_t *global)
Initialize a global item state.
REDUCT_API void reduct_item_mark(reduct_item_t *item)
Mark an item as reachable.
REDUCT_API void reduct_item_free(struct reduct *reduct, reduct_item_t *item)
Free an item.
#define REDUCT_ITEM_FLAG_RETAINED
Item is retained and should be considered a root by the GC.
REDUCT_API reduct_item_t * reduct_item_new(struct reduct *reduct)
Allocate a new item.
REDUCT_API const char * reduct_item_type_str(reduct_item_t *item)
Get the string representation of the type of an item.
#define REDUCT_ITEM_PAYLOAD_MAX
The maximum size of the item payload.
uint8_t reduct_item_type_t
Item type enumeration.
REDUCT_API void reduct_item_global_deinit(struct reduct *reduct, reduct_item_global_t *global)
Deinitialize a global item state.
#define REDUCT_ITEM_BLOCK_MAX
The maximum number of items in a block.
static REDUCT_ALWAYS_INLINE void reduct_item_retain(struct reduct_item *item)
Retain an item, preventing it from being collected by the garbage collector.
uint8_t reduct_item_flags_t
Item flags enumeration.
REDUCT_API void reduct_item_deinit(struct reduct *reduct, reduct_item_t *item)
Deinitialize a item without adding it to the freelist.
REDUCT_API void reduct_item_local_init(reduct_item_local_t *local)
Initialize a local item state.
Intermediate Representation.
Compiled function structure.
struct reduct_item_block * next
void * allocated
The actual pointer returned by the memory allocation.
Global item-related state structure.
struct reduct_item * globalFreeList
reduct_item_block_t * block
Per-thread item-related state structure.
reduct_list_t list
A list.
reduct_rvsdg_node_t rvsdgNode
An ir node.
reduct_closure_t closure
A closure.
reduct_rvsdg_origin_t rvsdgOrigin
An ir origin.
reduct_rvsdg_user_t rvsdgUser
An ir user.
reduct_input_id_t inputId
The input ID of the item.
uint32_t position
The position in the input buffer where the item was parsed.
reduct_arena_t arena
An arena.
reduct_function_t function
A function.
_Atomic(reduct_item_flags_t) flags
Flags for the item.
struct reduct_item * free
The next free item in the free list.
reduct_rvsdg_region_t rvsdgRegion
An ir region.
reduct_atom_t atom
An atom.
reduct_future_t future
A future.
reduct_rvsdg_edge_t rvsdgEdge
An ir edge.
reduct_item_type_t type
The type of the item.
uint32_t length
Common length for the item. (Stored in the union due to padding rules.)
Edge structure representing a data dependency.
Origin of a data dependency edge.
User of a data dependency edge.