Skip to content

Commit e306d06

Browse files
MakDonodeke-em
authored andcommitted
runtime/map: update comment for gc/reflect
update comment cause gc/reflect.go has been moved to reflectdata/reflect.go In the commit (attach below), gc/reflect.go is moved to reflectdata/reflect.go So the comment referring gc/reflect.go should be updated to reflectdata/reflect.go There maybe other places that refers gc/reflect.go that should be updated. I would work around it soon. commit: de65151 e4895ab Change-Id: Ieed5c48049ffe6889c08e164972fc7825653ac05 GitHub-Last-Rev: eec9c23 GitHub-Pull-Request: #45421 Reviewed-on: https://go-review.googlesource.com/c/go/+/307930 Reviewed-by: Keith Randall <[email protected]> Trust: Emmanuel Odeke <[email protected]>
1 parent b3064b6 commit e306d06

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/cmd/compile/internal/walk/range.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,9 @@ func walkRange(nrange *ir.RangeStmt) ir.Node {
168168

169169
hit := nrange.Prealloc
170170
th := hit.Type()
171-
keysym := th.Field(0).Sym // depends on layout of iterator struct. See reflect.go:MapIterType
171+
// depends on layout of iterator struct.
172+
// See cmd/compile/internal/reflectdata/reflect.go:MapIterType
173+
keysym := th.Field(0).Sym
172174
elemsym := th.Field(1).Sym // ditto
173175

174176
fn := typecheck.LookupRuntime("mapiterinit")

src/runtime/map.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ func isEmpty(x uint8) bool {
113113

114114
// A header for a Go map.
115115
type hmap struct {
116-
// Note: the format of the hmap is also encoded in cmd/compile/internal/gc/reflect.go.
116+
// Note: the format of the hmap is also encoded in cmd/compile/internal/reflectdata/reflect.go.
117117
// Make sure this stays in sync with the compiler's definition.
118118
count int // # live cells == size of map. Must be first (used by len() builtin)
119119
flags uint8
@@ -159,11 +159,11 @@ type bmap struct {
159159
}
160160

161161
// A hash iteration structure.
162-
// If you modify hiter, also change cmd/compile/internal/gc/reflect.go to indicate
162+
// If you modify hiter, also change cmd/compile/internal/reflectdata/reflect.go to indicate
163163
// the layout of this structure.
164164
type hiter struct {
165-
key unsafe.Pointer // Must be in first position. Write nil to indicate iteration end (see cmd/compile/internal/gc/range.go).
166-
elem unsafe.Pointer // Must be in second position (see cmd/compile/internal/gc/range.go).
165+
key unsafe.Pointer // Must be in first position. Write nil to indicate iteration end (see cmd/compile/internal/walk/range.go).
166+
elem unsafe.Pointer // Must be in second position (see cmd/compile/internal/walk/range.go).
167167
t *maptype
168168
h *hmap
169169
buckets unsafe.Pointer // bucket ptr at hash_iter initialization time
@@ -810,7 +810,7 @@ func mapiterinit(t *maptype, h *hmap, it *hiter) {
810810
}
811811

812812
if unsafe.Sizeof(hiter{})/sys.PtrSize != 12 {
813-
throw("hash_iter size incorrect") // see cmd/compile/internal/gc/reflect.go
813+
throw("hash_iter size incorrect") // see cmd/compile/internal/reflectdata/reflect.go
814814
}
815815
it.t = t
816816
it.h = h

0 commit comments

Comments
 (0)