ek9_query_lock_identity
Answers first: status, identityCount, then identities[] {stableId, origin, displayName, originSymbol, originLocation, payload}; stableId joins ek9_query_enter_sites and ek9_query_deadlock_chain.
When to use it
'What MutexLocks does this program have' is one call with no arguments - every distinct lock with its origin, declaration and stableId.
When not to use it
- the headline counts only, not the full list (use
ek9_query_lock_analysis) - the acquisition SITES (where locks are entered), not the identities (use
ek9_query_enter_sites) - the detected deadlock risk CHAINS, not the inventory (use
ek9_query_deadlock_chain) - details of one specific symbol under a cursor (use
ek9_inspect_symbol_at_cursor)
Details
status is ok | not-compiled (no compiled program, or PRE_IR_CHECKS did not produce a LockAnalysis — nextStep ek9_compile). On 'ok', identities[] carries per-lock {stableId, origin, displayName, originSymbol, originLocation}; origin is FIELD_ROOTED | ALLOCATION | PARAMETER | CAPTURE; stableId correlates with enter_sites.sites[].lockIdentityIds and deadlock_chain outerLock/innerLock. originSymbol and originLocation may be null; mangled _Function_/_Class_ names render friendly (fn/cls); no filtering yet. Each identity also carries payload {bodies, contained, mayEscape, unknown} — how many MutexKey bodies run under this lock and whether their lockedItem stays inside it (the same sweep as ek9_query_mutex_payload, which names the escaping bodies); absent when no enter call pairs a body with the lock.
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
{
"identities" : [ ],
"identityCount" : 0,
"meta" : {
"serverMs" : "<timing>"
},
"status" : "ok"
}
No compiled program
Request
{ }
Response
{
"meta" : {
"serverMs" : "<timing>"
},
"nextStep" : "ek9_compile",
"note" : "No compiled program is available - nothing can be queried until the workspace compiles.",
"status" : "not-compiled"
}
Populated workspace
Request
{ }
Response
{
"identities" : [ {
"displayName" : "parameter lock",
"origin" : "PARAMETER",
"originLocation" : {
"column" : 9,
"file" : "Locks.ek9",
"line" : 7
},
"originSymbol" : {
"category" : "VARIABLE",
"displayName" : "lock",
"fullyQualifiedName" : "com.example.locks::lock",
"name" : "lock"
},
"payload" : {
"bodies" : 1,
"contained" : 1,
"mayEscape" : 0,
"unknown" : 0
},
"stableId" : "placeholder:com.example.locks::lock"
} ],
"identityCount" : 1,
...
Cut short here: 5 more lines. The whole recorded call.