Bind one parameter name for the lifetime of the frame currently on top. */
| 213 | |
| 214 | /* Bind one parameter name for the lifetime of the frame currently on top. */ |
| 215 | static 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. */ |
| 244 | static void py_param_unwind_to(WalkState *state, int base) { |
no test coverage detected