mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.cc] reflect: interfaces contain only pointers
[This CL is part of the removal of C code from package runtime. See golang.org/s/dev.cc for an overview.] Adjustments for changes made in CL 169360043. This change is already present in the dev.garbage branch. LGTM=r R=r CC=austin, golang-codereviews, iant, khr https://golang.org/cl/167520044
This commit is contained in:
parent
4a42fae2cd
commit
33e910296e
2 changed files with 7 additions and 15 deletions
|
|
@ -1533,12 +1533,8 @@ func (gc *gcProg) appendProg(t *rtype) {
|
||||||
gc.appendProg(e)
|
gc.appendProg(e)
|
||||||
}
|
}
|
||||||
case Interface:
|
case Interface:
|
||||||
gc.appendWord(bitsMultiWord)
|
gc.appendWord(bitsPointer)
|
||||||
if t.NumMethod() == 0 {
|
gc.appendWord(bitsPointer)
|
||||||
gc.appendWord(bitsEface)
|
|
||||||
} else {
|
|
||||||
gc.appendWord(bitsIface)
|
|
||||||
}
|
|
||||||
case Struct:
|
case Struct:
|
||||||
c := t.NumField()
|
c := t.NumField()
|
||||||
for i := 0; i < c; i++ {
|
for i := 0; i < c; i++ {
|
||||||
|
|
@ -1592,9 +1588,8 @@ func (gc *gcProg) align(a uintptr) {
|
||||||
|
|
||||||
// These constants must stay in sync with ../runtime/mgc0.h.
|
// These constants must stay in sync with ../runtime/mgc0.h.
|
||||||
const (
|
const (
|
||||||
bitsScalar = 1
|
bitsScalar = 1
|
||||||
bitsPointer = 2
|
bitsPointer = 2
|
||||||
bitsMultiWord = 3
|
|
||||||
|
|
||||||
bitsIface = 2
|
bitsIface = 2
|
||||||
bitsEface = 3
|
bitsEface = 3
|
||||||
|
|
|
||||||
|
|
@ -62,12 +62,10 @@ func verifyGCInfo(t *testing.T, name string, p interface{}, mask0 []byte) {
|
||||||
func nonStackInfo(mask []byte) []byte {
|
func nonStackInfo(mask []byte) []byte {
|
||||||
// BitsDead is replaced with BitsScalar everywhere except stacks.
|
// BitsDead is replaced with BitsScalar everywhere except stacks.
|
||||||
mask1 := make([]byte, len(mask))
|
mask1 := make([]byte, len(mask))
|
||||||
mw := false
|
|
||||||
for i, v := range mask {
|
for i, v := range mask {
|
||||||
if !mw && v == BitsDead {
|
if v == BitsDead {
|
||||||
v = BitsScalar
|
v = BitsScalar
|
||||||
}
|
}
|
||||||
mw = !mw && v == BitsMultiWord
|
|
||||||
mask1[i] = v
|
mask1[i] = v
|
||||||
}
|
}
|
||||||
return mask1
|
return mask1
|
||||||
|
|
@ -84,7 +82,6 @@ const (
|
||||||
BitsDead = iota
|
BitsDead = iota
|
||||||
BitsScalar
|
BitsScalar
|
||||||
BitsPointer
|
BitsPointer
|
||||||
BitsMultiWord
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
@ -188,6 +185,6 @@ var (
|
||||||
|
|
||||||
infoString = []byte{BitsPointer, BitsDead}
|
infoString = []byte{BitsPointer, BitsDead}
|
||||||
infoSlice = []byte{BitsPointer, BitsDead, BitsDead}
|
infoSlice = []byte{BitsPointer, BitsDead, BitsDead}
|
||||||
infoEface = []byte{BitsMultiWord, BitsEface}
|
infoEface = []byte{BitsPointer, BitsPointer}
|
||||||
infoIface = []byte{BitsMultiWord, BitsIface}
|
infoIface = []byte{BitsPointer, BitsPointer}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue