103 {
106
107 if (engine == nullptr) {
108 return nullptr;
109 }
110
111
112
113
114
117
119
121
122#if !defined(_WIN32)
123
124
125
126
127
128
129
130
131 UNUSED(signal(SIGPIPE, SIG_IGN));
132#endif
133
134#ifdef SRN_WITH_SERENE
135
136
137#endif
140
141#ifdef SRN_WITH_SERENE
142
143
144
145
147
148
149
150
151
153 *namespaces =
hmap_empty(engine->root_context);
154 atomic_init(&engine->namespaces, namespaces);
155
158
161 atomic_init(&engine->keywords, keywords);
162
165#endif
167
168
169 engine->source_manager =
srn_sm_init(engine->root_context);
170
171 return engine;
172}
void srn_config_validate(const srn_configuration_t *config)
A configuration with every field set to its default.
#define SRN_CONFIG_DEFAULTS
srn_context_t * srn_context_make(srn_engine_t *engine)
Make an empty context, by allocating a new memory block.
#define ALLOC_OR_PANIC(ctx, T)
static srn_seed_t srn_generate_seed()
#define ENGINE_FIRST_OBJECT_ID
Start allocating IDs from 100, earlier IDs are reserved.
hmap_t hmap_empty(const srn_context_t *ctx)
Create, initialize and return a new hashmap pinned to ctx.
#define srn_mm_immortal_allocate(mm, T)
void srn_fiber_mutex_init(srn_fiber_mutex_t *m)
Initialise m to the unlocked state.
srn_reactor_t * srn_reactor_init(srn_engine_t *engine)
Allocate the IO reactor from the engine.
srn_scheduler_t * srn_sched_init(srn_engine_t *engine)
srn_sm_t * srn_sm_init(srn_context_t *ctx)
Initialize the source manager, as an immortal data structure.
Engine is a structure to own the long living and main pieces of the compiler.
srn_configuration_t config
The runtime's tunable knobs, the single source for every configurable value (see configuration....
srn_scheduler_t * scheduler
The fiber scheduler, that is the entry point of the fiber subsystem.
srn_seed_t seed
We use the seed for hashing and the value will be generated at random for each new context.
srn_mm_t * mm
Memory manager.
srn_reactor_t * reactor
The I/O reactor, that is in charge of handling everything I/O.