// the given map type. This type is not visible to users -
// we include only enough information to generate a correct GC
// program for it.
-// Make sure this stays in sync with ../../../../runtime/hashmap.go!
+// Make sure this stays in sync with ../../../../runtime/map.go!
const (
BUCKETSIZE = 8
MAXKEYSIZE = 128
// buckets can be marked as having no pointers.
// Arrange for the bucket to have no pointers by changing
// the type of the overflow field to uintptr in this case.
- // See comment on hmap.overflow in ../../../../runtime/hashmap.go.
+ // See comment on hmap.overflow in ../../../../runtime/map.go.
otyp := types.NewPtr(bucket)
if !types.Haspointers(valtype) && !types.Haspointers(keytype) {
otyp = types.Types[TUINTPTR]
}
// hmap builds a type representing a Hmap structure for the given map type.
-// Make sure this stays in sync with ../../../../runtime/hashmap.go.
+// Make sure this stays in sync with ../../../../runtime/map.go.
func hmap(t *types.Type) *types.Type {
if t.MapType().Hmap != nil {
return t.MapType().Hmap
// nevacuate uintptr
// extra unsafe.Pointer // *mapextra
// }
- // must match ../../../../runtime/hashmap.go:hmap.
+ // must match ../../../../runtime/map.go:hmap.
fields := []*types.Field{
makefield("count", types.Types[TINT]),
makefield("flags", types.Types[TUINT8]),
}
// hiter builds a type representing an Hiter structure for the given map type.
-// Make sure this stays in sync with ../../../../runtime/hashmap.go.
+// Make sure this stays in sync with ../../../../runtime/map.go.
func hiter(t *types.Type) *types.Type {
if t.MapType().Hiter != nil {
return t.MapType().Hiter
// bucket uintptr
// checkBucket uintptr
// }
- // must match ../../../../runtime/hashmap.go:hiter.
+ // must match ../../../../runtime/map.go:hiter.
fields := []*types.Field{
makefield("key", types.NewPtr(t.Key())), // Used in range.go for TMAP.
makefield("val", types.NewPtr(t.Val())), // Used in range.go for TMAP.
// a = *var
a := n.List.First()
- if w := t.Val().Width; w <= 1024 { // 1024 must match ../../../../runtime/hashmap.go:maxZero
+ if w := t.Val().Width; w <= 1024 { // 1024 must match ../../../../runtime/map.go:maxZero
fn := mapfn(mapaccess2[fast], t)
r = mkcall1(fn, fn.Type.Results(), init, typename(t), r.Left, key)
} else {
key = nod(OADDR, key, nil)
}
- if w := t.Val().Width; w <= 1024 { // 1024 must match ../../../../runtime/hashmap.go:maxZero
+ if w := t.Val().Width; w <= 1024 { // 1024 must match ../../../../runtime/map.go:maxZero
n = mkcall1(mapfn(mapaccess1[fast], t), types.NewPtr(t.Val()), init, typename(t), map_, key)
} else {
z := zeroaddr(w)
var mapdelete = mkmapnames("mapdelete", "")
func mapfast(t *types.Type) int {
- // Check ../../runtime/hashmap.go:maxValueSize before changing.
+ // Check ../../runtime/map.go:maxValueSize before changing.
if t.Val().Width > 128 {
return mapslow
}
}
}
-// Make sure these routines stay in sync with ../../runtime/hashmap.go!
+// Make sure these routines stay in sync with ../../runtime/map.go!
// These types exist only for GC, so we only fill out GC relevant info.
// Currently, that's just size and the GC program. We also fill in string
// for possible debugging use.
)
func bucketOf(ktyp, etyp *rtype) *rtype {
- // See comment on hmap.overflow in ../runtime/hashmap.go.
+ // See comment on hmap.overflow in ../runtime/map.go.
var kind uint8
if ktyp.kind&kindNoPointers != 0 && etyp.kind&kindNoPointers != 0 &&
ktyp.size <= maxKeySize && etyp.size <= maxValSize {
// have a nil bucket pointer due to starting with preallocated buckets
// on the stack. Escaping maps start with a non-nil bucket pointer if
// hint size is above bucketCnt and thereby have more than one bucket.
- // These tests depend on bucketCnt and loadFactor* in hashmap.go.
+ // These tests depend on bucketCnt and loadFactor* in map.go.
t.Run("mapliteral", func(t *testing.T) {
for _, tt := range mapBucketTests {
localMap := map[int]int{}