ek9_query_enter_sites
Answers first: siteCount, then sites[] (stableId, kind, receiver, lockIdentityIds, location, enclosingFunction) - every lock acquisition, workspace-wide.
When to use it
Where does the program acquire locks - every MutexLock.enter() / tryEnter() site - one call, no arguments. Also the route from a lock identity to the sites that acquire it (match lockIdentityIds).
When not to use it
- The distinct locks themselves, not the sites that acquire them - use
ek9_query_lock_identity. - You want detected risk chains with rationale, not the raw acquisition inventory - use
ek9_query_deadlock_chain. - You only need the count (enterSiteCount), not the full list - use
ek9_query_lock_analysis. - You want general call relationships for a method, not lock-acquisition sites - use
ek9_query_call_graph.
Details
status is available (siteCount + sites[]) | no-analysis (PRE_IR_CHECKS did not run — recompile past it and retry) | not-available (compile first). Each site: stableId, kind (ENTER/TRY_ENTER), receiver display form, lockIdentityIds[] (singleton in the common case; multi-element on branch-joined/polymorphic receivers — correlate with ek9_query_lock_identity), location {file, line(1-based), column(0-based)}, and enclosingFunction {fullyQualifiedName, name, displayName, category} or null. Synthetic inline MutexKey-body functions render their mangled name in friendly 'fn' form; no filtering yet.
Arguments
None of its own.
Recorded calls
Real calls, recorded against small projects and checked on every build - a changed answer fails it.
No locks workspace
Request
{ }
Response
{
"meta" : {
"serverMs" : "<timing>"
},
"siteCount" : 0,
"sites" : [ ],
"status" : "available"
}
Populated workspace
Request
{ }
Response
{
"meta" : {
"serverMs" : "<timing>"
},
"siteCount" : 1,
"sites" : [ {
"enclosingFunction" : {
"category" : "FUNCTION",
"displayName" : "runWithLock",
"fullyQualifiedName" : "com.example.locks::runWithLock",
"name" : "runWithLock"
},
"kind" : "ENTER",
"location" : {
"column" : 19,
"file" : "file://<workspace-root>/Locks.ek9",
"line" : 13
},
"lockIdentityIds" : [ "placeholder:com.example.locks::lock" ],
"receiver" : "lock...lock",
"stableId" : "enter:file://<workspace-root>/Locks.ek9:13:19"
} ],
"status" : "available"
}