]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: add (unused for now) gc field to type information
authorJan Ziak <0xe2.0x9a.0x9b@gmail.com>
Sat, 2 Jun 2012 18:02:44 +0000 (14:02 -0400)
committerRuss Cox <rsc@golang.org>
Sat, 2 Jun 2012 18:02:44 +0000 (14:02 -0400)
R=rsc
CC=golang-dev
https://golang.org/cl/6255074

src/cmd/gc/reflect.c
src/cmd/ld/dwarf.c
src/pkg/reflect/type.go
src/pkg/runtime/type.go
src/pkg/runtime/type.h

index ed7f5cf068a811f224e3dd3845c677c8f5846a74..041c92c65c46e3d2c4adf81137583785953638f4 100644 (file)
@@ -546,15 +546,17 @@ dcommontype(Sym *s, int ot, Type *t)
        // ../../pkg/reflect/type.go:/^type.commonType
        // actual type structure
        //      type commonType struct {
-       //              size uintptr;
-       //              hash uint32;
-       //              alg uint8;
-       //              align uint8;
-       //              fieldAlign uint8;
-       //              kind uint8;
-       //              string *string;
-       //              *extraType;
-       //              ptrToThis *Type
+       //              size          uintptr
+       //              hash          uint32
+       //              _             uint8
+       //              align         uint8
+       //              fieldAlign    uint8
+       //              kind          uint8
+       //              alg           unsafe.Pointer
+       //              gc            unsafe.Pointer
+       //              string        *string
+       //              *extraType
+       //              ptrToThis     *Type
        //      }
        ot = duintptr(s, ot, t->width);
        ot = duint32(s, ot, typehash(t));
@@ -579,6 +581,7 @@ dcommontype(Sym *s, int ot, Type *t)
                ot = dsymptr(s, ot, algarray, alg*sizeofAlg);
        else
                ot = dsymptr(s, ot, algsym, 0);
+       ot = duintptr(s, ot, 0);  // gc
        p = smprint("%-uT", t);
        //print("dcommontype: %s\n", p);
        ot = dgostringptr(s, ot, p);    // string
index 57e5a4283e32fc339d2bee770becc0f1f02886e4..9a78d9610d7be3fd61e57da994f9509f4adf0f60 100644 (file)
@@ -775,7 +775,7 @@ enum {
        KindNoPointers = 1<<7,
 
        // size of Type interface header + CommonType structure.
-       CommonSize = 2*PtrSize+ 5*PtrSize + 8,
+       CommonSize = 2*PtrSize+ 6*PtrSize + 8,
 };
 
 static Reloc*
index 060bde3aff7de138f61f0c3c03cbdb341e34913b..9edae72a02636d19ee81007a3d1d2143d9a9e76d 100644 (file)
@@ -244,6 +244,7 @@ type commonType struct {
        fieldAlign    uint8        // alignment of struct field with this type
        kind          uint8        // enumeration for C
        alg           *uintptr     // algorithm table (../runtime/runtime.h:/Alg)
+       gc            uintptr      // garbage collection data
        string        *string      // string form; unnecessary but undeniably useful
        *uncommonType              // (relatively) uncommon fields
        ptrToThis     *runtimeType // pointer to this type, if used in binary or has methods
index 6af6b237f168525f2f2f9b5c47e14b85428fc9a4..8ec850f9bf363e9a4dd421fcba261435472c72d5 100644 (file)
@@ -21,7 +21,8 @@ type commonType struct {
        align      uint8
        fieldAlign uint8
        kind       uint8
-       alg        *uintptr
+       alg        unsafe.Pointer
+       gc         unsafe.Pointer
        string     *string
        *uncommonType
        ptrToThis *interface{}
index c1d9facd10795d65189281969361ca5c3367c076..ca81e84657e9d233d8971cc220095618dab22b92 100644 (file)
@@ -28,6 +28,7 @@ struct CommonType
        uint8 fieldAlign;
        uint8 kind;
        Alg *alg;
+       void *gc;
        String *string;
        UncommonType *x;
        Type *ptrto;