MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / tableLiveSlot

Function tableLiveSlot

include/daScript/simulate/runtime_table.h:77–82  ·  view source on GitHub ↗

Liveness of slot i. Packed tables are dense in [0,size) (insertion order, swap-remove on erase), so a slot is live iff i<size — no hash read. Large tables are open-addressed: a string table is live iff the 32-bit hash is past the KILLED sentinel; a non-string table iff the 1-byte control is past TOMBSTONE. EVERY liveness scan (GC, RTTI/data walk, iterators) must route through this: representation

Source from the content-addressed store, hash-verified

75 // this: representation varies by capacity AND key type (a packed string table stores 64-bit
76 // hashes), so a raw 32-bit `hashes[i] > KILLED` read would misindex it.
77 __forceinline bool tableLiveSlot ( const Table & tab, uint64_t i ) {
78 // Only STRING tables pack (dense [0,size)); non-string keys are open-addressed at every capacity.
79 if ( !tab.tableNoHash && tab.capacity <= TABLE_MAX_LINEAR_CAPACITY ) return i < tab.size;
80 if ( tab.tableNoHash ) return ((const uint8_t *) tab.hashes)[i] > CTRL_TOMBSTONE;
81 return tab.hashes[i] > HASH_KILLED64;
82 }
83
84 // Bytes per hash slot for the type-erased table-size computations (free / GC range) that have
85 // no C++ KeyType. The width is NOT a pure function of capacity: a non-string key stores no

Callers 7

walk_tableMethod · 0.85
nextValidMethod · 0.85
builtin_table_get_keyFunction · 0.85
walk_tableMethod · 0.85
walk_tableMethod · 0.85
any_table_foreachFunction · 0.85
table_for_eachFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected