Serene Runtime 1.0.0
C runtime for the Serene programming language
Loading...
Searching...
No Matches
srn_engine_t Struct Reference

Engine is a structure to own the long living and main pieces of the compiler. More...

#include <engine.h>

Collaboration diagram for srn_engine_t:
[legend]

Data Fields

_Atomic srn_object_id_t object_id_counter
 An unsigned counter to allocate object ids atomically.
 
srn_mm_tmm
 Memory manager.
 
srn_scheduler_tscheduler
 The fiber scheduler, set by srn_sched_init.
 
srn_seed_t seed
 We use the seed for hashing and the value will be generated at random for each new context.
 

Detailed Description

Engine is a structure to own the long living and main pieces of the compiler.

There will be only oe instance of the engine at anytime.

Definition at line 49 of file engine.h.

Field Documentation

◆ mm

srn_mm_t* srn_engine_t::mm

Memory manager.

Definition at line 58 of file engine.h.

◆ object_id_counter

_Atomic srn_object_id_t srn_engine_t::object_id_counter

An unsigned counter to allocate object ids atomically.

Any object in Serene must have a unique id, this id is not guaranteed to be the same on each run. We use this id as the routing key on the context level to connect different pieces of information related to the same object together. ONLY INTERACT WITH THIS VIA allocate_object_id.

Definition at line 55 of file engine.h.

◆ scheduler

srn_scheduler_t* srn_engine_t::scheduler

The fiber scheduler, set by srn_sched_init.

It's here so any fiber can reach it through its context as fiber->ctx->engine->scheduler, which is how srn_fiber_ready works from a thread that is not a worker.

Definition at line 67 of file engine.h.

◆ seed

srn_seed_t srn_engine_t::seed

We use the seed for hashing and the value will be generated at random for each new context.

There's concern about hashmap collioson DoS attacks but as far as I can see other compilers are doing a similar thing with a non-cryptographic hashing function. we use xxHash but others are using the non-cryptographic version of SipHash with a random seed as well.

Definition at line 75 of file engine.h.


The documentation for this struct was generated from the following file: