]> Cypherpunks repositories - gostls13.git/commitdiff
runtime,cmd/compile: adjust and correct path names in comments of map code
authorMartin Möhrmann <moehrmann@google.com>
Sat, 17 Feb 2018 17:12:22 +0000 (18:12 +0100)
committerMartin Möhrmann <moehrmann@google.com>
Mon, 30 Apr 2018 13:42:26 +0000 (13:42 +0000)
Some of the comments relative paths do not exist and
reflect does not define its own hmap structure.

Correct paths and consistently reference paths starting from the
go src directory.

Change-Id: I5204a3a98f77d65f17dcde98b847378cea05ad8a
Reviewed-on: https://go-review.googlesource.com/94758
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
src/cmd/compile/internal/gc/reflect.go
src/cmd/compile/internal/gc/walk.go
src/runtime/map.go

index 7614402062c97ee7fda193e58ab257ef4c06908b..df6f8dc151c78e327e10540f2d4f604a13f65294 100644 (file)
@@ -53,7 +53,7 @@ type Sig struct {
 // 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/map.go!
+// Make sure this stays in sync with runtime/map.go.
 const (
        BUCKETSIZE = 8
        MAXKEYSIZE = 128
@@ -137,7 +137,7 @@ func bmap(t *types.Type) *types.Type {
        // 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/map.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]
@@ -207,7 +207,7 @@ func bmap(t *types.Type) *types.Type {
 }
 
 // hmap builds a type representing a Hmap structure for the given map type.
-// Make sure this stays in sync with ../../../../runtime/map.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
@@ -227,7 +227,7 @@ func hmap(t *types.Type) *types.Type {
        //    nevacuate  uintptr
        //    extra      unsafe.Pointer // *mapextra
        // }
-       // must match ../../../../runtime/map.go:hmap.
+       // must match runtime/map.go:hmap.
        fields := []*types.Field{
                makefield("count", types.Types[TINT]),
                makefield("flags", types.Types[TUINT8]),
@@ -257,7 +257,7 @@ func hmap(t *types.Type) *types.Type {
 }
 
 // hiter builds a type representing an Hiter structure for the given map type.
-// Make sure this stays in sync with ../../../../runtime/map.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
@@ -284,7 +284,7 @@ func hiter(t *types.Type) *types.Type {
        //    bucket      uintptr
        //    checkBucket uintptr
        // }
-       // must match ../../../../runtime/map.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.Elem())), // Used in range.go for TMAP.
index cb482e23232453722602e0e0b5317cf7cb0615a5..ca6c95382f9875b84fe2ef43a3d5cdb9053d6429 100644 (file)
@@ -822,7 +822,7 @@ opswitch:
                //   a = *var
                a := n.List.First()
 
-               if w := t.Elem().Width; w <= 1024 { // 1024 must match ../../../../runtime/map.go:maxZero
+               if w := t.Elem().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 {
@@ -1196,7 +1196,7 @@ opswitch:
                                key = nod(OADDR, key, nil)
                        }
 
-                       if w := t.Elem().Width; w <= 1024 { // 1024 must match ../../../../runtime/map.go:maxZero
+                       if w := t.Elem().Width; w <= 1024 { // 1024 must match runtime/map.go:maxZero
                                n = mkcall1(mapfn(mapaccess1[fast], t), types.NewPtr(t.Elem()), init, typename(t), map_, key)
                        } else {
                                z := zeroaddr(w)
@@ -2816,7 +2816,7 @@ var mapassign = mkmapnames("mapassign", "ptr")
 var mapdelete = mkmapnames("mapdelete", "")
 
 func mapfast(t *types.Type) int {
-       // Check ../../runtime/map.go:maxValueSize before changing.
+       // Check runtime/map.go:maxValueSize before changing.
        if t.Elem().Width > 128 {
                return mapslow
        }
index eddb0456221b22aea0251754418eee929b18dd81..2ffd59cb250adf9f5b704171a4c2e10e114a4637 100644 (file)
@@ -72,7 +72,7 @@ const (
        // Maximum key or value size to keep inline (instead of mallocing per element).
        // Must fit in a uint8.
        // Fast versions cannot handle big values - the cutoff size for
-       // fast versions in ../../cmd/internal/gc/walk.go must be at most this value.
+       // fast versions in cmd/compile/internal/gc/walk.go must be at most this value.
        maxKeySize   = 128
        maxValueSize = 128
 
@@ -106,8 +106,8 @@ const (
 
 // A header for a Go map.
 type hmap struct {
-       // Note: the format of the Hmap is encoded in ../../cmd/internal/gc/reflect.go and
-       // ../reflect/type.go. Don't change this structure without also changing that code!
+       // Note: the format of the hmap is also encoded in cmd/compile/internal/gc/reflect.go.
+       // Make sure this stays in sync with the compiler's definition.
        count     int // # live cells == size of map.  Must be first (used by len() builtin)
        flags     uint8
        B         uint8  // log_2 of # of buckets (can hold up to loadFactor * 2^B items)
@@ -152,7 +152,7 @@ type bmap struct {
 }
 
 // A hash iteration structure.
-// If you modify hiter, also change cmd/internal/gc/reflect.go to indicate
+// If you modify hiter, also change cmd/compile/internal/gc/reflect.go to indicate
 // the layout of this structure.
 type hiter struct {
        key         unsafe.Pointer // Must be in first position.  Write nil to indicate iteration end (see cmd/internal/gc/range.go).
@@ -699,7 +699,7 @@ func mapiterinit(t *maptype, h *hmap, it *hiter) {
        }
 
        if unsafe.Sizeof(hiter{})/sys.PtrSize != 12 {
-               throw("hash_iter size incorrect") // see ../../cmd/internal/gc/reflect.go
+               throw("hash_iter size incorrect") // see cmd/compile/internal/gc/reflect.go
        }
        it.t = t
        it.h = h
@@ -1245,5 +1245,5 @@ func reflect_ismapkey(t *_type) bool {
        return ismapkey(t)
 }
 
-const maxZero = 1024 // must match value in ../cmd/compile/internal/gc/walk.go
+const maxZero = 1024 // must match value in cmd/compile/internal/gc/walk.go
 var zeroVal [maxZero]byte