abla/runtime/self/stm
Generated from source.
Source module; follow its importing module's re-export links.
Source: abla/runtime/self/stm.ab
__ablaRuntimeStmShared (var)
var __ablaRuntimeStmShared: int
Stores the shared transaction state address, or zero before initialization.
__ablaRuntimeStmAlwaysLogged (var)
var __ablaRuntimeStmAlwaysLogged: bool
Every transaction logged, also on one thread (tests: logged transactions under collection stress).
__ablaRuntimeStmSharedCreate (fun)
@noinline
trusted fun __ablaRuntimeStmSharedCreate(): int
Initializes the shared locks and partition clocks on first use and returns the shared state address.
__ablaRuntimeStmState (fun)
@inline
trusted fun __ablaRuntimeStmState(): int
Returns the shared transaction state address, creating it on first use.
__ablaRuntimeStmDescriptorCreate (fun)
@noinline
trusted fun __ablaRuntimeStmDescriptorCreate(): int
Allocates, registers and returns the address of the current thread's transaction descriptor.
__ablaRuntimeStmDescriptor (fun)
@inline
trusted fun __ablaRuntimeStmDescriptor(): int
Returns the current thread's transaction descriptor address, creating it on first use.
__ablaRuntimeStmThreadExit (fun)
trusted fun __ablaRuntimeStmThreadExit(): void
The thread is ending: its descriptor leaves the shared list.
__ablaRuntimeTVarCreate (fun)
trusted fun __ablaRuntimeTVarCreate(value: any): any
Returns a transactional variable with the given boxed value and no assigned transaction region yet.
__ablaRuntimeStmPartition (fun)
@inline
trusted fun __ablaRuntimeStmPartition(tvar: int): int
The clock a TVar's version comes from: one of sixteen, its region's (set once it was reached in a logged transaction, which every TVar a commit writes was).
__ablaRuntimeStmBit (fun)
@inline
trusted fun __ablaRuntimeStmBit(tvar: int): int
A TVar's bit in a descriptor's written filter.
__ablaRuntimeStmWritten (fun)
trusted fun __ablaRuntimeStmWritten(descriptor: int, tvar: int): int
The write entry for tvar, or -1.
__ablaRuntimeStmGrow (fun)
@noinline
trusted fun __ablaRuntimeStmGrow(at: int, bytes: int, values: int, frame: int): void
Grows a log (at: the descriptor's count field; capacity, log and roots follow) of bytes-byte entries holding values values each, and points its root frame at the new roots.
__ablaRuntimeStmLogRead (fun)
trusted fun __ablaRuntimeStmLogRead(descriptor: int, tvar: any, version: int): void
Records the variable and its observed version in the transaction read log for validation.
__ablaRuntimeStmLogWrite (fun)
trusted fun __ablaRuntimeStmLogWrite(descriptor: int, tvar: any, value: any): void
Records a buffered write and keeps the variable and value reachable while the transaction is active.
__ablaRuntimeStmValidate (fun)
trusted fun __ablaRuntimeStmValidate(descriptor: int, committing: bool): bool
Whether every read is still current: the same version, and not held. Only committing, when this transaction holds what it writes, is a held TVar it wrote its own; while its body runs (moving the snapshot up) it holds nothing, and a TVar it read and wrote can be held by another commit about to change it. Taking that lock for its own let the snapshot move past the other commit's version, and the commit then skip its check (the clock had not moved since) and overwrite the other's write.
__ablaRuntimeStmAbandon (fun)
@noinline
trusted fun __ablaRuntimeStmAbandon(descriptor: int, retrying: bool): never
Leaves the attempt at once (from any depth of its body), to retry it or, with retrying, to wait for a change first.
__ablaRuntimeStmClock (fun)
@inline
trusted fun __ablaRuntimeStmClock(partition: int): int
A partition's clock.
__ablaRuntimeStmAccess (fun)
@noinline
trusted fun __ablaRuntimeStmAccess(descriptor: int, tvar: int, mode: int): int
A TVar's region, at +8, is that of the thread whose logged transaction reached it first: (number << 4) | (number & 15), the number its descriptor's (+24). So the TVars a thread's transactions use share that thread's clock however and wherever they were made, and a structure one thread works on never straddles two clocks. It is set once, from -2 by a compare-and-swap here, before any commit gives the TVar a version, and never changes after.
A logged transaction's mode, at +728: 0 before its first access, the region of its first access while every access so far is in that region (one clock, partition region & 15, whose value is the snapshot at +16: the protocol of a single global clock), -1 once it has touched a second region (a snapshot for each clock, at +336, the mask of those taken at +736, in the order taken at +592 with their count at +720). An access outside the mode's region, or to a TVar with none yet, comes here, and returns the mode that applies after it. (A region is never 0 or -1, so it never equals those modes.)
__ablaRuntimeStmReadLogged (fun)
@noinline
trusted fun __ablaRuntimeStmReadLogged(descriptor: int, tvarValue: any, tvar: int): any
Returns the transaction's pending write or a version-checked read, abandoning the attempt if validation fails.
__ablaRuntimeStmRead (fun)
@inline
trusted fun __ablaRuntimeStmRead(tvarValue: any): any
A TVar's value, inside a transaction. Inline, as is a write's check: a block's accesses share one lookup of the thread's descriptor (a call on some hosts).
__ablaRuntimeStmWrite (fun)
@inline
trusted fun __ablaRuntimeStmWrite(tvarValue: any, value: any): any
Sets a TVar's value, inside a transaction.
__ablaRuntimeStmWriteLogged (fun)
@noinline
trusted fun __ablaRuntimeStmWriteLogged(descriptor: int, tvarValue: any, tvar: int,
value: any): void
A write inside a transaction: to the write buffer (logged), or in place with the old value kept once (direct).
__ablaRuntimeStmRetry (fun)
trusted fun __ablaRuntimeStmRetry(): never
Inside a transaction: waits until a TVar it read changes, then runs it again. Inside an orElse alternative, the other alternative runs instead.
__ablaRuntimeStmActive (fun)
trusted fun __ablaRuntimeStmActive(): bool
Whether the calling thread is inside a transaction.
__ablaRuntimeStmBegin (fun)
trusted fun __ablaRuntimeStmBegin(descriptor: int): void
Starts the outermost transaction of an attempt.
__ablaRuntimeStmEnd (fun)
trusted fun __ablaRuntimeStmEnd(descriptor: int): void
Ends the outermost transaction (committed, rolled back or abandoned).
__ablaRuntimeStmRelease (fun)
trusted fun __ablaRuntimeStmRelease(descriptor: int, count: int): void
Releases the TVars a failed commit held, the first count of its writes.
__ablaRuntimeStmCommit (fun)
trusted fun __ablaRuntimeStmCommit(descriptor: int): bool
Commits a logged transaction; false when it conflicted (nothing was written).
__ablaRuntimeStmChanged (fun)
trusted fun __ablaRuntimeStmChanged(descriptor: int): bool
Whether a TVar a retrying transaction read has changed since.
__ablaRuntimeStmAwaitChange (fun)
trusted fun __ablaRuntimeStmAwaitChange(descriptor: int): void
Blocks until the recorded version of a variable in the transaction read set changes.
__ablaRuntimeStmJoin (fun)
trusted fun __ablaRuntimeStmJoin(descriptor: int): void
No longer running alone. (Plain stores across a fence: a checked export's recovery reaches this in every program that has one.)
__ablaRuntimeStmBackOff (fun)
trusted fun __ablaRuntimeStmBackOff(descriptor: int): void
A failed attempt: wait a random time that doubles with each failure in a row, or after 32 run alone.
__ablaRuntimeStmKeep (fun)
trusted fun __ablaRuntimeStmKeep(descriptor: int, value: any, index: int): void
Keeps, while an orElse alternative runs, what a write over write entry index replaces.
__ablaRuntimeStmUndoTo (fun)
trusted fun __ablaRuntimeStmUndoTo(descriptor: int, writes: int, kept: int): void
Undoes the writes since an orElse alternative began (writes write entries and kept kept ones then), newest first. Its reads stay: when the other alternative retries too, the transaction waits for any of them to change.
__ablaRuntimeStmOrElse (fun)
trusted fun __ablaRuntimeStmOrElse(first: any, second: any): any
first orElse second, inside a transaction (atomic { first } orElse { second } runs inside one): first's result, or, when it retries, second's after first's writes are undone. A conflict abandons the whole attempt.
__ablaRuntimeStmAtomic (fun)
trusted fun __ablaRuntimeStmAtomic(closure: any): any
Runs closure (no arguments) as a transaction and returns its result. Inside another transaction it joins that one.
__ablaRuntimeStmRecover (fun)
trusted fun __ablaRuntimeStmRecover(): void
A panic a checked export caught inside a transaction: a direct one's writes are undone, newest first; a logged one's were never made. The root frames went with the export's.
__ablaRuntimeStmSetAlwaysLogged (fun)
trusted fun __ablaRuntimeStmSetAlwaysLogged(logged: bool): void
Tests: run every transaction logged, also on one thread.
__ablaRuntimeStmCount (fun)
trusted fun __ablaRuntimeStmCount(offset: int): int
Abandoned attempts and logged commits so far (0 before any transaction): the running threads' counts and those of the threads that ended.
__ablaRuntimeStmAbandoned (fun)
trusted fun __ablaRuntimeStmAbandoned(): int
Returns the number of abandoned transaction attempts across current and exited threads.
__ablaRuntimeStmCommits (fun)
trusted fun __ablaRuntimeStmCommits(): int
Returns the number of logged transaction commits across current and exited threads.
Built from Abla v0.2.79 source ba5d6b7d. Examples and generated signatures follow that source revision.