]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: rename ptrsize to ptrdata
authorRuss Cox <rsc@golang.org>
Tue, 5 May 2015 01:43:30 +0000 (21:43 -0400)
committerRuss Cox <rsc@golang.org>
Tue, 5 May 2015 19:27:47 +0000 (19:27 +0000)
I forgot there is already a ptrSize constant.
Rename field to avoid some confusion.

Change-Id: I098fdcc8afc947d6c02c41c6e6de24624cc1c8ff
Reviewed-on: https://go-review.googlesource.com/9700
Reviewed-by: Austin Clements <austin@google.com>
src/cmd/internal/gc/reflect.go
src/reflect/type.go
src/runtime/type.go

index 346c8246bbc513bc00bb62105c8d892ada95f558..9979fe85fde6b7943d35cd2b523cfbdaf3485030 100644 (file)
@@ -685,9 +685,9 @@ func haspointers(t *Type) bool {
        return ret
 }
 
-// typeptrsize returns the length in bytes of the prefix of t
+// typeptrdata returns the length in bytes of the prefix of t
 // containing pointer data. Anything after this offset is scalar data.
-func typeptrsize(t *Type) uint64 {
+func typeptrdata(t *Type) uint64 {
        if !haspointers(t) {
                return 0
        }
@@ -716,7 +716,7 @@ func typeptrsize(t *Type) uint64 {
                        return uint64(Widthptr)
                }
                // haspointers already eliminated t.Bound == 0.
-               return uint64(t.Bound-1)*uint64(t.Type.Width) + typeptrsize(t.Type)
+               return uint64(t.Bound-1)*uint64(t.Type.Width) + typeptrdata(t.Type)
 
        case TSTRUCT:
                // Find the last field that has pointers.
@@ -726,10 +726,10 @@ func typeptrsize(t *Type) uint64 {
                                lastPtrField = t1
                        }
                }
-               return uint64(lastPtrField.Width) + typeptrsize(lastPtrField.Type)
+               return uint64(lastPtrField.Width) + typeptrdata(lastPtrField.Type)
 
        default:
-               Fatal("typeptrsize: unexpected type, %v", t)
+               Fatal("typeptrdata: unexpected type, %v", t)
                return 0
        }
 }
@@ -794,7 +794,7 @@ func dcommontype(s *Sym, ot int, t *Type) int {
        //              zero          unsafe.Pointer
        //      }
        ot = duintptr(s, ot, uint64(t.Width))
-       ot = duintptr(s, ot, typeptrsize(t))
+       ot = duintptr(s, ot, typeptrdata(t))
 
        ot = duint32(s, ot, typehash(t))
        ot = duint8(s, ot, 0) // unused
index c0a5616166acb6334f9cbcf04253e88ea7c774aa..5315bd39715959634e434a16807fe7138d7bc06d 100644 (file)
@@ -246,7 +246,7 @@ const (
 // so that code cannot convert from, say, *arrayType to *ptrType.
 type rtype struct {
        size          uintptr
-       ptrsize       uintptr
+       ptrdata       uintptr
        hash          uint32            // hash of type; avoids computation in hash tables
        _             uint8             // unused/padding
        align         uint8             // alignment of variable with this type
@@ -1826,14 +1826,14 @@ func bucketOf(ktyp, etyp *rtype) *rtype {
        }
        // overflow
        gc.append(bitsPointer)
-       tptrsize := gc.size
+       ptrdata := gc.size
        if runtime.GOARCH == "amd64p32" {
                gc.append(bitsScalar)
        }
 
        b := new(rtype)
        b.size = gc.size
-       b.ptrsize = tptrsize
+       b.ptrdata = ptrdata
        b.kind = kind
        b.gc[0], _ = gc.finalize()
        s := "bucket(" + *ktyp.string + "," + *etyp.string + ")"
@@ -1920,8 +1920,8 @@ func ArrayOf(count int, elem Type) Type {
                panic("reflect.ArrayOf: array size would exceed virtual address space")
        }
        array.size = typ.size * uintptr(count)
-       if count > 0 && typ.ptrsize != 0 {
-               array.ptrsize = typ.size*uintptr(count-1) + typ.ptrsize
+       if count > 0 && typ.ptrdata != 0 {
+               array.ptrdata = typ.size*uintptr(count-1) + typ.ptrdata
        }
        array.align = typ.align
        array.fieldAlign = typ.fieldAlign
@@ -2090,7 +2090,7 @@ func funcLayout(t *rtype, rcvr *rtype) (frametype *rtype, argSize, retOffset uin
        // build dummy rtype holding gc program
        x := new(rtype)
        x.size = gc.size
-       x.ptrsize = gc.size // over-approximation
+       x.ptrdata = gc.size // over-approximation
        var hasPtr bool
        x.gc[0], hasPtr = gc.finalize()
        if !hasPtr {
index 9d61c47ddafeee0745b8b94989e85aefd5878f2b..48df2a438243021d5323d25eff12290decc2ff75 100644 (file)
@@ -13,7 +13,7 @@ import "unsafe"
 // ../reflect/type.go:/^type.rtype.
 type _type struct {
        size       uintptr
-       ptrsize    uintptr // Bytes of prefix containing pointer slots.
+       ptrdata    uintptr // size of memory prefix holding all pointers
        hash       uint32
        _unused    uint8
        align      uint8