Class InterproceduralLockAnalyzer
java.lang.Object
org.ek9lang.compiler.phase5.lockanalysis.InterproceduralLockAnalyzer
Phase C.2 of slice-2 deadlock detection: compute per-function
mayEnter
summaries by composing direct enters with reachable enters via the call graph
and CrossThreadEdge list.
Algorithm: monotone worklist iteration to fixpoint. For each function
with an outgoing edge to g, add to mayEnter(f) every
TransitiveEnterRecord in mayEnter(g), with the edge kind
composed against the path kind (any cross-thread edge poisons the whole
path). Sets only grow, so the iteration terminates even with cyclic call
graphs.
Edge kind composition (per EK9_CONCURRENCY_MODEL.md §5.2):
SAME ∘ SAME = SAME; any other combination is CROSS_THREAD.
See EdgeKind.composeWith(EdgeKind).
First-cut simplifications:
- No explicit SCC condensation. Worklist iteration handles cycles by construction (monotone sets). Tarjan-based topological processing would reduce iteration count for deep linear chains; can be added later if profiling justifies it.
- No parameter substitution. Lock identities expressed as parameter-rooted tokens in the callee propagate as-is, even though semantically they alias caller-supplied values. The dominant EK9 pattern is field-rooted locks (identities are stable across call boundaries), so this affects a minority of cases. Phase C.3 may over-flag parameter-rooted reentrancy until a follow-up adds proper substitution.
Outputs: every FunctionLockSummary in
LockAnalysis.summariesByFqn() has its mayEnter field
populated with the transitive closure. Summaries are auto-created for any
function reached in the call graph that doesn't already have one.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
InterproceduralLockAnalyzer
-
-
Method Details
-
analyse
public void analyse()
-