2#ifndef REDUCT_GC_IMPL_H
3#define REDUCT_GC_IMPL_H 1
123 rootBlock = rootBlock->
next;
153 item->
flags &= ~REDUCT_ITEM_FLAG_GC_MARK;
Core definitions and structures.
#define REDUCT_CONTAINER_OF(_ptr, _type, _member)
Container of macro.
reduct_uint64_t reduct_handle_t
Handle type.
#define REDUCT_ASSERT(_cond)
Virtual machine evaluation.
static void reduct_gc_mark(reduct_t *reduct, reduct_item_t *item)
static void reduct_gc_mark_node(reduct_t *reduct, reduct_uint32_t shift, reduct_list_node_t *node)
static void reduct_gc_mark_list(reduct_t *reduct, reduct_list_t *list)
#define REDUCT_GC_THRESHOLD_INITIAL
Initial blocks allocated threshold for garbage collection.
#define REDUCT_CONST_SLOT_CAPTURE(_capture)
Create a constant slot containing a variable name to be captured.
#define REDUCT_CONST_SLOT_ITEM(_item)
Create a constant slot containing an item.
REDUCT_API void reduct_gc_if_needed(reduct_t *reduct)
Optionally run the garbage collector if the number of allocated blocks exceeds the threshold.
REDUCT_API void reduct_gc(reduct_t *reduct)
Run the garbage collector.
#define REDUCT_HANDLE_IS_ITEM(_handle)
Check if a handle is an item.
#define REDUCT_HANDLE_TO_ITEM(_handle)
Get the item pointer of a handle.
#define REDUCT_ITEM_TYPE_LIST
A list.
#define REDUCT_ITEM_TYPE_FUNCTION
A function.
REDUCT_API void reduct_item_free(struct reduct *reduct, reduct_item_t *item)
Free an Reduct item.
#define REDUCT_ITEM_TYPE_NONE
No type.
#define REDUCT_ITEM_TYPE_CLOSURE
A closure.
#define REDUCT_ITEM_BLOCK_MAX
The maximum number of items in a block.
#define REDUCT_ITEM_FLAG_GC_MARK
Item is marked by GC.
#define REDUCT_LIST_BITS
Number of bits per level in the trie.
#define REDUCT_LIST_WIDTH
The number of children per node.
reduct_handle_t * constants
The array of constant slots forming the constant template.
reduct_function_t * function
Pointer to the prototype function item.
reduct_const_slot_type_t type
The type of the constant slot.
struct reduct_item * item
The item contained in the constant slot.
struct reduct_atom * capture
The name of the variable to be captured.
reduct_const_slot_t * constants
The array of constant slots forming the constant template.
reduct_uint16_t constantCount
Number of constants.
struct reduct_item_block * next
reduct_item_t items[REDUCT_ITEM_BLOCK_MAX]
reduct_list_t list
A list.
reduct_closure_t closure
A closure.
reduct_function_t function
A function.
reduct_item_flags_t flags
Flags for the item.
reduct_uint16_t retainCount
The reference count for GC retention.
reduct_item_type_t type
The type of the item.
reduct_handle_t handles[REDUCT_LIST_WIDTH]
struct reduct_list_node * children[REDUCT_LIST_WIDTH]
reduct_list_node_t * tail
Pointer to the tail node.
reduct_list_node_t * root
Pointer to the trie root node.
reduct_uint32_t shift
The amount to shift the index to compute access paths.
reduct_size_t gcThreshold
reduct_item_block_t * block
struct reduct_eval_state * evalState
struct reduct_item * freeList
reduct_size_t blocksAllocated