Serene Runtime 1.0.0-dev
C runtime for the Serene programming language
Loading...
Searching...
No Matches
runtime.h File Reference
Include dependency graph for runtime.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define SERENE_RUNTIME_INIT(engine, config)
 Declare engine and bring the runtime up, the memory manager first, then the engine over it, both reading config (a const srn_configuration_t *; null means the defaults).
#define SERENE_RUNTIME_INIT_WITH_SCHED(engine, sched, config)
 SERENE_RUNTIME_INIT plus a sched variable bound to the engine's scheduler, which every run and fiber call wants at hand.
#define SERENE_RUNTIME_SHUTDOWN(engine)
 Tear down what SERENE_RUNTIME_INIT brought up, in reverse order, the engine (reactor, scheduler, jit) and then the memory manager it lives in.

Macro Definition Documentation

◆ SERENE_RUNTIME_INIT

#define SERENE_RUNTIME_INIT ( engine,
config )
Value:
srn_engine_t *engine = srn_engine_make(srn_mm_init(config), (config)); \
PANIC_IF_NULL(engine)
srn_mm_t * srn_mm_init(const srn_configuration_t *config)
Initialize the memory manager, this function will panic on error.
Definition default.c:322
srn_engine_t * srn_engine_make(srn_mm_t *mm, const srn_configuration_t *config)
Create the engine over mm, copying config (the runtime's knobs) into it.
Definition engine.c:101
Engine is a structure to own the long living and main pieces of the compiler.
Definition engine.h:51

Declare engine and bring the runtime up, the memory manager first, then the engine over it, both reading config (a const srn_configuration_t *; null means the defaults).

config is evaluated more than once, so pass a plain pointer, not an expression with effects. Panics on failure.

Definition at line 38 of file runtime.h.

38#define SERENE_RUNTIME_INIT(engine, config) \
39 srn_engine_t *engine = srn_engine_make(srn_mm_init(config), (config)); \
40 PANIC_IF_NULL(engine)

◆ SERENE_RUNTIME_INIT_WITH_SCHED

#define SERENE_RUNTIME_INIT_WITH_SCHED ( engine,
sched,
config )
Value:
SERENE_RUNTIME_INIT(engine, config); \
srn_scheduler_t *sched = (engine)->scheduler; \
PANIC_IF_NULL(sched)
#define SERENE_RUNTIME_INIT(engine, config)
Declare engine and bring the runtime up, the memory manager first, then the engine over it,...
Definition runtime.h:38

SERENE_RUNTIME_INIT plus a sched variable bound to the engine's scheduler, which every run and fiber call wants at hand.

Definition at line 46 of file runtime.h.

46#define SERENE_RUNTIME_INIT_WITH_SCHED(engine, sched, config) \
47 SERENE_RUNTIME_INIT(engine, config); \
48 srn_scheduler_t *sched = (engine)->scheduler; \
49 PANIC_IF_NULL(sched)

◆ SERENE_RUNTIME_SHUTDOWN

#define SERENE_RUNTIME_SHUTDOWN ( engine)
Value:
do { \
srn_mm_t *serene_mm_ = (engine)->mm; \
srn_engine_shutdown(engine); \
srn_mm_shutdown(serene_mm_); \
} while (0)
Main memory manager structure that will own all the allocated blocks and data.
Definition interface.h:107

Tear down what SERENE_RUNTIME_INIT brought up, in reverse order, the engine (reactor, scheduler, jit) and then the memory manager it lives in.

Contexts need no separate release beforehand; the manager reclaims every chain. Release a context earlier only to reclaim its memory early, and only when no unreaped fiber lives in it.

Definition at line 58 of file runtime.h.

58#define SERENE_RUNTIME_SHUTDOWN(engine) \
59 do { \
60 srn_mm_t *serene_mm_ = (engine)->mm; \
61 srn_engine_shutdown(engine); \
62 srn_mm_shutdown(serene_mm_); \
63 } while (0)