julia
eb695158 - inference: consolidate recursion detection, return cached results for recursed edges (#61180)

Commit
33 days ago
inference: consolidate recursion detection, return cached results for recursed edges (#61180) inference: return cached results for recursed edges instead of re-inferring An `@inline` callsite whose target is already on the inference callstack and whose cached CodeInstance has no source was re-inferred with `CACHE_MODE_LOCAL`. That recreates the cycle, which cannot be merged when the top frame is uncached, so the edge was poisoned to `Any` with unknown effects. Repeated effects queries of recursive `@inline` functions degraded after the first run. Have the callstack walk in `abstract_call_method` record whether the exact specialization is on the stack (`edgerecursed`) and pass it through `typeinf_edge` to `MethodCallResult`, replacing the `is_edge_recursed` re-walk. In `typeinf_edge`, skip `resolve_call_cycle!` when the walk found no cycle and the signature was not limited, and return the cached result for a sourceless CodeInstance whose target is on the stack instead of re-inferring it. `resolve_call_cycle!` is split into `find_call_cycle` plus resolution so the on-stack check can be reused. Fixes #61177 Fixes #56321 Assisted-by: Claude Code (Fable 5.1) Assisted-by: Codex (GPT-6)
Author
Parents
Loading