101 {
104
105 if (engine == nullptr) {
106 return nullptr;
107 }
108
109
110
111
112
115
117
119
120#if !defined(_WIN32)
121
122
123
124
125
126
127
128
129 UNUSED(signal(SIGPIPE, SIG_IGN));
130#endif
131
132#ifdef SRN_WITH_SERENE
134#endif
137
138#ifdef SRN_WITH_SERENE
139
140
141
142
144 engine->namespaces =
hmap_empty(engine->root_context);
146 engine->keywords =
hmap_empty(engine->root_context);
148#endif
150
151 return engine;
152}
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.
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)
srn_jit_t * srn_jit_make(srn_mm_t *mm)
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)
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.
static void srn_spinlock_init(srn_spinlock_t *lock)