A prison site: a caller's storage divided into cellblocks, with the warden that holds them. More...
Go to the source code of this file.
Data Structures | |
| struct | CellOwner |
| Asserts MMGR_CARCER_ALIGN is a power of two. More... | |
| struct | SeriesCellularum |
| One cellblock's state: its bytes, the two boundaries that grow toward each other, and the closed word a writer holds. Also the sink a refused store lands on, and the turnstiles every pass goes through. More... | |
| struct | CarcerMovableInitCfg |
| What a program gives a cellblock for the movable option, once, through its guard's movable_init. More... | |
| struct | CarcerMovableCfg |
| Arguments for the calls that reach a movable cell's bytes, each of which reads the members it names. More... | |
| struct | MinimumSecurityGuard |
| The minimum security guard over one cellblock: a released cell retains whatever is in it. More... | |
| struct | MaxSecurityGuard |
| The max security guard over one cellblock: every release zeroes the cell first. More... | |
Macros | |
| #define | MMGR_ENABLE_HW_MEM_CAPACITY_CB |
| Set to 1 to track each tier's high-water mark. | |
| #define | MMGR_CARCER_OWNERS |
| The max owners a program's owner table holds. | |
| #define | MMGR_MOVABLE_SETTLE_PERCENT |
| The fragmentation at which a cellblock's mover sorts its movable cells, as a percentage of the bytes its persistent tier occupies. | |
| #define | MMGR_MOVABLE_READ_MS |
| The milliseconds between the mover's readings of its cellblock. | |
| #define | MMGR_MOVABLE_QUIET_READINGS |
| The readings in a row that must find the cellblock quiet before the mover sorts. | |
| #define | MMGR_MOVABLE_BACKOFF_MAX_MS |
| The longest the mover waits between readings after a sort it backed off from. | |
| #define | MMGR_MOVABLE_IDLE_MAX_MS |
| The longest the mover waits between readings of a settled cellblock that no pass touched since the last reading. Each such reading doubles the wait up to this. A pass or a rise brings the next reading back to MMGR_MOVABLE_READ_MS. | |
| #define | MMGR_CARCER_REGIONS |
| The regions of the temporary tier: one stack of cells for each place the host gives a thread, modulo this count. 0 makes the temporary tier one stack that every thread shares. | |
| #define | MMGR_CARCER_REGION_BYTES |
| Bytes of each region: its cells with their headers and owner words. A multiple of MMGR_CARCER_ALIGN. | |
| #define | MMGR_CARCER_LARGE_REGION_BYTES |
| Bytes of the one large region, at the top of the cellblock, that every temporary take over a region's room goes to, from any thread. 0 refuses such a take. | |
| #define | MMGR_CARCER_LARGE_REGIONS |
| 1 where the cellblock has the large region, 0 where it has none. | |
| #define | MMGR_CARCER_REGION_COUNT |
| The regions in all: one for each place, and the large one where the build declares it. | |
| #define | MMGR_CARCER_REGION_AREA |
| Bytes the regions take off the top of every cellblock, 0 where the temporary tier is one stack. | |
| #define | MMGR_CARCER_ALIGN |
| Alignment of every prisoner on the way out: one machine word, or the atomic size word's alignment where that is wider. | |
| #define | MMGR_OWNER_PLACE_BITS |
| The owner word a cell carries behind its payload, one machine word positioned as fields, high to low. The fields are the owner's place in the table, the completion bit, the signal bits, and the nanosecond of the take. The clock is the library's, and the nanosecond rolls over its bits. | |
| #define | MMGR_OWNER_SIGNAL_BITS |
| #define | MMGR_OWNER_TIME_BITS |
| #define | MMGR_OWNER_TIME_MASK |
| #define | MMGR_OWNER_SIGNAL_SHIFT |
| #define | MMGR_OWNER_COMPLETE |
| #define | MMGR_OWNER_PLACE_SHIFT |
| #define | MMGR_OWNER_PLACE_MASK |
| #define | MMGR_OWNER_PLACE(name_, text_) |
| One owner's place in the table, counted from 0, as the enumeration MMGR_OWNERS positions names it. | |
| #define | MMGR_OWNER_RECORD(name_, text_) |
| One owner's record as the table's initializer positions it: its name, its place from 1, nothing counted. | |
| #define | MMGR_OWNER_POINTER(name_, text_) |
| One owner's identity defined: a const pointer to its record in the table, resolved by the linker. | |
| #define | MMGR_OWNER_EXTERN(name_, text_) |
| One owner's identity declared, for the header the owner's module reads it through. | |
| #define | MMGR_OWNERS(list_) |
| The program's owners declared as data: the table positioned, its count, and each owner's identity defined. | |
| #define | MMGR_CARCER_HALF_BITS |
| The bits each boundary has in the word that carries both, half the atomic size word, and the mask of a half. | |
| #define | MMGR_CARCER_HALF_MASK |
| #define | MMGR_CARCER_BYTES_MAX |
| The reach of a position in a boundary half: half the half's values. The other half is the headroom the bumps a round refuses move the position into before the next writer settles it. | |
| #define | MMGR_CARCER_WANT_MAX |
| The max payload one bump may ask. It is the headroom the bumps in flight on the turnstiles' lanes share. Each of them may move its boundary once past MMGR_CARCER_BYTES_MAX before the refusal stops the rest. A take past it goes to the writer's path at once. | |
| #define | MMGR_CARCER_BANK_SHIFT |
| The bits of a bank's bytes: a bank is half the reach of a position. A test build can set fewer, so that a small pool spans many banks. | |
| #define | MMGR_CARCER_BANK_BYTES |
| The bytes of one bank. | |
| #define | MMGR_CARCER_BANK_FIELD_BITS |
| The bits of each field of the closed word above its four flag bits. The fields are the bank count, the frame of the persistent tier and the frame of the temporary tier, in that order. | |
| #define | MMGR_CARCER_BANK_FIELD_MASK |
| The mask of one field, at bit 0. | |
| #define | MMGR_CARCER_BANK_COUNT_AT |
| The bit of the closed word that each field starts at. | |
| #define | MMGR_CARCER_BANK_END_AT |
| #define | MMGR_CARCER_BANK_TOP_AT |
| #define | MMGR_CARCER_POOL_BYTES_MAX |
| The max bytes one cellblock may hold: one less than the values of a field, times the bytes of a bank. So every frame and the bank count fit their fields. | |
| #define | MMGR_CARCER_BANK_OF(off_) |
| The bank an offset is in. | |
| #define | MMGR_CARCER_BANK_COUNT(bytes_) |
| The banks a cellblock of bytes_ bytes takes: its bytes rounded up to a whole bank. | |
| #define | MMGR_CARCER_FRAME_CAP(bytes_) |
| The highest frame of a cellblock of bytes_ bytes: two banks below its bank count, or bank 0. | |
| #define | MMGR_CARCER_END_FRAME(end_, bytes_) |
| The frame a writer gives a persistent end in a cellblock of bytes_ bytes: the end's bank, or the cap. | |
| #define | MMGR_CARCER_BANK_BELOW(top_) |
| The bank below a top's own bank, or bank 0. | |
| #define | MMGR_CARCER_TOP_FRAME(top_, bytes_) |
| The frame a writer gives a temporary top in a cellblock of bytes_ bytes: the bank below the top's own, or the cap. | |
| #define | MMGR_CARCER_CLOSED_AT_REST(bytes_) |
| The closed word of a cellblock at rest over bytes_ bytes. It holds no flag, the bank count, the persistent frame at bank 0, and the temporary frame for the top at the regions' start. | |
| #define | MMGR_CARCER_BOUNDS_AT_REST(bytes_) |
| The boundary word of a cellblock at rest over bytes_ bytes: the end at 0, the top's position in its frame. | |
| #define | MMGR_CARCER_STATE_HW |
| The high-water members' first values, or nothing where the build tracks none. | |
| #define | MMGR_CARCER_STATE_REGIONS |
| The regions' first depths, every one 0, or nothing where the temporary tier is one stack. | |
| #define | MMGR_CARCER_STATE_TURNSTILES |
| The turnstiles' first values: each lane word, the top open lane and the queue length at 0. | |
| #define | MMGR_CARCER_STATE(base_, bytes_) |
| A cellblock's state as it is over bytes_ bytes at base_ with no cell taken. Both tiers are empty, every mark is at zero, and the zero fill of the storage covers the turnstiles. | |
| #define | MMGR_CARCER_STATE_HOSPES |
| The record of a cellblock over a hospes pool before the program places it: no base, no size, both boundaries at 0, so every take is refused until mmgr_series_cellularum_placed gives the storage. | |
| #define | MMGR_MOVABLE_HEAD_BYTES |
| Bytes of the option's state ahead of its turnstiles, which locus_carcerum.c asserts it fits. | |
| #define | MMGR_MOVABLE_CLAIM_BITS |
| The bits of one word of the option's claim bits: one an entry. | |
| #define | MMGR_MOVABLE_STORAGE_BYTES(cells_, width_, rows_) |
| The storage the movable option takes for a table of cells_ entries and rows_ rows of touches. | |
| #define | MMGR_GUARD_MOVABLE_TAKE_MEMBERS |
| The two movable members both guards hold ahead of their movable release. | |
| #define | MMGR_GUARD_MOVABLE_SPAN_MEMBERS |
| The four movable members both guards hold after their movable release. | |
| #define | MMGR_GUARD_MEMBER_NAMES |
| The thirteen member names of both guards, in their order, for EMBED_TABLE_LAYOUT. | |
| #define | MMGR_CARCER_MOVABLE_ENTRIES(prisonsite_, name_, wipe_to_zero_on_release_, series_cellularum_) |
| The movable entries of one cellblock, bound to it through series_cellularum_. | |
| #define | MMGR_CARCER_BODY(prisonsite_, type_, name_, wipe_to_zero_on_release_, hospes_) |
| Everything one cellblock is: its bytes, its state, and the entries bound to it. | |
| #define | MMGR_CARCER_STORAGE_0(prisonsite_, name_) |
| A cellblock's record over the array its pool's declaration emitted: the asserts on the array's extent, and the record with the array as its base and the pool's count as its size. | |
| #define | MMGR_CARCER_STORAGE_1(prisonsite_, name_) |
| A cellblock's record over a hospes pool: empty until the program places it. | |
| #define | MMGR_CARCER_MEM(prisonsite_, type_, name_, wipe_to_zero_on_release_, hospes_) |
| One cellblock as a member of its site's type. | |
| #define | MMGR_CARCER_SEAT(prisonsite_, type_, name_, wipe_to_zero_on_release_, hospes_) |
| One cellblock's entries, in the order its guard declares them. | |
| #define | MMGR_MINIMUM_SECURITY(name_) |
| Declares a minimum security cellblock over a pool. | |
| #define | MMGR_MAXIMUM_SECURITY(name_) |
| Declares a max security cellblock over a pool. | |
| #define | MMGR_MINIMUM_SECURITY_HOSPES(name_) |
| Declares a minimum security cellblock over a hospes pool, one ParsMemoriaeHospes declared: the program gives the storage once, with mmgr_series_cellularum_placed, before the first take. | |
| #define | MMGR_MAXIMUM_SECURITY_HOSPES(name_) |
| Declares a max security cellblock over a hospes pool, as MMGR_MINIMUM_SECURITY_HOSPES with the wipe on release. | |
| #define | MMGR_UNTUPLE(...) |
| Strips a tuple's parentheses. | |
| #define | MMGR_CARCER_APPLY(what_, prisonsite_, tuple_) |
| Applies one reader to one cellblock tuple, with the site spliced in ahead of it. | |
| #define | MMGR_CARCER_APPLY_(what_, prisonsite_, ...) |
| Expands to what_(prisonsite_, VA_ARGS). | |
| #define | MMGR_CARCER_W1(what_, prisonsite_, SeriesCellularum1_) |
| Applies the reader to a site's one cellblock tuple. | |
| #define | MMGR_CARCER_W2(what_, prisonsite_, SeriesCellularum1_, SeriesCellularum2_) |
| Applies the reader to a site's two cellblock tuples. | |
| #define | MMGR_CARCER_W3(what_, prisonsite_, SeriesCellularum1_, SeriesCellularum2_, SeriesCellularum3_) |
| Applies the reader to a site's three cellblock tuples. | |
| #define | MMGR_CARCER_W4(what_, prisonsite_, SeriesCellularum1_, SeriesCellularum2_, SeriesCellularum3_, SeriesCellularum4_) |
| Applies the reader to a site's four cellblock tuples. | |
| #define | MMGR_CARCER_W5(what_, prisonsite_, SeriesCellularum1_, SeriesCellularum2_, SeriesCellularum3_, SeriesCellularum4_, SeriesCellularum5_) |
| Applies the reader to a site's five cellblock tuples. | |
| #define | MMGR_CARCER_W6(what_, prisonsite_, SeriesCellularum1_, SeriesCellularum2_, SeriesCellularum3_, SeriesCellularum4_, SeriesCellularum5_, SeriesCellularum6_) |
| Applies the reader to a site's six cellblock tuples. | |
| #define | MMGR_CARCER_W7(what_, prisonsite_, SeriesCellularum1_, SeriesCellularum2_, SeriesCellularum3_, SeriesCellularum4_, SeriesCellularum5_, SeriesCellularum6_, SeriesCellularum7_) |
| Applies the reader to a site's seven cellblock tuples. | |
| #define | MMGR_CARCER_W8(what_, prisonsite_, SeriesCellularum1_, SeriesCellularum2_, SeriesCellularum3_, SeriesCellularum4_, SeriesCellularum5_, SeriesCellularum6_, SeriesCellularum7_, SeriesCellularum8_) |
| Applies the reader to a site's eight cellblock tuples. | |
| #define | MMGR_CARCER_WALK(what_, prisonsite_, ...) |
| Expands the walk that matches the cellblock count. | |
| #define | LocusCarcerum(prisonsite_, ...) |
| Declares a prison site and the cellblocks built at it. | |
Typedefs | |
| typedef struct CarcerMovableEntry | CarcerMovableEntry |
| The identity a movable cell's taker holds: a const pointer to the cell's entry in the cellblock's translation table. | |
| typedef void(*) | CarcerIdleEach(void *context, void *at, size_t bytes) |
| A span of a cellblock's storage no cell holds, passed to the program: where it starts and its bytes. | |
Functions | |
| EMBED_HOST_DEVICE uint64_t | mmgr_carcer_hw_clock_ns (void) |
| The library's clock in nanoseconds, which a cell's owner word carries the take on. | |
| EMBED_PASS_DECLARE (CellOwner, mmgr_owner_table, []) | |
| The program's owner table and the owners in it, which MMGR_OWNERS defines once. | |
| EMBED_PASS_DECLARE (const size_t, mmgr_owner_table_count,) | |
| EMBED_HOST_DEVICE embed_bool | mmgr_owner_listed (const CellOwner *owner) |
| Whether an owner is one of the table's. | |
| static EMBED_HOST_DEVICE size_t | mmgr_owner_in_use (const CellOwner *owner) |
| The payload bytes of the cells an owner has now. | |
| static EMBED_HOST_DEVICE size_t | mmgr_owner_hw (const CellOwner *owner) |
| The max payload bytes an owner has had at once. | |
| EMBED_HOST_DEVICE void | mmgr_carcer_hw_misnamed (const CellOwner *named, const CellOwner *cell_owner, size_t bytes) |
| Told of each give or growth that names an owner other than the one the cell counts to. | |
| EMBED_HOST_DEVICE size_t | mmgr_series_cellularum_persistent_end (const SeriesCellularum *series) |
| Offset just past the last persistent cell. | |
| EMBED_HOST_DEVICE size_t | mmgr_series_cellularum_temporary_top (const SeriesCellularum *series) |
| Offset of the lowest temporary cell. | |
| static EMBED_HOST_DEVICE size_t | mmgr_series_cellularum_banks (const SeriesCellularum *series) |
| The banks a cellblock's bytes take, as its closed word holds the count. | |
| static EMBED_HOST_DEVICE size_t | mmgr_series_cellularum_region_depth (const SeriesCellularum *series, size_t region) |
| The bytes one region's stack holds from its end down. | |
| static EMBED_HOST_DEVICE embed_bool | mmgr_series_cellularum_regions_idle (const SeriesCellularum *series) |
| Whether every region is empty. | |
| static EMBED_HOST_DEVICE embed_bool | mmgr_series_cellularum_idle (const SeriesCellularum *series) |
| Whether a cellblock has no cell out. | |
| static EMBED_HOST_DEVICE size_t | mmgr_series_cellularum_persistent_hw (const SeriesCellularum *series) |
| The furthest point of a cellblock's persistent tier so far. | |
| static EMBED_HOST_DEVICE size_t | mmgr_series_cellularum_temporary_hw (const SeriesCellularum *series) |
| The max bytes a cellblock's temporary tier took from the top at one time. | |
| EMBED_HOST_DEVICE void * | mmgr_persistent_buf_alloc (SeriesCellularum *series, size_t size, const CellOwner *owner) |
| Takes size bytes from a cellblock's persistent tier. | |
| EMBED_HOST_DEVICE void * | mmgr_persistent_max_security_buf_alloc (SeriesCellularum *series, size_t size, const CellOwner *owner) |
| Takes size bytes from a max security cellblock's persistent tier. | |
| EMBED_HOST_DEVICE void | mmgr_persistent_buf_release (SeriesCellularum *series, void *prisoner, const CellOwner *owner) |
| Releases a prisoner and leaves the cell's bytes as they are. | |
| EMBED_HOST_DEVICE void | mmgr_persistent_max_security_buf_release (SeriesCellularum *series, void *prisoner, const CellOwner *owner) |
| Zeroes a cell, then releases the prisoner. | |
| EMBED_HOST_DEVICE void * | mmgr_buf_grow (SeriesCellularum *series, void *prisoner, size_t size, const CellOwner *owner) |
| Grows a cell to size payload bytes in place, where it is the newest cell of its tier. | |
| EMBED_HOST_DEVICE void * | mmgr_max_security_buf_grow (SeriesCellularum *series, void *prisoner, size_t size, const CellOwner *owner) |
| Grows a cell in place as mmgr_buf_grow does, and zeroes the bytes the growth adds. | |
| EMBED_HOST_DEVICE void * | mmgr_temporary_buf_alloc (SeriesCellularum *series, size_t size, const CellOwner *owner) |
| Takes size bytes from a cellblock's temporary tier. | |
| EMBED_HOST_DEVICE void * | mmgr_temporary_max_security_buf_alloc (SeriesCellularum *series, size_t size, const CellOwner *owner) |
| Takes size bytes from a max security cellblock's temporary tier. | |
| EMBED_HOST_DEVICE embed_bool | mmgr_who_owns_buf (const SeriesCellularum *series, const void *at) |
| Whether at lies inside the cellblock's bytes. | |
| EMBED_HOST_DEVICE const CellOwner * | mmgr_owner_of_buf (const SeriesCellularum *series, const void *prisoner) |
| The owner a cell counts to, read off the word behind its payload. | |
| EMBED_HOST_DEVICE size_t | mmgr_buf_available (SeriesCellularum *series) |
| The bytes between the two tiers. | |
| EMBED_HOST_DEVICE void | mmgr_zero_buf (void *prisoner, size_t size) |
| Zeroes size bytes at prisoner and releases nothing. | |
| EMBED_HOST_DEVICE size_t | mmgr_align_up_buf (size_t size) |
| Rounds size up to a whole machine word. | |
| EMBED_HOST_DEVICE void | mmgr_series_cellularum_emptied (SeriesCellularum *series) |
| Puts a cellblock back to the state of its declaration. Both tiers are empty, the closed word and the turnstiles at rest, the option unassigned, and no byte of its storage touched. | |
| EMBED_HOST_DEVICE embed_bool | mmgr_series_cellularum_placed (SeriesCellularum *series, uint8_t *storage, size_t bytes) |
| Places a cellblock declared over a hospes pool on the storage the program gives: its base and its size set, and the cellblock emptied over them. | |
| EMBED_HOST_DEVICE void | mmgr_series_cellularum_idle_each (SeriesCellularum *series, CarcerIdleEach each, void *context) |
| Passes each span of the cellblock's storage that no cell holds to each, with the cellblock closed: the gap between the tiers, and the room of each region above its depth. | |
| EMBED_HOST_DEVICE void | mmgr_owner_bytes_taken (const CellOwner *owner, size_t bytes) |
| Counts bytes that lie in no cellblock to an owner, as a ring's or a page's are. | |
| EMBED_HOST_DEVICE void | mmgr_owner_bytes_given (const CellOwner *owner, size_t bytes) |
| Takes bytes mmgr_owner_bytes_taken counted off their owner. | |
| EMBED_HOST_DEVICE size_t | mmgr_series_cellularum_fragmentation (const SeriesCellularum *series) |
| A cellblock's fragmentation: the bytes its persistent tier occupies and no cell's payload holds, as a percentage of the bytes it occupies. | |
| EMBED_HOST_DEVICE embed_bool | mmgr_movable_init (SeriesCellularum *series, const CarcerMovableInitCfg *args, embed_bool wipes) |
| Assigns a cellblock's movable option: the translation table, its claim bits, the rows of touches and the mover's thread. A cellblock's guard calls this, as movable_init. | |
| EMBED_HOST_DEVICE const CarcerMovableEntry * | mmgr_movable_buf_alloc (SeriesCellularum *series, size_t size, const CellOwner *owner) |
| Takes a persistent cell a move may move, and names it in the table. | |
| EMBED_HOST_DEVICE embed_bool | mmgr_movable_buf_release (SeriesCellularum *series, const CarcerMovableEntry *cell, const CellOwner *owner) |
| Gives a movable cell back and frees its entry. | |
| EMBED_HOST_DEVICE embed_bool | mmgr_movable_buf_read (const SeriesCellularum *series, const CarcerMovableCfg *args) |
| Copies args->bytes from args->offset of a movable cell to args->dst. | |
| EMBED_HOST_DEVICE embed_bool | mmgr_movable_buf_write (SeriesCellularum *series, const CarcerMovableCfg *args) |
| Copies args->bytes from args->src to args->offset of a movable cell. | |
| EMBED_HOST_DEVICE embed_iword | mmgr_movable_buf_compare (const SeriesCellularum *series, const CarcerMovableCfg *args) |
| Orders args->bytes of a movable cell against args->src, or against another cell where args->other_cell holds one. | |
| EMBED_HOST_DEVICE size_t | mmgr_movable_buf_measure (const SeriesCellularum *series, const CarcerMovableCfg *args) |
| The bytes from args->offset of a movable cell to the next zero byte. | |
| EMBED_HOST_DEVICE embed_bool | mmgr_movable_buf_move (SeriesCellularum *series) |
| Moves one movable cell into the first free cell below it, highest cell first. | |
| EMBED_HOST_DEVICE void | mmgr_movable_run (SeriesCellularum *series) |
| The mover: what the thread the program gave runs, until its thread_wait answers EMBED_FALSE. | |
| EMBED_HOST_DEVICE size_t | mmgr_movable_queue_depth (const SeriesCellularum *series) |
| The contexts queued at the cellblock's turnstiles now: those that found every open lane busy and wait for a lane. | |
| EMBED_HOST_DEVICE embed_bool | mmgr_movable_touches (const SeriesCellularum *series, size_t at, size_t *id, size_t *touches) |
| One row of touches a lane, counted as passes go through it. | |
A prison site: a caller's storage divided into cellblocks, with the warden that holds them.
Definition in file locus_carcerum.h.