Class LockAnalysis
- All Implemented Interfaces:
Serializable
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).lockIdentitiesForKeyBody(String keyBodyId) THE body-to-lock join: the lock identities aMutexKeybody executes under.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.lookupReceiverObject(String enterSiteStableId) The receiver object for an enter site, ornullwhen the lock is not field-rooted (parameter/allocation-rooted) or the object was not extracted.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.voidrecordReceiverObject(String enterSiteStableId, ReceiverObjectPath object) Record the field-rooted receiver object for an enter site (Stage-3 Phase 2).voidregisterLockIdentity(LockIdentityDescriptor descriptor)
-
Constructor Details
-
LockAnalysis
public LockAnalysis()
-
-
Method Details
-
addEnterCallSite
-
recordReceiverObject
Record the field-rooted receiver object for an enter site (Stage-3 Phase 2). -
lookupReceiverObject
The receiver object for an enter site, ornullwhen the lock is not field-rooted (parameter/allocation-rooted) or the object was not extracted. -
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. -
lockIdentitiesForKeyBody
THE body-to-lock join: the lock identities aMutexKeybody executes under.🔑 Read this, never
MutexKeyBody.outerLockIdentityId()— that field is registered as the"pending"placeholder when the body is declared (the enter call that binds it has not been seen yet) and is never rewritten. The binding that IS recorded runs the other way, enter site to key body (keyBodyFor(String)), and an enter site can name more than one identity (a parameter-rooted lock may be any of several), so the honest answer is a set, not a string.- Parameters:
keyBodyId- theMutexKeyBody.stableId()- Returns:
- the identity ids of every lock whose enter site passes this body, in enter-site order; empty when no enter call was paired with it
-
lookupIdentity
-
lookupSummary
-
lookupKeyBodyById
-
enterSiteCount
public int enterSiteCount() -
keyBodyCount
public int keyBodyCount() -
identityCount
public int identityCount() -
deadlockCount
public int deadlockCount() -
crossThreadEdgeCount
public int crossThreadEdgeCount()
-