diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2018-08-29 00:20:25 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2018-08-29 00:20:25 +0000 |
commit | 347462bfeecb8db177df72dc5b3c6f2eb263c452 (patch) | |
tree | 258b35cc7e9d07a9c277d1923316c1720f93d862 /libgo | |
parent | d16c446e0b24e78a5025cf88531d7967615eefd6 (diff) | |
download | gcc-347462bfeecb8db177df72dc5b3c6f2eb263c452.zip gcc-347462bfeecb8db177df72dc5b3c6f2eb263c452.tar.gz gcc-347462bfeecb8db177df72dc5b3c6f2eb263c452.tar.bz2 |
compiler, runtime: remove hmap field from maptypes
This is the gofrontend version of https://golang.org/cl/91796.
This is part of that CL, just the compiler change and required runtime
changes, in preparation for updating libgo to 1.11.
Relevant part of original CL description:
The hmap field in the maptype is only used by the runtime to check the sizes of
the hmap structure created by the compiler and runtime agree.
Comments are already present about the hmap structure definitions in the
compiler and runtime needing to be in sync.
Reviewed-on: https://go-review.googlesource.com/130976
From-SVN: r263941
Diffstat (limited to 'libgo')
-rw-r--r-- | libgo/go/reflect/type.go | 1 | ||||
-rw-r--r-- | libgo/go/runtime/hashmap.go | 14 | ||||
-rw-r--r-- | libgo/go/runtime/type.go | 1 |
3 files changed, 1 insertions, 15 deletions
diff --git a/libgo/go/reflect/type.go b/libgo/go/reflect/type.go index 07fe4d0..bbbef91 100644 --- a/libgo/go/reflect/type.go +++ b/libgo/go/reflect/type.go @@ -351,7 +351,6 @@ type mapType struct { key *rtype // map key type elem *rtype // map element (value) type bucket *rtype // internal bucket structure - hmap *rtype // internal map header keysize uint8 // size of key slot indirectkey uint8 // store ptr to key instead of key itself valuesize uint8 // size of value slot diff --git a/libgo/go/runtime/hashmap.go b/libgo/go/runtime/hashmap.go index aba9abd..53b05b1 100644 --- a/libgo/go/runtime/hashmap.go +++ b/libgo/go/runtime/hashmap.go @@ -311,20 +311,13 @@ func makemap_small() *hmap { // If h != nil, the map can be created directly in h. // If h.buckets != nil, bucket pointed to can be used as the first bucket. func makemap(t *maptype, hint int, h *hmap) *hmap { - // The size of hmap should be 48 bytes on 64 bit - // and 28 bytes on 32 bit platforms. - if sz := unsafe.Sizeof(hmap{}); sz != 8+5*sys.PtrSize { - println("runtime: sizeof(hmap) =", sz, ", t.hmap.size =", t.hmap.size) - throw("bad hmap size") - } - if hint < 0 || hint > int(maxSliceCap(t.bucket.size)) { hint = 0 } // initialize Hmap if h == nil { - h = (*hmap)(newobject(t.hmap)) + h = new(hmap) } h.hash0 = fastrand() @@ -1210,11 +1203,6 @@ func ismapkey(t *_type) bool { //go:linkname reflect_makemap reflect.makemap func reflect_makemap(t *maptype, cap int) *hmap { - // Check invariants and reflects math. - if sz := unsafe.Sizeof(hmap{}); sz != t.hmap.size { - println("runtime: sizeof(hmap) =", sz, ", t.hmap.size =", t.hmap.size) - throw("bad hmap size") - } if !ismapkey(t.key) { throw("runtime.reflect_makemap: unsupported map key type") } diff --git a/libgo/go/runtime/type.go b/libgo/go/runtime/type.go index 0ec0da4..3c08f7e 100644 --- a/libgo/go/runtime/type.go +++ b/libgo/go/runtime/type.go @@ -72,7 +72,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 |