It is easily recomputed as capacity-1.
This reduces a table from 40 to 32 bytes (on 64-bit archs).
That gets us down one sizeclass.
Change-Id: Icb74fb2de50baa18ca62052c7b2fe8e6af4c8837
Reviewed-on: https://go-review.googlesource.com/c/go/+/625198
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Keith Randall <khr@google.com>
        //     // From groups.
        //     groups_data       unsafe.Pointer
        //     groups_lengthMask uint64
-       //     groups_entryMask  uint64
        // }
        // must match internal/runtime/maps/table.go:table.
        fields := []*types.Field{
                makefield("index", types.Types[types.TINT]),
                makefield("groups_data", types.Types[types.TUNSAFEPTR]),
                makefield("groups_lengthMask", types.Types[types.TUINT64]),
-               makefield("groups_entryMask", types.Types[types.TUINT64]),
        }
 
        n := ir.NewDeclNameAt(src.NoXPos, ir.OTYPE, ir.Pkgs.InternalMaps.Lookup("table"))
        table.SetUnderlying(types.NewStruct(fields))
        types.CalcSize(table)
 
-       // The size of table should be 40 bytes on 64 bit
-       // and 32 bytes on 32 bit platforms.
-       if size := int64(3*2 + 2*1 /* one extra for padding */ + 2*8 + 2*types.PtrSize); table.Size() != size {
+       // The size of table should be 32 bytes on 64 bit
+       // and 24 bytes on 32 bit platforms.
+       if size := int64(3*2 + 2*1 /* one extra for padding */ + 1*8 + 2*types.PtrSize); table.Size() != size {
                base.Fatalf("internal/runtime/maps.table size not correct: got %d, want %d", table.Size(), size)
        }
 
 
        // length must be a power of two). This allows computing i%length
        // quickly using bitwise AND.
        lengthMask uint64
-
-       // entryMask is the total number of slots in the groups minus one.
-       entryMask uint64
 }
 
 // newGroups allocates a new array of length groups.
                // TODO: make the length type the same throughout.
                data:       newarray(typ.Group, int(length)),
                lengthMask: length - 1,
-               entryMask:  (length * abi.SwissMapGroupSlots) - 1,
        }
 }
 
 
                // table for key selection if the table has grown. See comment
                // on grown below.
 
-               if it.entryIdx > it.tab.groups.entryMask {
+               entryMask := uint64(it.tab.capacity) - 1
+               if it.entryIdx > entryMask {
                        // Continue to next table.
                        continue
                }
                // it is cheaper to check a single slot than do a full control
                // match.
 
-               entryIdx := (it.entryIdx + it.entryOffset) & it.tab.groups.entryMask
+               entryIdx := (it.entryIdx + it.entryOffset) & entryMask
                slotIdx := uintptr(entryIdx & (abi.SwissMapGroupSlots - 1))
                if slotIdx == 0 || it.group.data == nil {
                        // Only compute the group (a) when we switch
                        return
                }
 
-next:
+       next:
                it.entryIdx++
 
                // Slow path: use a match on the control word to jump ahead to
                // double-check the control value.
 
                var groupMatch bitset
-               for it.entryIdx <= it.tab.groups.entryMask {
-                       entryIdx := (it.entryIdx + it.entryOffset) & it.tab.groups.entryMask
+               for it.entryIdx <= entryMask {
+                       entryIdx := (it.entryIdx + it.entryOffset) & entryMask
                        slotIdx := uintptr(entryIdx & (abi.SwissMapGroupSlots - 1))
 
                        if slotIdx == 0 || it.group.data == nil {
 
                                i := groupMatch.first()
                                it.entryIdx += uint64(i - slotIdx)
-                               if it.entryIdx > it.tab.groups.entryMask {
+                               if it.entryIdx > entryMask {
                                        // Past the end of this table's iteration.
                                        continue
                                }