MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / py_param_bind

Function py_param_bind

internal/cbm/extract_unified.c:215–241  ·  view source on GitHub ↗

Bind one parameter name for the lifetime of the frame currently on top. */

Source from the content-addressed store, hash-verified

213
214/* Bind one parameter name for the lifetime of the frame currently on top. */
215static void py_param_bind(WalkState *state, const char *name) {
216 if (state->py_param_tracking_failed || !name || !name[0]) {
217 return;
218 }
219 /* Grow before inserting: the probe below must always find a free slot, and
220 * a table above ~70% load degrades toward linear probing. */
221 if ((state->py_param_slot_used + 1) * 10 >= state->py_param_slot_capacity * 7) {
222 if (!py_param_grow(state)) {
223 state->py_param_tracking_failed = true;
224 return;
225 }
226 }
227 if (!py_param_stack_reserve(state)) {
228 state->py_param_tracking_failed = true;
229 return;
230 }
231 uint32_t hash = py_param_hash(name);
232 CBMParamSlot *slot = py_param_slot(state, name, hash);
233 if (slot->hash == 0) {
234 slot->hash = hash;
235 slot->name = name;
236 slot->count = 0;
237 state->py_param_slot_used++;
238 }
239 slot->count++;
240 state->py_param_stack[state->py_param_stack_count++] = name;
241}
242
243/* Unwind to a frame's entry height, undoing exactly what that frame bound. */
244static void py_param_unwind_to(WalkState *state, int base) {

Callers 1

py_bind_scope_parametersFunction · 0.85

Calls 4

py_param_growFunction · 0.85
py_param_stack_reserveFunction · 0.85
py_param_hashFunction · 0.85
py_param_slotFunction · 0.85

Tested by

no test coverage detected