Skip to main content

Module map

Module map 

Source
Expand description

Go maps.

A map is a handle to one heap object holding an open-addressing table. Keys and values are stored by value — Go forbids &m[k], so map elements need no places — and the object’s trace walks the live entries, which is how keys and values stay reachable.

Hashing follows Go’s rules rather than Rust’s: a key type provides GoKey, floats hash by value (so NaN is never found again, as in Go), and interfaces hash through their type descriptor.

Iteration starts at a pseudo-random bucket, like gc, so programs cannot come to depend on the order.

M1 status: one table, grown by rehashing, with no incremental growth and no per-size-class allocation.

Structs§

GoMap
A Go map[K]V.
MapIter
State of a for k, v := range m loop.
MapObj
The heap object behind a map handle.

Traits§

GoKey
A key type: Go’s equality and hashing for map keys.

Functions§

mix
Mixes a word into a hash. Any avalanche would do; Go’s own hash is seeded per process and not reproduced here.