Skip to main content

Module ir_cache

Module ir_cache 

Source
Expand description

Thread-safe IR cache for compiled function arities.

Each CljxFnArity is assigned a unique ir_arity_id at creation time. When a function is called, the cache is consulted:

  • NotAttempted → try lowering via the Clojure compiler
  • Cached(ir) → execute via IR interpreter
  • Unsupported → fall back to tree-walking (don’t retry)

The hot path (get_cached) uses RwLock so concurrent reads don’t contend. Writes (store) are infrequent (only during lowering).

Enums§

IrCacheEntry
State of an IR cache entry for one function arity.

Functions§

get_cached
Look up a cached IR function by arity ID. Returns None if not cached or if lowering previously failed. Returns Some(ir) if cached.
should_attempt
Check if lowering should be attempted for this arity. Returns true if the entry is NotAttempted (or absent).
store_cached
Store a successful IR compilation result.
store_unsupported
Mark an arity as unsupported (lowering failed; don’t retry).