const maxTableCapacity … var _ … type table … func newTable(typ *abi.SwissMapType, capacity uint64, index int, localDepth uint8) *table { … } // reset resets the table with new, empty groups with the specified new total // capacity. func (t *table) reset(typ *abi.SwissMapType, capacity uint16) { … } // Preconditions: table must be empty. func (t *table) resetGrowthLeft() { … } func (t *table) Used() uint64 { … } // Get performs a lookup of the key that key points to. It returns a pointer to // the element, or false if the key doesn't exist. func (t *table) Get(typ *abi.SwissMapType, m *Map, key unsafe.Pointer) (unsafe.Pointer, bool) { … } // getWithKey performs a lookup of key, returning a pointer to the version of // the key in the map in addition to the element. // // This is relevant when multiple different key values compare equal (e.g., // +0.0 and -0.0). When a grow occurs during iteration, iteration perform a // lookup of keys from the old group in the new group in order to correctly // expose updated elements. For NeedsKeyUpdate keys, iteration also must return // the new key value, not the old key value. // hash must be the hash of the key. func (t *table) getWithKey(typ *abi.SwissMapType, hash uintptr, key unsafe.Pointer) (unsafe.Pointer, unsafe.Pointer, bool) { … } func (t *table) getWithoutKey(typ *abi.SwissMapType, hash uintptr, key unsafe.Pointer) (unsafe.Pointer, bool) { … } // PutSlot returns a pointer to the element slot where an inserted element // should be written, and ok if it returned a valid slot. // // PutSlot returns ok false if the table was split and the Map needs to find // the new table. // // hash must be the hash of key. func (t *table) PutSlot(typ *abi.SwissMapType, m *Map, hash uintptr, key unsafe.Pointer) (unsafe.Pointer, bool) { … } // uncheckedPutSlot inserts an entry known not to be in the table, returning an // entry to the element slot where the element should be written. Used by // PutSlot after it has failed to find an existing entry to overwrite duration // insertion. // // Updates growthLeft if necessary, but does not update used. // // Requires that the entry does not exist in the table, and that the table has // room for another element without rehashing. // // Requires that there are no deleted entries in the table. // // Never returns nil. func (t *table) uncheckedPutSlot(typ *abi.SwissMapType, hash uintptr, key unsafe.Pointer) unsafe.Pointer { … } func (t *table) Delete(typ *abi.SwissMapType, m *Map, key unsafe.Pointer) { … } // tombstones returns the number of deleted (tombstone) entries in the table. A // tombstone is a slot that has been deleted but is still considered occupied // so as not to violate the probing invariant. func (t *table) tombstones() uint16 { … } // Clear deletes all entries from the map resulting in an empty map. func (t *table) Clear(typ *abi.SwissMapType) { … } type Iter … // Init initializes Iter for iteration. func (it *Iter) Init(typ *abi.SwissMapType, m *Map) { … } func (it *Iter) Initialized() bool { … } // Map returns the map this iterator is iterating over. func (it *Iter) Map() *Map { … } // Key returns a pointer to the current key. nil indicates end of iteration. // // Must not be called prior to Next. func (it *Iter) Key() unsafe.Pointer { … } // Key returns a pointer to the current element. nil indicates end of // iteration. // // Must not be called prior to Next. func (it *Iter) Elem() unsafe.Pointer { … } // Next proceeds to the next element in iteration, which can be accessed via // the Key and Elem methods. // // The table can be mutated during iteration, though there is no guarantee that // the mutations will be visible to the iteration. // // Init must be called prior to Next. func (it *Iter) Next() { … } // Replaces the table with one larger table or two split tables to fit more // entries. Since the table is replaced, t is now stale and should not be // modified. func (t *table) rehash(typ *abi.SwissMapType, m *Map) { … } // Bitmask for the last selection bit at this depth. func localDepthMask(localDepth uint8) uintptr { … } // split the table into two, installing the new tables in the map directory. func (t *table) split(typ *abi.SwissMapType, m *Map) { … } // grow the capacity of the table by allocating a new table with a bigger array // and uncheckedPutting each element of the table into the new table (we know // that no insertion here will Put an already-present value), and discard the // old table. func (t *table) grow(typ *abi.SwissMapType, m *Map, newCapacity uint16) { … } type probeSeq … func makeProbeSeq(hash uintptr, mask uint64) probeSeq { … } func (s probeSeq) next() probeSeq { … }