Class LockAnalysis
java.lang.Object
org.ek9lang.compiler.phase5.lockanalysis.LockAnalysis
- All Implemented Interfaces:
Serializable
Single source of truth for slice-2 deadlock analysis results.
Populated during phase 5 by LockAnalysisListener (intra-function, Phase B.1)
and InterproceduralLockAnalyzer (workspace-wide mayEnter fixpoint, Phase C).
Persisted on CompilableProgram for post-compilation access by MCP query tools
and the IDE deadlock-detail panel.
Lifecycle: transient per-compile — each compilation rebuilds the analysis from
scratch and replaces the previous instance atomically at the end of phase 5.
Same lifecycle as CallGraph and the quality trackers.
Records hold direct ISymbol/IToken references for in-process
navigation; string stableId fields allow cross-reference and serialisation
to MCP/IDE wire formats via dedicated extractor classes.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidaddDeadlock(DeadlockChain chain) voidvoidaddMutexKeyBody(MutexKeyBody body) intintintintintkeyBodyFor(String enterSiteId) Look up theMutexKeyBody.stableId()paired with the given enter call site (if any).The workspace-wide lock-precedence graph.lookupCallArgBindings(String callerFqn, String calleeFqn, String sourceLocation) Look up arg→param bindings recorded for a specific call edge.lookupCallArgBindingsAggregated(String callerFqn, String calleeFqn) lookupIdentity(String stableId) lookupKeyBodyById(String stableId) lookupPureGetterReturnFields(String methodFqn) Look up the set of fields a pure-getter method may return.lookupSummary(String functionFqn) voidpairEnterSiteWithKeyBody(String enterSiteId, String keyBodyId) voidputSummary(String functionFqn, FunctionLockSummary summary) voidrecordCallArgBindings(String callerFqn, String calleeFqn, String sourceLocation, Map<String, String> bindings) Record arg→param bindings for one call edge.voidrecordPureGetterReturnField(String methodFqn, ISymbol returnedField) Record that a pure-getter method (by FQN) returns the given field symbol.voidregisterLockIdentity(LockIdentityDescriptor descriptor)
-
Constructor Details
-
LockAnalysis
public LockAnalysis()
-
-
Method Details
-
addEnterCallSite
-
addMutexKeyBody
-
registerLockIdentity
-
putSummary
-
addDeadlock
-
addCrossThreadEdge
-
pairEnterSiteWithKeyBody
-
recordCallArgBindings
public void recordCallArgBindings(String callerFqn, String calleeFqn, String sourceLocation, Map<String, String> bindings) Record arg→param bindings for one call edge. Used by Phase C.2 to substitute placeholder identities when composing the callee'smayEnterinto the caller's summary.- Parameters:
callerFqn- fully-qualified name of the calling function.calleeFqn- fully-qualified name of the resolved target.sourceLocation- source-location string ("file:line:col") of the call expression — disambiguates multiple calls to the same callee from the same caller.bindings- map from callee parameter FQN to the caller-side identity ID resolved for the argument passed at this site.
-
lookupCallArgBindings
-
recordPureGetterReturnField
-
lookupPureGetterReturnFields
-
lockPrecedenceGraph
The workspace-wide lock-precedence graph. Populated by C.3 with "lockA held when lockB acquired" edges; SCCs of size ≥ 2 are deadlock-capable cycles. -
lookupCallArgBindingsAggregated
-
enterSites
-
keyBodies
-
identitiesById
-
summariesByFqn
-
deadlocks
-
crossThreadEdges
-
keyBodyFor
Look up theMutexKeyBody.stableId()paired with the given enter call site (if any). Returnsnullwhen the enter() call's argument isn't a MutexKey body — e.g. a non-handler call, or a handler we couldn't resolve. -
lookupIdentity
-
lookupSummary
-
lookupKeyBodyById
-
enterSiteCount
public int enterSiteCount() -
keyBodyCount
public int keyBodyCount() -
identityCount
public int identityCount() -
deadlockCount
public int deadlockCount() -
crossThreadEdgeCount
public int crossThreadEdgeCount()
-