| 1432 | } |
| 1433 | |
| 1434 | void cbm_work_note_ht(cbm_work_kind_t kind, void *site, const void *table, const char *key, |
| 1435 | uint64_t generation, bool hit) { |
| 1436 | if (!cbm_memev_enabled()) { |
| 1437 | return; |
| 1438 | } |
| 1439 | tl_state_t *st = tl_get(); |
| 1440 | if (!st || st->busy) { |
| 1441 | return; |
| 1442 | } |
| 1443 | st->busy = true; |
| 1444 | uint64_t repeat = 0; |
| 1445 | if (kind == CBM_WORK_HT_GET) { |
| 1446 | uint64_t key_hash = path_hash(key); |
| 1447 | ht_pair_t *slot = |
| 1448 | &st->ht_cache[mix((uint64_t)(uintptr_t)table ^ (key_hash * 0x9e3779b97f4a7c15ULL)) & |
| 1449 | (MEMEV_REPEAT_SLOTS - 1)]; |
| 1450 | repeat = |
| 1451 | (slot->table == table && slot->key_hash == key_hash && slot->generation == generation) |
| 1452 | ? 1 |
| 1453 | : 0; |
| 1454 | slot->table = table; |
| 1455 | slot->key_hash = key_hash; |
| 1456 | slot->generation = generation; |
| 1457 | } |
| 1458 | work_add(st, kind, (uintptr_t)site, 0, (kind == CBM_WORK_HT_GET && !hit) ? 1 : 0, 0, repeat); |
| 1459 | st->busy = false; |
| 1460 | } |
| 1461 | |
| 1462 | /* ── merge ────────────────────────────────────────────────────────────*/ |
| 1463 | static void flush_state(tl_state_t *st) { |
no test coverage detected