aboutsummaryrefslogtreecommitdiff
path: root/src/reflect/export_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/reflect/export_test.go')
-rw-r--r--src/reflect/export_test.go22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/reflect/export_test.go b/src/reflect/export_test.go
index c89e9c1298..a4e2e7e28c 100644
--- a/src/reflect/export_test.go
+++ b/src/reflect/export_test.go
@@ -4,6 +4,8 @@
package reflect
+import "unsafe"
+
// MakeRO returns a copy of v with the read-only flag set.
func MakeRO(v Value) Value {
v.flag |= flagRO
@@ -18,8 +20,6 @@ func IsRO(v Value) bool {
var CallGC = &callGC
const PtrSize = ptrSize
-const BitsPointer = bitsPointer
-const BitsScalar = bitsScalar
func FuncLayout(t Type, rcvr Type) (frametype Type, argSize, retOffset uintptr, stack []byte, gc []byte, ptrs bool) {
var ft *rtype
@@ -30,15 +30,15 @@ func FuncLayout(t Type, rcvr Type) (frametype Type, argSize, retOffset uintptr,
ft, argSize, retOffset, s, _ = funcLayout(t.(*rtype), nil)
}
frametype = ft
- for i := uint32(0); i < s.n; i += 2 {
- stack = append(stack, s.data[i/8]>>(i%8)&3)
+ for i := uint32(0); i < s.n; i++ {
+ stack = append(stack, s.data[i/8]>>(i%8)&1)
}
if ft.kind&kindGCProg != 0 {
panic("can't handle gc programs")
}
- gcdata := (*[1000]byte)(ft.gc[0])
- for i := uintptr(0); i < ft.size/ptrSize; i++ {
- gc = append(gc, gcdata[i/2]>>(i%2*4+2)&3)
+ gcdata := (*[1000]byte)(unsafe.Pointer(ft.gcdata))
+ for i := uintptr(0); i < ft.ptrdata/ptrSize; i++ {
+ gc = append(gc, gcdata[i/8]>>(i%8)&1)
}
ptrs = ft.kind&kindNoPointers == 0
return
@@ -53,3 +53,11 @@ func TypeLinks() []string {
}
return r
}
+
+var GCBits = gcbits
+
+func gcbits(interface{}) []byte // provided by runtime
+
+func MapBucketOf(x, y Type) Type {
+ return bucketOf(x.(*rtype), y.(*rtype))
+}