From e306d0606379cc9330302f97f237ca3ef55fee98 Mon Sep 17 00:00:00 2001 From: Makdon Date: Wed, 7 Apr 2021 15:24:46 +0000 Subject: [PATCH] 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: https://github.com/golang/go/commit/de65151e507e7b3c8e46d74f223d7c562177bedc https://github.com/golang/go/commit/e4895ab4c0eb44de6ddc5dc8d860a827b20d2781 Change-Id: Ieed5c48049ffe6889c08e164972fc7825653ac05 GitHub-Last-Rev: eec9c2328d0be40842c3994f26f26f03fa650a91 GitHub-Pull-Request: golang/go#45421 Reviewed-on: https://go-review.googlesource.com/c/go/+/307930 Reviewed-by: Keith Randall Trust: Emmanuel Odeke --- src/cmd/compile/internal/walk/range.go | 4 +++- src/runtime/map.go | 10 +++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/cmd/compile/internal/walk/range.go b/src/cmd/compile/internal/walk/range.go index 5ab24b21884..80bd8750fae 100644 --- a/src/cmd/compile/internal/walk/range.go +++ b/src/cmd/compile/internal/walk/range.go @@ -168,7 +168,9 @@ func walkRange(nrange *ir.RangeStmt) ir.Node { hit := nrange.Prealloc th := hit.Type() - keysym := th.Field(0).Sym // depends on layout of iterator struct. See reflect.go:MapIterType + // depends on layout of iterator struct. + // See cmd/compile/internal/reflectdata/reflect.go:MapIterType + keysym := th.Field(0).Sym elemsym := th.Field(1).Sym // ditto fn := typecheck.LookupRuntime("mapiterinit") diff --git a/src/runtime/map.go b/src/runtime/map.go index 0beff57a1a5..40e19c92949 100644 --- a/src/runtime/map.go +++ b/src/runtime/map.go @@ -113,7 +113,7 @@ func isEmpty(x uint8) bool { // A header for a Go map. type hmap struct { - // Note: the format of the hmap is also encoded in cmd/compile/internal/gc/reflect.go. + // Note: the format of the hmap is also encoded in cmd/compile/internal/reflectdata/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 @@ -159,11 +159,11 @@ type bmap struct { } // A hash iteration structure. -// If you modify hiter, also change cmd/compile/internal/gc/reflect.go to indicate +// If you modify hiter, also change cmd/compile/internal/reflectdata/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/compile/internal/gc/range.go). - elem unsafe.Pointer // Must be in second position (see cmd/compile/internal/gc/range.go). + key unsafe.Pointer // Must be in first position. Write nil to indicate iteration end (see cmd/compile/internal/walk/range.go). + elem unsafe.Pointer // Must be in second position (see cmd/compile/internal/walk/range.go). t *maptype h *hmap buckets unsafe.Pointer // bucket ptr at hash_iter initialization time @@ -810,7 +810,7 @@ func mapiterinit(t *maptype, h *hmap, it *hiter) { } if unsafe.Sizeof(hiter{})/sys.PtrSize != 12 { - throw("hash_iter size incorrect") // see cmd/compile/internal/gc/reflect.go + throw("hash_iter size incorrect") // see cmd/compile/internal/reflectdata/reflect.go } it.t = t it.h = h