1
0
mirror of https://github.com/golang/go synced 2024-10-02 22:31:22 -06:00

cmd/compile: rename mapbucket to bmap

This makes the name of the function to construct the map bucket type
consistent with runtimes naming and the existing hmap function.

Change-Id: If4d8b4a54c92ab914d4adcb96022b48d8b5db631
Reviewed-on: https://go-review.googlesource.com/59915
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
Martin Möhrmann 2017-08-29 21:10:17 +02:00
parent 4c9989a360
commit dcef97e088
2 changed files with 10 additions and 9 deletions

View File

@ -96,7 +96,8 @@ func makefield(name string, t *types.Type) *types.Field {
return f
}
func mapbucket(t *types.Type) *types.Type {
// bmap makes the map bucket type given the type of the map.
func bmap(t *types.Type) *types.Type {
if t.MapType().Bucket != nil {
return t.MapType().Bucket
}
@ -204,16 +205,16 @@ func mapbucket(t *types.Type) *types.Type {
Fatalf("bucket align not multiple of value align %v", t)
}
if keys.Offset%int64(keytype.Align) != 0 {
Fatalf("bad alignment of keys in mapbucket for %v", t)
Fatalf("bad alignment of keys in bmap for %v", t)
}
if values.Offset%int64(valtype.Align) != 0 {
Fatalf("bad alignment of values in mapbucket for %v", t)
Fatalf("bad alignment of values in bmap for %v", t)
}
// Double-check that overflow field is final memory in struct,
// with no padding at end. See comment above.
if overflow.Offset != bucket.Width-int64(Widthptr) {
Fatalf("bad offset of overflow in mapbucket for %v", t)
Fatalf("bad offset of overflow in bmap for %v", t)
}
t.MapType().Bucket = bucket
@ -229,7 +230,7 @@ func hmap(t *types.Type) *types.Type {
return t.MapType().Hmap
}
bmap := mapbucket(t)
bmap := bmap(t)
// build a struct:
// type hmap struct {
@ -281,7 +282,7 @@ func hiter(t *types.Type) *types.Type {
}
hmap := hmap(t)
bmap := mapbucket(t)
bmap := bmap(t)
// build a struct:
// type hiter struct {
@ -1301,7 +1302,7 @@ ok:
case TMAP:
s1 := dtypesym(t.Key())
s2 := dtypesym(t.Val())
s3 := dtypesym(mapbucket(t))
s3 := dtypesym(bmap(t))
s4 := dtypesym(hmap(t))
ot = dcommontype(lsym, ot, t)
ot = dsymptr(lsym, ot, s1.Linksym(), 0)
@ -1324,7 +1325,7 @@ ok:
ot = duint8(lsym, ot, 0) // not indirect
}
ot = duint16(lsym, ot, uint16(mapbucket(t).Width))
ot = duint16(lsym, ot, uint16(bmap(t).Width))
ot = duint8(lsym, ot, uint8(obj.Bool2int(isreflexive(t.Key()))))
ot = duint8(lsym, ot, uint8(obj.Bool2int(needkeyupdate(t.Key()))))
ot = dextratype(lsym, ot, t, 0)

View File

@ -1464,7 +1464,7 @@ opswitch:
// are stored with an indirection. So max bucket size is 2048+eps.
// var bv bmap
bv := temp(mapbucket(t))
bv := temp(bmap(t))
zero = nod(OAS, bv, nil)
zero = typecheck(zero, Etop)