diff options
Diffstat (limited to 'libgo/go/runtime/map.go')
-rw-r--r-- | libgo/go/runtime/map.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/libgo/go/runtime/map.go b/libgo/go/runtime/map.go index 5b9d7102..c96d2c7 100644 --- a/libgo/go/runtime/map.go +++ b/libgo/go/runtime/map.go @@ -128,7 +128,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 @@ -174,11 +174,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 @@ -495,13 +495,13 @@ func mapaccess2(t *maptype, h *hmap, key unsafe.Pointer) (unsafe.Pointer, bool) } hash := t.hasher(key, uintptr(h.hash0)) m := bucketMask(h.B) - b := (*bmap)(unsafe.Pointer(uintptr(h.buckets) + (hash&m)*uintptr(t.bucketsize))) + b := (*bmap)(add(h.buckets, (hash&m)*uintptr(t.bucketsize))) if c := h.oldbuckets; c != nil { if !h.sameSizeGrow() { // There used to be half as many buckets; mask down one more power of two. m >>= 1 } - oldb := (*bmap)(unsafe.Pointer(uintptr(c) + (hash&m)*uintptr(t.bucketsize))) + oldb := (*bmap)(add(c, (hash&m)*uintptr(t.bucketsize))) if !evacuated(oldb) { b = oldb } @@ -544,13 +544,13 @@ func mapaccessK(t *maptype, h *hmap, key unsafe.Pointer) (unsafe.Pointer, unsafe } hash := t.hasher(key, uintptr(h.hash0)) m := bucketMask(h.B) - b := (*bmap)(unsafe.Pointer(uintptr(h.buckets) + (hash&m)*uintptr(t.bucketsize))) + b := (*bmap)(add(h.buckets, (hash&m)*uintptr(t.bucketsize))) if c := h.oldbuckets; c != nil { if !h.sameSizeGrow() { // There used to be half as many buckets; mask down one more power of two. m >>= 1 } - oldb := (*bmap)(unsafe.Pointer(uintptr(c) + (hash&m)*uintptr(t.bucketsize))) + oldb := (*bmap)(add(c, (hash&m)*uintptr(t.bucketsize))) if !evacuated(oldb) { b = oldb } @@ -863,7 +863,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 |