Commit 33e91029 authored by Russ Cox's avatar Russ Cox

[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
parent 4a42fae2
......@@ -1533,12 +1533,8 @@ func (gc *gcProg) appendProg(t *rtype) {
gc.appendProg(e)
}
case Interface:
gc.appendWord(bitsMultiWord)
if t.NumMethod() == 0 {
gc.appendWord(bitsEface)
} else {
gc.appendWord(bitsIface)
}
gc.appendWord(bitsPointer)
gc.appendWord(bitsPointer)
case Struct:
c := t.NumField()
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.
const (
bitsScalar = 1
bitsPointer = 2
bitsMultiWord = 3
bitsScalar = 1
bitsPointer = 2
bitsIface = 2
bitsEface = 3
......
......@@ -62,12 +62,10 @@ func verifyGCInfo(t *testing.T, name string, p interface{}, mask0 []byte) {
func nonStackInfo(mask []byte) []byte {
// BitsDead is replaced with BitsScalar everywhere except stacks.
mask1 := make([]byte, len(mask))
mw := false
for i, v := range mask {
if !mw && v == BitsDead {
if v == BitsDead {
v = BitsScalar
}
mw = !mw && v == BitsMultiWord
mask1[i] = v
}
return mask1
......@@ -84,7 +82,6 @@ const (
BitsDead = iota
BitsScalar
BitsPointer
BitsMultiWord
)
const (
......@@ -188,6 +185,6 @@ var (
infoString = []byte{BitsPointer, BitsDead}
infoSlice = []byte{BitsPointer, BitsDead, BitsDead}
infoEface = []byte{BitsMultiWord, BitsEface}
infoIface = []byte{BitsMultiWord, BitsIface}
infoEface = []byte{BitsPointer, BitsPointer}
infoIface = []byte{BitsPointer, BitsPointer}
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment