Reduct  v4.0.5-1-g4851deb
A functional and immutable language.
Loading...
Searching...
No Matches
Garbage Collection

Detailed Description

Todo:
Reimplement Garbage Collector.

Data Structures

struct  reduct_gc_global_t
 Global garbage collection-related state structure. More...
 

Macros

#define REDUCT_GC_CHECK(_reduct)
 Check if the garbage collector should be ran and run it if so.
 

Functions

REDUCT_API void reduct_gc_global_init (reduct_gc_global_t *global)
 Initialize a global gc state.
 
REDUCT_API void reduct_gc_global_deinit (reduct_gc_global_t *global)
 Deinitialize a global gc state.
 
REDUCT_API void reduct_gc (struct reduct *reduct)
 Run the garbage collector.
 
static REDUCT_ALWAYS_INLINE void reduct_gc_request (reduct_gc_global_t *gc)
 Request that the garbage collector be ran without immediately running it.
 

Macro Definition Documentation

◆ REDUCT_GC_CHECK

#define REDUCT_GC_CHECK (   _reduct)
Value:
do \
{ \
if (REDUCT_UNLIKELY(atomic_load_explicit(&_reduct->global->gc.requested, memory_order_relaxed))) \
{ \
reduct_gc(_reduct); \
} \
} while (0)
#define REDUCT_UNLIKELY(_x)
Definition defs.h:59

Check if the garbage collector should be ran and run it if so.

State and env pointer must be specified sep

Parameters
_reductPointer to the Reduct structure.

Definition at line 60 of file gc.h.

Function Documentation

◆ reduct_gc_global_init()

REDUCT_API void reduct_gc_global_init ( reduct_gc_global_t global)

Initialize a global gc state.

Parameters
globalPointer to the global gc state to initialize.

◆ reduct_gc_global_deinit()

REDUCT_API void reduct_gc_global_deinit ( reduct_gc_global_t global)

Deinitialize a global gc state.

Parameters
globalPointer to the global gc state to deinitialize.

◆ reduct_gc()

REDUCT_API void reduct_gc ( struct reduct *  reduct)

Run the garbage collector.

Note
Usually the garbage collector will only be ran in between the evaluation of two instructions. As such, when evaluation is not taking place, or when evaluating an instruction, there is no need to retain specific items.
Parameters
reductPointer to the Reduct structure.

◆ reduct_gc_request()

static REDUCT_ALWAYS_INLINE void reduct_gc_request ( reduct_gc_global_t gc)
inlinestatic

Request that the garbage collector be ran without immediately running it.

Parameters
gcPointer to the GC environment.

Definition at line 74 of file gc.h.