mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
Revert "runtime: redo heap bitmap"
This reverts commit b589208c8c.
Reason for revert: Bug somewhere in this code, causing wasm and maybe linux/386 to fail.
Change-Id: I5e1e501d839584e0219271bb937e94348f83c11f
Reviewed-on: https://go-review.googlesource.com/c/go/+/422395
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Keith Randall <khr@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
parent
e1a8e0e05d
commit
ad0287f496
12 changed files with 1126 additions and 530 deletions
|
|
@ -6989,21 +6989,8 @@ func TestFuncLayout(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
// trimBitmap removes trailing 0 elements from b and returns the result.
|
||||
func trimBitmap(b []byte) []byte {
|
||||
for len(b) > 0 && b[len(b)-1] == 0 {
|
||||
b = b[:len(b)-1]
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func verifyGCBits(t *testing.T, typ Type, bits []byte) {
|
||||
heapBits := GCBits(New(typ).Interface())
|
||||
|
||||
// Trim scalars at the end, as bits might end in zero,
|
||||
// e.g. with rep(2, lit(1, 0)).
|
||||
bits = trimBitmap(bits)
|
||||
|
||||
if !bytes.Equal(heapBits, bits) {
|
||||
_, _, line, _ := runtime.Caller(1)
|
||||
t.Errorf("line %d: heapBits incorrect for %v\nhave %v\nwant %v", line, typ, heapBits, bits)
|
||||
|
|
@ -7020,10 +7007,12 @@ func verifyGCBitsSlice(t *testing.T, typ Type, cap int, bits []byte) {
|
|||
heapBits := GCBits(data.Interface())
|
||||
// Repeat the bitmap for the slice size, trimming scalars in
|
||||
// the last element.
|
||||
bits = trimBitmap(rep(cap, bits))
|
||||
bits = rep(cap, bits)
|
||||
for len(bits) > 0 && bits[len(bits)-1] == 0 {
|
||||
bits = bits[:len(bits)-1]
|
||||
}
|
||||
if !bytes.Equal(heapBits, bits) {
|
||||
_, _, line, _ := runtime.Caller(1)
|
||||
t.Errorf("line %d: heapBits incorrect for make(%v, 0, %v)\nhave %v\nwant %v", line, typ, cap, heapBits, bits)
|
||||
t.Errorf("heapBits incorrect for make(%v, 0, %v)\nhave %v\nwant %v", typ, cap, heapBits, bits)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue