diff options
Diffstat (limited to 'libgo/go/runtime/gcinfo_test.go')
-rw-r--r-- | libgo/go/runtime/gcinfo_test.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libgo/go/runtime/gcinfo_test.go b/libgo/go/runtime/gcinfo_test.go index d3262a6..2253d93 100644 --- a/libgo/go/runtime/gcinfo_test.go +++ b/libgo/go/runtime/gcinfo_test.go @@ -45,14 +45,14 @@ func TestGCInfo(t *testing.T) { func verifyGCInfo(t *testing.T, name string, p interface{}, mask0 []byte) { mask := runtime.GCMask(p) - if bytes.Compare(mask, mask0) != 0 { + if !bytes.Equal(mask, mask0) { t.Errorf("bad GC program for %v:\nwant %+v\ngot %+v", name, mask0, mask) return } } func padDead(mask []byte) []byte { - // Because the dead bit isn't encoded until the third word, + // Because the dead bit isn't encoded in the second word, // and because on 32-bit systems a one-word allocation // uses a two-word block, the pointer info for a one-word // object needs to be expanded to include an extra scalar @@ -67,6 +67,9 @@ func trimDead(mask []byte) []byte { for len(mask) > 2 && mask[len(mask)-1] == typeScalar { mask = mask[:len(mask)-1] } + if len(mask) == 2 && mask[0] == typeScalar && mask[1] == typeScalar { + mask = mask[:0] + } return mask } @@ -130,7 +133,7 @@ func infoBigStruct() []byte { typeScalar, typeScalar, typeScalar, typeScalar, // t int; y uint16; u uint64 typePointer, typeScalar, // i string } - case "arm64", "amd64", "mips64", "mips64le", "ppc64", "ppc64le": + case "arm64", "amd64", "mips64", "mips64le", "ppc64", "ppc64le", "s390x": return []byte{ typePointer, // q *int typeScalar, typeScalar, typeScalar, // w byte; e [17]byte |