diff options
Diffstat (limited to 'src/runtime')
| -rw-r--r-- | src/runtime/hashmap.go | 15 | ||||
| -rw-r--r-- | src/runtime/runtime2.go | 2 | ||||
| -rw-r--r-- | src/runtime/select.go | 4 | ||||
| -rw-r--r-- | src/runtime/type.go | 1 |
4 files changed, 9 insertions, 13 deletions
diff --git a/src/runtime/hashmap.go b/src/runtime/hashmap.go index 892a79a914..fcfcd4b607 100644 --- a/src/runtime/hashmap.go +++ b/src/runtime/hashmap.go @@ -102,6 +102,7 @@ const ( ) // A header for a Go map. +// Changes here must also be made in src/cmd/compile/internal/gc/builtin/runtime.go. 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! @@ -137,11 +138,10 @@ type bmap struct { } // A hash iteration structure. -// If you modify hiter, also change cmd/internal/gc/reflect.go to indicate -// the layout of this structure. +// Changes here must also be made in src/cmd/compile/internal/gc/builtin/runtime.go. type hiter struct { - key unsafe.Pointer // Must be in first position. Write nil to indicate iteration end (see cmd/internal/gc/range.go). - value unsafe.Pointer // Must be in second position (see cmd/internal/gc/range.go). + key unsafe.Pointer // Write nil to indicate iteration end (see cmd/compile/internal/gc/range.go). + value unsafe.Pointer t *maptype h *hmap buckets unsafe.Pointer // bucket ptr at hash_iter initialization time @@ -188,11 +188,10 @@ func (h *hmap) createOverflow() { // If h != nil, the map can be created directly in h. // If bucket != nil, bucket can be used as the first bucket. func makemap(t *maptype, hint int64, h *hmap, bucket unsafe.Pointer) *hmap { - if sz := unsafe.Sizeof(hmap{}); sz > 48 || sz != uintptr(t.hmap.size) { - println("runtime: sizeof(hmap) =", sz, ", t.hmap.size =", t.hmap.size) + if sz := unsafe.Sizeof(hmap{}); sz > 48 { + println("runtime: sizeof(hmap) =", sz) throw("bad hmap size") } - if hint < 0 || int64(int32(hint)) != hint { panic("makemap: size out of range") // TODO: make hint an int, then none of this nonsense @@ -254,7 +253,7 @@ func makemap(t *maptype, hint int64, h *hmap, bucket unsafe.Pointer) *hmap { // initialize Hmap if h == nil { - h = (*hmap)(newobject(t.hmap)) + h = &hmap{} } h.count = 0 h.B = B diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go index 917fe89d38..379fe2678b 100644 --- a/src/runtime/runtime2.go +++ b/src/runtime/runtime2.go @@ -160,8 +160,6 @@ type gobuf struct { bp uintptr // for GOEXPERIMENT=framepointer } -// Known to compiler. -// Changes here must also be made in src/cmd/internal/gc/select.go's selecttype. type sudog struct { g *g selectdone *uint32 diff --git a/src/runtime/select.go b/src/runtime/select.go index b6c3fea001..25ebdaa595 100644 --- a/src/runtime/select.go +++ b/src/runtime/select.go @@ -22,7 +22,7 @@ const ( // Select statement header. // Known to compiler. -// Changes here must also be made in src/cmd/internal/gc/select.go's selecttype. +// Changes here must also be made in src/cmd/compile/internal/gc/select.go's selecttype. type hselect struct { tcase uint16 // total count of scase[] ncase uint16 // currently filled scase[] @@ -33,7 +33,7 @@ type hselect struct { // Select case descriptor. // Known to compiler. -// Changes here must also be made in src/cmd/internal/gc/select.go's selecttype. +// Changes here must also be made in src/cmd/compile/internal/gc/builtin/runtime.go. type scase struct { elem unsafe.Pointer // data element c *hchan // chan diff --git a/src/runtime/type.go b/src/runtime/type.go index d5f3bb1ef0..8350976491 100644 --- a/src/runtime/type.go +++ b/src/runtime/type.go @@ -60,7 +60,6 @@ type maptype struct { key *_type elem *_type bucket *_type // internal type representing a hash bucket - hmap *_type // internal type representing a hmap keysize uint8 // size of key slot indirectkey bool // store ptr to key instead of key itself valuesize uint8 // size of value slot |
