Skip to content
UNDER THE HOOD

The enforcement ledger

GuardInsert records each access it collected, before any rule removes its guard, in an EnforcementLedger (lib/Frontend/EnforcementLedger.cpp, RFC 0035 §9 and amendment 10); GuardPrune and GuardExpand record what became of each copy of its marker. A row has its function, file, line, column, operation (load, store, rmw, copy, set, lane, disjoint, call:<name>), bytes (0 when computed at run time), outcome and reason:

Outcome Reasons
guarded access, range, string, checked-call, loop-range
proven in-bounds, dominated, merged, optimized (the optimiser removed every copy of the access)
unguarded unsafe

-fweavec-ledger=<path> writes the rows as JSON, weavec-ledger version 3 (EnforcementLedgerVersion): an object with schema, version, producer and units, each unit with its source, object, target, config (checks, zeroInit), summary (accesses, proven, guarded, unguarded) and rows. A path ending in /, or an existing directory, receives <object>.ledger.json per unit; a file receives one ledger, and an invocation that would write more than one is an error. Files are written through a temporary renamed into place. -fweavec-summary (the default when a ledger is written) prints the summary line on standard error:

weavec: lookup.c: 3 accesses: 1 proven, 2 guarded, 0 unguarded