An item is a generic container for all data types and heap allocated structures within Reduct.
To optimize memory cacheing and reduce fragmentation, all items are 64 bytes and aligned to cache lines.
◆ REDUCT_ITEM_TYPE_NONE
| #define REDUCT_ITEM_TYPE_NONE 0 |
No type.
Definition at line 30 of file item.h.
◆ REDUCT_ITEM_TYPE_ATOM
| #define REDUCT_ITEM_TYPE_ATOM 1 |
An atom.
Definition at line 31 of file item.h.
◆ REDUCT_ITEM_TYPE_ARENA
| #define REDUCT_ITEM_TYPE_ARENA 2 |
An arena.
Definition at line 32 of file item.h.
◆ REDUCT_ITEM_TYPE_LIST
| #define REDUCT_ITEM_TYPE_LIST 3 |
A list.
Definition at line 33 of file item.h.
◆ REDUCT_ITEM_TYPE_FUNCTION
| #define REDUCT_ITEM_TYPE_FUNCTION 4 |
A function.
Definition at line 34 of file item.h.
◆ REDUCT_ITEM_TYPE_CLOSURE
| #define REDUCT_ITEM_TYPE_CLOSURE 5 |
A closure.
Definition at line 35 of file item.h.
◆ REDUCT_ITEM_TYPE_RVSDG_NODE
| #define REDUCT_ITEM_TYPE_RVSDG_NODE 6 |
An IR node.
Definition at line 36 of file item.h.
◆ REDUCT_ITEM_TYPE_RVSDG_EDGE
| #define REDUCT_ITEM_TYPE_RVSDG_EDGE 7 |
An IR edge.
Definition at line 37 of file item.h.
◆ REDUCT_ITEM_TYPE_RVSDG_REGION
| #define REDUCT_ITEM_TYPE_RVSDG_REGION 8 |
An IR region.
Definition at line 38 of file item.h.
◆ REDUCT_ITEM_TYPE_RVSDG_USER
| #define REDUCT_ITEM_TYPE_RVSDG_USER 9 |
An IR user (input/result).
Definition at line 39 of file item.h.
◆ REDUCT_ITEM_TYPE_RVSDG_ORIGIN
| #define REDUCT_ITEM_TYPE_RVSDG_ORIGIN 10 |
An IR origin (output/argument).
Definition at line 40 of file item.h.
◆ REDUCT_ITEM_TYPE_FUTURE
| #define REDUCT_ITEM_TYPE_FUTURE 11 |
A future.
Definition at line 41 of file item.h.
◆ REDUCT_ITEM_FLAG_NONE
| #define REDUCT_ITEM_FLAG_NONE 0 |
No flags.
Definition at line 44 of file item.h.
◆ REDUCT_ITEM_FLAG_MARKED
| #define REDUCT_ITEM_FLAG_MARKED (1 << 0) |
Item is marked by the GC.
Definition at line 45 of file item.h.
◆ REDUCT_ITEM_FLAG_RETAINED
| #define REDUCT_ITEM_FLAG_RETAINED (1 << 1) |
Item is retained and should be considered a root by the GC.
Definition at line 46 of file item.h.
◆ REDUCT_ITEM_PAYLOAD_MAX
| #define REDUCT_ITEM_PAYLOAD_MAX 56 |
The maximum size of the item payload.
Definition at line 48 of file item.h.
◆ REDUCT_ITEM_BLOCK_MAX
| #define REDUCT_ITEM_BLOCK_MAX 127 |
The maximum number of items in a block.
Definition at line 86 of file item.h.
◆ reduct_item_type_t
Item type enumeration.
Definition at line 29 of file item.h.
◆ reduct_item_flags_t
Item flags enumeration.
Definition at line 43 of file item.h.
◆ reduct_item_global_init()
Initialize a global item state.
- Parameters
-
| global | Pointer to the global item state to initialize. |
◆ reduct_item_global_deinit()
Deinitialize a global item state.
- Parameters
-
| reduct | Pointer to the Reduct structure. |
| global | Pointer to the global item state to deinitialize. |
◆ reduct_item_local_init()
Initialize a local item state.
- Parameters
-
| local | Pointer to the local item state to initialize. |
◆ reduct_item_local_deinit()
Deinitialize a local item state.
- Parameters
-
| local | Pointer to the local item state to deinitialize. |
◆ reduct_item_new()
Allocate a new item.
- Parameters
-
| reduct | Pointer to the Reduct structure. |
- Returns
- A pointer to the newly created item.
◆ reduct_item_deinit()
Deinitialize a item without adding it to the freelist.
- Parameters
-
| reduct | Pointer to the Reduct structure. |
| item | Pointer to the item to deinitialize. |
◆ reduct_item_free()
Free an item.
Intended to be used by the GC or when it is known that an item has no more users and was allocated by the current thread.
- Parameters
-
| reduct | Pointer to the Reduct structure. |
| item | Pointer to the item to free. |
◆ reduct_item_type_str()
Get the string representation of the type of an item.
- Parameters
-
- Returns
- The string representation of the item type.
◆ reduct_item_mark()
Mark an item as reachable.
Used by the garbage collector.
- Parameters
-
| item | Pointer to the item to mark. |
◆ reduct_item_retain()
Retain an item, preventing it from being collected by the garbage collector.
- Parameters
-
| item | Pointer to the item to retain. |
Definition at line 209 of file item.h.
◆ reduct_item_release()
Release an item, potentially allowing the garbage collector to collect it.
- Parameters
-
| item | Pointer to the item to release. |
Definition at line 220 of file item.h.