Skip to content

Commit ba97d0d

Browse files
cuonglmrandall77
authored andcommitted
cmd/compile: remove overflow pointer padding for nacl
CL 200077 removed nacl bits in the toolchain, but it misses the code to add pointer overflow padding, which is specific for nacl. This CL removes that part. Passes toolstash-check. Updates #30439 Change-Id: I1e77cade9f31690e16cd13d3445a98b500671252 Reviewed-on: https://go-review.googlesource.com/c/go/+/202159 Run-TryBot: Cuong Manh Le <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Keith Randall <[email protected]>
1 parent 3b2eb69 commit ba97d0d

File tree

1 file changed

+1
-22
lines changed

1 file changed

+1
-22
lines changed

src/cmd/compile/internal/gc/reflect.go

+1-22
Original file line numberDiff line numberDiff line change
@@ -112,27 +112,6 @@ func bmap(t *types.Type) *types.Type {
112112
elems := makefield("elems", arr)
113113
field = append(field, elems)
114114

115-
// Make sure the overflow pointer is the last memory in the struct,
116-
// because the runtime assumes it can use size-ptrSize as the
117-
// offset of the overflow pointer. We double-check that property
118-
// below once the offsets and size are computed.
119-
//
120-
// BUCKETSIZE is 8, so the struct is aligned to 64 bits to this point.
121-
// On 32-bit systems, the max alignment is 32-bit, and the
122-
// overflow pointer will add another 32-bit field, and the struct
123-
// will end with no padding.
124-
// On 64-bit systems, the max alignment is 64-bit, and the
125-
// overflow pointer will add another 64-bit field, and the struct
126-
// will end with no padding.
127-
// On nacl/amd64p32, however, the max alignment is 64-bit,
128-
// but the overflow pointer will add only a 32-bit field,
129-
// so if the struct needs 64-bit padding (because a key or elem does)
130-
// then it would end with an extra 32-bit padding field.
131-
// Preempt that by emitting the padding here.
132-
if int(elemtype.Align) > Widthptr || int(keytype.Align) > Widthptr {
133-
field = append(field, makefield("pad", types.Types[TUINTPTR]))
134-
}
135-
136115
// If keys and elems have no pointers, the map implementation
137116
// can keep a list of overflow pointers on the side so that
138117
// buckets can be marked as having no pointers.
@@ -196,7 +175,7 @@ func bmap(t *types.Type) *types.Type {
196175
}
197176

198177
// Double-check that overflow field is final memory in struct,
199-
// with no padding at end. See comment above.
178+
// with no padding at end.
200179
if overflow.Offset != bucket.Width-int64(Widthptr) {
201180
Fatalf("bad offset of overflow in bmap for %v", t)
202181
}

0 commit comments

Comments
 (0)