/** * Series registers: the per-bar history of one value, `compiled-program.md` * 2.10 and 3.2. * * Only a register has history, and `HIST` and `HISTP` are the only way to read * it. A register holds one entry per bar plus a cell for the bar currently * executing; the current cell is set to absent at step 3, `SSTORE` writes it, * `HIST` at offset 0 reads it, and at step 7 it becomes the history entry for * that bar, **replacing whatever a previous execution of the same bar left * there**. That replacement is half of what makes a moving bar idempotent; step * 2's truncation is the other half. * * **Trimming is amortised rather than done per bar.** Step 10 drops entries * older than `limits.history`, and dropping from the front of an array every bar * is quadratic over a long dataset. The registers share one base index, so a * trim is one splice across every register, and it runs only once the stale * entries are worth a pass. Retaining a little more than the declared depth * cannot be observed, because a read past the depth is OS4002 before it ever * reaches the array. */ import type { Value } from './values/index.js'; export declare class Registers { private readonly histories; private readonly current; /** The bar index that sits at position 0 of every history. */ private base; constructor(count: number); count(): number; /** Step 2: discard any entry a previous execution of bar `bar` wrote. */ truncate(bar: number): void; /** Step 3: every register's current bar cell starts absent. */ clearCurrent(): void; set(register: number, value: Value): void; /** `SLOAD`: the register's value for the bar being executed. */ get(register: number): Value; /** Step 7: the current bar cell becomes this bar's history entry. */ close(bar: number): void; /** * The value a register held `back` bars before `bar`. * * Offset 0 is the bar being executed and reads the current cell, which is why * `close` has not run yet when a script reads `x[0]`. */ at(register: number, bar: number, back: number): Value; /** Step 10: drop entries older than the retained depth. */ trim(bar: number, depth: number | null): void; /** Every value a register holds, for the heap's reachability walk. */ walk(visit: (value: Value) => void): void; } //# sourceMappingURL=registers.d.ts.map