]> Cypherpunks repositories - gostls13.git/commitdiff
rename runtime internals to have modern names (array->slice etc)
authorRob Pike <r@golang.org>
Tue, 25 Aug 2009 22:54:25 +0000 (15:54 -0700)
committerRob Pike <r@golang.org>
Tue, 25 Aug 2009 22:54:25 +0000 (15:54 -0700)
R=rsc
DELTA=444  (179 added, 177 deleted, 88 changed)
OCL=33847
CL=33849

17 files changed:
src/cmd/gc/align.c
src/cmd/gc/builtin.c.boot
src/cmd/gc/sinit.c
src/cmd/gc/sys.go
src/cmd/gc/walk.c
src/pkg/runtime/Makefile
src/pkg/runtime/cgo2c.c
src/pkg/runtime/chan.c
src/pkg/runtime/hashmap.c
src/pkg/runtime/iface.c
src/pkg/runtime/reflect.cgo
src/pkg/runtime/runtime.c
src/pkg/runtime/runtime.h
src/pkg/runtime/slice.c [moved from src/pkg/runtime/array.c with 69% similarity]
src/pkg/runtime/string.cgo
src/pkg/runtime/symtab.c
src/pkg/runtime/type.h

index bd8b690471a60591d6da187d9c60df358864c07d..9a013ca6e253da199daf7ce016f147ca62524027 100644 (file)
@@ -186,7 +186,9 @@ dowidth(Type *t)
        case TFORW:             // should have been filled in
        case TANY:
                // dummy type; should be replaced before use.
-               fatal("dowidth any");
+               if(!debug['A'])
+                       fatal("dowidth any");
+               w = 1;  // anything will do
                break;
        case TSTRING:
                if(sizeof_String == 0)
index 3cbb87e1ed803a6b203cb5d368a994a4b6161ab0..e24d9d88150064aac60e7e250c740a40512ff9d9 100644 (file)
@@ -13,7 +13,7 @@ char *sysimport =
        "func sys.printpointer (? any)\n"
        "func sys.printiface (? any)\n"
        "func sys.printeface (? any)\n"
-       "func sys.printarray (? any)\n"
+       "func sys.printslice (? any)\n"
        "func sys.printnl ()\n"
        "func sys.printsp ()\n"
        "func sys.catstring (? string, ? string) (? string)\n"
@@ -21,8 +21,8 @@ char *sysimport =
        "func sys.slicestring (? string, ? int, ? int) (? string)\n"
        "func sys.indexstring (? string, ? int) (? uint8)\n"
        "func sys.intstring (? int64) (? string)\n"
-       "func sys.arraystring (? []uint8) (? string)\n"
-       "func sys.arraystringi (? []int) (? string)\n"
+       "func sys.slicebytetostring (? []uint8) (? string)\n"
+       "func sys.sliceinttostring (? []int) (? string)\n"
        "func sys.stringiter (? string, ? int) (? int)\n"
        "func sys.stringiter2 (? string, ? int) (retk int, retv int)\n"
        "func sys.ifaceI2E (iface any) (ret any)\n"
@@ -41,7 +41,7 @@ char *sysimport =
        "func sys.efaceeq (i1 any, i2 any) (ret bool)\n"
        "func sys.ifacethash (i1 any) (ret uint32)\n"
        "func sys.efacethash (i1 any) (ret uint32)\n"
-       "func sys.newmap (keysize int, valsize int, keyalg int, valalg int, hint int) (hmap map[any] any)\n"
+       "func sys.makemap (keysize int, valsize int, keyalg int, valalg int, hint int) (hmap map[any] any)\n"
        "func sys.mapaccess1 (hmap map[any] any, key any) (val any)\n"
        "func sys.mapaccess2 (hmap map[any] any, key any) (val any, pres bool)\n"
        "func sys.mapassign1 (hmap map[any] any, key any, val any)\n"
@@ -50,7 +50,7 @@ char *sysimport =
        "func sys.mapiternext (hiter *any)\n"
        "func sys.mapiter1 (hiter *any) (key any)\n"
        "func sys.mapiter2 (hiter *any) (key any, val any)\n"
-       "func sys.newchan (elemsize int, elemalg int, hint int) (hchan chan any)\n"
+       "func sys.makechan (elemsize int, elemalg int, hint int) (hchan chan any)\n"
        "func sys.chanrecv1 (hchan <-chan any) (elem any)\n"
        "func sys.chanrecv2 (hchan <-chan any) (elem any, pres bool)\n"
        "func sys.chansend1 (hchan chan<- any, elem any)\n"
@@ -62,10 +62,10 @@ char *sysimport =
        "func sys.selectrecv (sel *uint8, hchan <-chan any, elem *any) (selected bool)\n"
        "func sys.selectdefault (sel *uint8) (selected bool)\n"
        "func sys.selectgo (sel *uint8)\n"
-       "func sys.newarray (nel int, cap int, width int) (ary []any)\n"
-       "func sys.arraysliced (old []any, lb int, hb int, width int) (ary []any)\n"
-       "func sys.arrayslices (old *any, nel int, lb int, hb int, width int) (ary []any)\n"
-       "func sys.arrays2d (old *any, nel int) (ary []any)\n"
+       "func sys.makeslice (nel int, cap int, width int) (ary []any)\n"
+       "func sys.sliceslice (old []any, lb int, hb int, width int) (ary []any)\n"
+       "func sys.slicearray (old *any, nel int, lb int, hb int, width int) (ary []any)\n"
+       "func sys.arraytoslice (old *any, nel int) (ary []any)\n"
        "func sys.closure ()\n"
        "func sys.int64div (? int64, ? int64) (? int64)\n"
        "func sys.uint64div (? uint64, ? uint64) (? uint64)\n"
index 4b46f7c7c08b423a60e6b27befa9f17961fe6d13..84e844c271c8f6b2f17993e76f951d412236d08d 100644 (file)
@@ -146,8 +146,8 @@ slicerewrite(Node *n)
        while(n->op == OCONVNOP)
                n = n->left;
 
-       // call to newarray - find nel argument
-       nel = findarg(n, "nel", "newarray");
+       // call to makeslice - find nel argument
+       nel = findarg(n, "nel", "makeslice");
        if(nel == N || !isslice(n->type))
                goto no;
 
@@ -177,8 +177,8 @@ maprewrite(Node *n)
        Type *ta, *tb;
        Node *a;
 
-       // call to newarray - find nel argument
-       nel = findarg(n, "hint", "newmap");
+       // call to makemap - find len argument
+       nel = findarg(n, "hint", "makemap");
        if(nel == N)
                goto no;
        ta = n->type;
@@ -371,7 +371,7 @@ sli:
                if(r->op != OAS && r->op != OEMPTY)
                        continue;
 
-               // first usage "nam = (newarray CALL args)"
+               // first usage "nam = (makeslice CALL args)"
                if(r->right != N && sametmp(r->left, nam)) {
                        w = slicerewrite(r->right);
                        if(w == N)
@@ -427,7 +427,7 @@ return;
                if(r->op != OAS && r->op != OEMPTY)
                        continue;
 
-               // first usage "nam = (newmap CALL args)"
+               // first usage "nam = (makemap CALL args)"
                if(r->right != N && sametmp(r->left, nam)) {
                        w = maprewrite(r->right);
                        if(w == N)
index 2144e7c324f74f5aa852e36e9714f1129aca8fa7..3f2492cdfc0368310b1a02b07fa11a1788521f0b 100644 (file)
@@ -20,7 +20,7 @@ func  printstring(string);
 func   printpointer(any);
 func   printiface(any);
 func   printeface(any);
-func   printarray(any);
+func   printslice(any);
 func   printnl();
 func   printsp();
 
@@ -29,8 +29,8 @@ func  cmpstring(string, string) int;
 func   slicestring(string, int, int) string;
 func   indexstring(string, int) byte;
 func   intstring(int64) string;
-func   arraystring([]byte) string;
-func   arraystringi([]int) string;
+func   slicebytetostring([]byte) string;
+func   sliceinttostring([]int) string;
 func   stringiter(string, int) int;
 func   stringiter2(string, int) (retk int, retv int);
 
@@ -51,7 +51,7 @@ func  efaceeq(i1 any, i2 any) (ret bool);
 func   ifacethash(i1 any) (ret uint32);
 func   efacethash(i1 any) (ret uint32);
 
-func   newmap(keysize int, valsize int,
+func   makemap(keysize int, valsize int,
                        keyalg int, valalg int,
                        hint int) (hmap map[any]any);
 func   mapaccess1(hmap map[any]any, key any) (val any);
@@ -63,7 +63,7 @@ func  mapiternext(hiter *any);
 func   mapiter1(hiter *any) (key any);
 func   mapiter2(hiter *any) (key any, val any);
 
-func   newchan(elemsize int, elemalg int, hint int) (hchan chan any);
+func   makechan(elemsize int, elemalg int, hint int) (hchan chan any);
 func   chanrecv1(hchan <-chan any) (elem any);
 func   chanrecv2(hchan <-chan any) (elem any, pres bool);
 func   chansend1(hchan chan<- any, elem any);
@@ -77,10 +77,10 @@ func        selectrecv(sel *byte, hchan <-chan any, elem *any) (selected bool);
 func   selectdefault(sel *byte) (selected bool);
 func   selectgo(sel *byte);
 
-func   newarray(nel int, cap int, width int) (ary []any);
-func   arraysliced(old []any, lb int, hb int, width int) (ary []any);
-func   arrayslices(old *any, nel int, lb int, hb int, width int) (ary []any);
-func   arrays2d(old *any, nel int) (ary []any);
+func   makeslice(nel int, cap int, width int) (ary []any);
+func   sliceslice(old []any, lb int, hb int, width int) (ary []any);
+func   slicearray(old *any, nel int, lb int, hb int, width int) (ary []any);
+func   arraytoslice(old *any, nel int) (ary []any);
 
 func   closure();      // has args, but compiler fills in
 
index b7d6d8e5e08bbae2360d151e24cc7a3df17475f7..ec136df60c057eef46dff4ff16fe54ecc059d72d 100644 (file)
@@ -773,9 +773,9 @@ walkexpr(Node **np, NodeList **init)
                walkexpr(&n->right->left, init);
                walkexpr(&n->right->right, init);
                // dynamic slice
-               // arraysliced(old []any, lb int, hb int, width int) (ary []any)
+               // sliceslice(old []any, lb int, hb int, width int) (ary []any)
                t = n->type;
-               fn = syslook("arraysliced", 1);
+               fn = syslook("sliceslice", 1);
                argtype(fn, t->type);                   // any-1
                argtype(fn, t->type);                   // any-2
                n = mkcall1(fn, t, init,
@@ -790,9 +790,9 @@ walkexpr(Node **np, NodeList **init)
                walkexpr(&n->right->left, init);
                walkexpr(&n->right->right, init);
                // static slice
-               // arrayslices(old *any, nel int, lb int, hb int, width int) (ary []any)
+               // slicearray(old *any, nel int, lb int, hb int, width int) (ary []any)
                t = n->type;
-               fn = syslook("arrayslices", 1);
+               fn = syslook("slicearray", 1);
                argtype(fn, n->left->type);     // any-1
                argtype(fn, t->type);                   // any-2
                n = mkcall1(fn, t, init,
@@ -897,7 +897,7 @@ walkexpr(Node **np, NodeList **init)
                goto ret;
 
        case OMAKECHAN:
-               n = mkcall1(chanfn("newchan", 1, n->type), n->type, init,
+               n = mkcall1(chanfn("makechan", 1, n->type), n->type, init,
                        nodintconst(n->type->type->width),
                        nodintconst(algtype(n->type->type)),
                        conv(n->left, types[TINT]));
@@ -906,7 +906,7 @@ walkexpr(Node **np, NodeList **init)
        case OMAKEMAP:
                t = n->type;
 
-               fn = syslook("newmap", 1);
+               fn = syslook("makemap", 1);
                argtype(fn, t->down);   // any-1
                argtype(fn, t->type);   // any-2
 
@@ -919,9 +919,9 @@ walkexpr(Node **np, NodeList **init)
                goto ret;
 
        case OMAKESLICE:
-               // newarray(nel int, max int, width int) (ary []any)
+               // makeslice(nel int, max int, width int) (ary []any)
                t = n->type;
-               fn = syslook("newarray", 1);
+               fn = syslook("makeslice", 1);
                argtype(fn, t->type);                   // any-1
                n = mkcall1(fn, n->type, nil,
                        conv(n->left, types[TINT]),
@@ -935,13 +935,13 @@ walkexpr(Node **np, NodeList **init)
                goto ret;
 
        case OARRAYBYTESTR:
-               // arraystring([]byte) string;
-               n = mkcall("arraystring", n->type, init, n->left);
+               // slicebytetostring([]byte) string;
+               n = mkcall("slicebytetostring", n->type, init, n->left);
                goto ret;
 
        case OARRAYRUNESTR:
-               // arraystring([]byte) string;
-               n = mkcall("arraystringi", n->type, init, n->left);
+               // sliceinttostring([]byte) string;
+               n = mkcall("sliceinttostring", n->type, init, n->left);
                goto ret;
 
        case OCMPIFACE:
@@ -988,8 +988,8 @@ walkexpr(Node **np, NodeList **init)
                goto ret;
 
        case OCONVSLICE:
-               // arrays2d(old *any, nel int) (ary []any)
-               fn = syslook("arrays2d", 1);
+               // arraytoslice(old *any, nel int) (ary []any)
+               fn = syslook("arraytoslice", 1);
                argtype(fn, n->left->type->type);               // any-1
                argtype(fn, n->type->type);                     // any-2
                n = mkcall1(fn, n->type, init, n->left, nodintconst(n->left->type->type->bound));
@@ -1490,7 +1490,7 @@ walkprint(Node *nn, NodeList **init)
                        on = syslook("printpointer", 1);
                        argtype(on, n->type);   // any-1
                } else if(isslice(n->type)) {
-                       on = syslook("printarray", 1);
+                       on = syslook("printslice", 1);
                        argtype(on, n->type);   // any-1
                } else if(isint[et]) {
                        if(et == TUINT64)
index 7356bd765e7c8ee9679dc6df77d74d46685a7b1b..efd3f37de37ba75040c73e11bea2a448f94c15b6 100644 (file)
@@ -35,7 +35,6 @@ OFILES_arm=\
        vlrt.$O\
 
 OFILES=\
-       array.$O\
        asm.$O\
        cgocall.$O\
        chan.$O\
@@ -60,6 +59,7 @@ OFILES=\
        rt0.$O\
        sema.$O\
        signal.$O\
+       slice.$O\
        string.$O\
        symtab.$O\
        sys.$O\
index e6c7634ff7718d9bd11091e4d76dde73547abf77..3b452b78b3bf2c2656f02cefd394f8fdf889fb4a 100644 (file)
@@ -45,7 +45,7 @@ enum {
        Uint,
        Uintptr,
        String,
-       Array,
+       Slice,
 };
 
 static struct {
@@ -61,7 +61,7 @@ static struct {
        "uint",         4,
        "uintptr",      4,
        "String",       8,
-       "Array",        12,
+       "Slice",        12,
 
        /* fixed size */
        "float32",      4,
@@ -710,7 +710,7 @@ main(int argc, char **argv)
                if(goarch != NULL && strcmp(goarch, "amd64") == 0) {
                        type_table[Uintptr].size = 8;
                        type_table[String].size = 16;
-                       type_table[Array].size = 8+4+4;
+                       type_table[Slice].size = 8+4+4;
                        structround = 8;
                }
        }
index c72ea1dff9e5ef4de52171d74cf488a743fe8b54..ceebebf8b3880e70af15a51b2c73888d75b62937 100644 (file)
@@ -95,7 +95,7 @@ makechan(uint32 elemsize, uint32 elemalg, uint32 hint)
 
        if(elemalg >= nelem(algarray)) {
                printf("chan(alg=%d)\n", elemalg);
-               throw("sys·newchan: unsupported elem type");
+               throw("sys·makechan: unsupported elem type");
        }
 
        c = mal(sizeof(*c));
@@ -124,7 +124,7 @@ makechan(uint32 elemsize, uint32 elemalg, uint32 hint)
        }
 
        if(debug) {
-               prints("newchan: chan=");
+               prints("makechan: chan=");
                sys·printpointer(c);
                prints("; elemsize=");
                sys·printint(elemsize);
@@ -138,9 +138,9 @@ makechan(uint32 elemsize, uint32 elemalg, uint32 hint)
        return c;
 }
 
-// newchan(elemsize uint32, elemalg uint32, hint uint32) (hchan *chan any);
+// makechan(elemsize uint32, elemalg uint32, hint uint32) (hchan *chan any);
 void
-sys·newchan(uint32 elemsize, uint32 elemalg, uint32 hint, Hchan *ret)
+sys·makechan(uint32 elemsize, uint32 elemalg, uint32 hint, Hchan *ret)
 {
        ret = makechan(elemsize, elemalg, hint);
        FLUSH(&ret);
index 91be38443a1ed2ded518b9be68392d60a070db1e..8c642d9d4d00f471882a1738895538853e410fd8 100644 (file)
@@ -664,7 +664,7 @@ donothing(uint32 s, void *a, void *b)
 
 static int32   debug   = 0;
 
-// newmap(keysize uint32, valsize uint32,
+// makemap(keysize uint32, valsize uint32,
 //     keyalg uint32, valalg uint32,
 //     hint uint32) (hmap *map[any]any);
 Hmap*
@@ -675,12 +675,12 @@ makemap(uint32 keysize, uint32 valsize,
 
        if(keyalg >= nelem(algarray) || algarray[keyalg].hash == nohash) {
                printf("map(keyalg=%d)\n", keyalg);
-               throw("sys·newmap: unsupported map key type");
+               throw("sys·makemap: unsupported map key type");
        }
 
        if(valalg >= nelem(algarray)) {
                printf("map(valalg=%d)\n", valalg);
-               throw("sys·newmap: unsupported map value type");
+               throw("sys·makemap: unsupported map value type");
        }
 
        h = mal(sizeof(*h));
@@ -720,18 +720,18 @@ makemap(uint32 keysize, uint32 valsize,
        h->po2 = rnd(h->vo2+valsize, 1);
 
        if(debug) {
-               printf("newmap: map=%p; keysize=%d; valsize=%d; keyalg=%d; valalg=%d; offsets=%d,%d; %d,%d,%d; %d,%d,%d\n",
+               printf("makemap: map=%p; keysize=%d; valsize=%d; keyalg=%d; valalg=%d; offsets=%d,%d; %d,%d,%d; %d,%d,%d\n",
                        h, keysize, valsize, keyalg, valalg, h->ko0, h->vo0, h->ko1, h->vo1, h->po1, h->ko2, h->vo2, h->po2);
        }
 
        return h;
 }
 
-// newmap(keysize uint32, valsize uint32,
+// makemap(keysize uint32, valsize uint32,
 //     keyalg uint32, valalg uint32,
 //     hint uint32) (hmap *map[any]any);
 void
-sys·newmap(uint32 keysize, uint32 valsize,
+sys·makemap(uint32 keysize, uint32 valsize,
        uint32 keyalg, uint32 valalg, uint32 hint,
        Hmap *ret)
 {
index 63093ad881aa1409c9bbea3d4e4c7cec14932167..6bd2f93ff2a9de2cddb0e9dc1ff42e4714011aa7 100644 (file)
@@ -45,7 +45,7 @@ itab(InterfaceType *inter, Type *type, int32 canfail)
        Itab *m;
        UncommonType *x;
 
-       if(inter->mhdr.nel == 0)
+       if(inter->mhdr.len == 0)
                throw("internal error - misuse of itab");
 
        // easy case
@@ -90,7 +90,7 @@ itab(InterfaceType *inter, Type *type, int32 canfail)
                }
        }
 
-       ni = inter->mhdr.nel;
+       ni = inter->mhdr.len;
        m = malloc(sizeof(*m) + ni*sizeof m->fun[0]);
        m->inter = inter;
        m->type = type;
@@ -100,9 +100,9 @@ search:
        // so can iterate over both in lock step;
        // the loop is O(ni+nt) not O(ni*nt).
        i = inter->m;
-       ei = i + inter->mhdr.nel;
+       ei = i + inter->mhdr.len;
        t = x->m;
-       et = t + x->mhdr.nel;
+       et = t + x->mhdr.len;
        for(; i < ei; i++) {
                ihash = i->hash;
                iname = i->name;
index af74662db3b592eeb97e7f585f8d9eef6e81697f..016b9e9ec013361d281785dbbc67ff606cbbda76 100644 (file)
@@ -87,7 +87,7 @@ func setiface(typ *byte, x *byte, ret *byte) {
        InterfaceType *t;
 
        t = (InterfaceType*)gettype(typ);
-       if(t->mhdr.nel == 0) {
+       if(t->mhdr.len == 0) {
                // already an empty interface
                *(Eface*)ret = *(Eface*)x;
                return;
index c5ba3e6a5ec8f7eee249cdc749122d4e49d46cad..50a94ec92109d6f39ef0a3d1bdfcc9f18d953a88 100644 (file)
@@ -142,8 +142,8 @@ rnd(uint32 n, uint32 m)
 static int32   argc;
 static uint8** argv;
 
-Array os·Args;
-Array os·Envs;
+Slice os·Args;
+Slice os·Envs;
 
 void
 args(int32 c, uint8 **v)
@@ -168,13 +168,13 @@ goargs(void)
        for(i=0; i<argc; i++)
                gargv[i] = gostring(argv[i]);
        os·Args.array = (byte*)gargv;
-       os·Args.nel = argc;
+       os·Args.len = argc;
        os·Args.cap = argc;
 
        for(i=0; i<envc; i++)
                genvv[i] = gostring(argv[argc+1+i]);
        os·Envs.array = (byte*)genvv;
-       os·Envs.nel = envc;
+       os·Envs.len = envc;
        os·Envs.cap = envc;
 }
 
@@ -189,7 +189,7 @@ getenv(int8 *s)
        bs = (byte*)s;
        len = findnull(bs);
        envv = (String*)os·Envs.array;
-       envc = os·Envs.nel;
+       envc = os·Envs.len;
        for(i=0; i<envc; i++){
                if(envv[i].len <= len)
                        continue;
index 48c98f21813c6f3058d8895b4f7b96f394a4ebfc..c346c692f69439a2fc95b8ad271b022ac34ebb38 100644 (file)
@@ -42,7 +42,6 @@ typedef       uint32          uintptr;
 typedef        uint8                   bool;
 typedef        uint8                   byte;
 typedef        struct  Alg             Alg;
-typedef        struct  Array           Array;
 typedef        struct  Func            Func;
 typedef        struct  G               G;
 typedef        struct  Gobuf           Gobuf;
@@ -50,6 +49,7 @@ typedef       struct  Lock            Lock;
 typedef        struct  M               M;
 typedef        struct  Mem             Mem;
 typedef        union   Note            Note;
+typedef        struct  Slice           Slice;
 typedef        struct  Stktop          Stktop;
 typedef        struct  String          String;
 typedef        struct  Usema           Usema;
@@ -140,10 +140,10 @@ struct Eface
        void*   data;
 };
 
-struct Array
+struct Slice
 {                              // must not move anything
        byte*   array;          // actual data
-       uint32  nel;            // number of elements
+       uint32  len;            // number of elements
        uint32  cap;            // allocated number of elements
 };
 struct Gobuf
@@ -252,7 +252,7 @@ struct      Func
        String  src;    // src file name
        uint64  entry;  // entry pc
        int64   frame;  // stack frame size
-       Array   pcln;   // pc/ln tab for this func
+       Slice   pcln;   // pc/ln tab for this func
        int64   pc0;    // starting pc, ln for table
        int32   ln0;
        int32   args;   // number of 32-bit in/out args
@@ -426,7 +426,7 @@ void        notewakeup(Note*);
 #define sys_memclr sys·memclr
 #define sys_getcallerpc sys·getcallerpc
 #define sys_mmap sys·mmap
-#define sys_printarray sys·printarray
+#define sys_printslice sys·printslice
 #define sys_printbool sys·printbool
 #define sys_printfloat sys·printfloat
 #define sys_printhex sys·printhex
@@ -461,7 +461,7 @@ void        sys_printpc(void*);
 void   sys_printpointer(void*);
 void   sys_printuint(uint64);
 void   sys_printhex(uint64);
-void   sys_printarray(Array);
+void   sys_printslice(Slice);
 
 /*
  * wrapped for go users
similarity index 69%
rename from src/pkg/runtime/array.c
rename to src/pkg/runtime/slice.c
index bbd57b03e1c5ac6588cc281792e591edb0c52cef..d7a5a062f1e3f24086167d83d14d4b6c98804683 100644 (file)
@@ -6,9 +6,9 @@
 
 static int32   debug   = 0;
 
-// newarray(nel int, cap int, width int) (ary []any);
+// makeslice(nel int, cap int, width int) (ary []any);
 void
-sys·newarray(uint32 nel, uint32 cap, uint32 width, Array ret)
+sys·makeslice(uint32 nel, uint32 cap, uint32 width, Slice ret)
 {
        uint64 size;
 
@@ -16,21 +16,21 @@ sys·newarray(uint32 nel, uint32 cap, uint32 width, Array ret)
                cap = nel;
        size = cap*width;
 
-       ret.nel = nel;
+       ret.len = nel;
        ret.cap = cap;
        ret.array = mal(size);
 
        FLUSH(&ret);
 
        if(debug) {
-               prints("newarray: nel=");
+               prints("makeslice: nel=");
                sys·printint(nel);
                prints("; cap=");
                sys·printint(cap);
                prints("; width=");
                sys·printint(width);
                prints("; ret=");
-               sys·printarray(ret);
+               sys·printslice(ret);
                prints("\n");
        }
 }
@@ -48,15 +48,15 @@ throwslice(uint32 lb, uint32 hb, uint32 n)
        throw("array slice");
 }
 
-// arraysliced(old []any, lb int, hb int, width int) (ary []any);
+// sliceslice(old []any, lb int, hb int, width int) (ary []any);
 void
-sys·arraysliced(Array old, uint32 lb, uint32 hb, uint32 width, Array ret)
+sys·sliceslice(Slice old, uint32 lb, uint32 hb, uint32 width, Slice ret)
 {
 
        if(hb > old.cap || lb > hb) {
                if(debug) {
-                       prints("sys·arraysliced: old=");
-                       sys·printarray(old);
+                       prints("sys·sliceslice: old=");
+                       sys·printslice(old);
                        prints("; lb=");
                        sys·printint(lb);
                        prints("; hb=");
@@ -66,7 +66,7 @@ sys·arraysliced(Array old, uint32 lb, uint32 hb, uint32 width, Array ret)
                        prints("\n");
 
                        prints("oldarray: nel=");
-                       sys·printint(old.nel);
+                       sys·printint(old.len);
                        prints("; cap=");
                        sys·printint(old.cap);
                        prints("\n");
@@ -75,15 +75,15 @@ sys·arraysliced(Array old, uint32 lb, uint32 hb, uint32 width, Array ret)
        }
 
        // new array is inside old array
-       ret.nel = hb-lb;
+       ret.len = hb-lb;
        ret.cap = old.cap - lb;
        ret.array = old.array + lb*width;
 
        FLUSH(&ret);
 
        if(debug) {
-               prints("sys·arraysliced: old=");
-               sys·printarray(old);
+               prints("sys·sliceslice: old=");
+               sys·printslice(old);
                prints("; lb=");
                sys·printint(lb);
                prints("; hb=");
@@ -91,19 +91,19 @@ sys·arraysliced(Array old, uint32 lb, uint32 hb, uint32 width, Array ret)
                prints("; width=");
                sys·printint(width);
                prints("; ret=");
-               sys·printarray(ret);
+               sys·printslice(ret);
                prints("\n");
        }
 }
 
-// arrayslices(old *any, nel int, lb int, hb int, width int) (ary []any);
+// slicearray(old *any, nel int, lb int, hb int, width int) (ary []any);
 void
-sys·arrayslices(byte* old, uint32 nel, uint32 lb, uint32 hb, uint32 width, Array ret)
+sys·slicearray(byte* old, uint32 nel, uint32 lb, uint32 hb, uint32 width, Slice ret)
 {
 
        if(hb > nel || lb > hb) {
                if(debug) {
-                       prints("sys·arrayslices: old=");
+                       prints("sys·slicearray: old=");
                        sys·printpointer(old);
                        prints("; nel=");
                        sys·printint(nel);
@@ -119,14 +119,14 @@ sys·arrayslices(byte* old, uint32 nel, uint32 lb, uint32 hb, uint32 width, Arra
        }
 
        // new array is inside old array
-       ret.nel = hb-lb;
+       ret.len = hb-lb;
        ret.cap = nel-lb;
        ret.array = old + lb*width;
 
        FLUSH(&ret);
 
        if(debug) {
-               prints("sys·arrayslices: old=");
+               prints("sys·slicearray: old=");
                sys·printpointer(old);
                prints("; nel=");
                sys·printint(nel);
@@ -137,37 +137,37 @@ sys·arrayslices(byte* old, uint32 nel, uint32 lb, uint32 hb, uint32 width, Arra
                prints("; width=");
                sys·printint(width);
                prints("; ret=");
-               sys·printarray(ret);
+               sys·printslice(ret);
                prints("\n");
        }
 }
 
-// arrays2d(old *any, nel int) (ary []any)
+// arraytoslice(old *any, nel int) (ary []any)
 void
-sys·arrays2d(byte* old, uint32 nel, Array ret)
+sys·arraytoslice(byte* old, uint32 nel, Slice ret)
 {
 
        // new dope to old array
-       ret.nel = nel;
+       ret.len = nel;
        ret.cap = nel;
        ret.array = old;
 
        FLUSH(&ret);
 
        if(debug) {
-               prints("sys·arrays2d: old=");
+               prints("sys·slicearrayp: old=");
                sys·printpointer(old);
                prints("; ret=");
-               sys·printarray(ret);
+               sys·printslice(ret);
                prints("\n");
        }
 }
 
 void
-sys·printarray(Array a)
+sys·printslice(Slice a)
 {
        prints("[");
-       sys·printint(a.nel);
+       sys·printint(a.len);
        prints("/");
        sys·printint(a.cap);
        prints("]");
index c91a7507e6491277bf368e79884393cdc735b48e..3134cbbfe6b979973a13ff55e38cc699a1a721d2 100644 (file)
@@ -157,26 +157,26 @@ func intstring(v int64) (s String) {
        s.len = runetochar(s.str, v);
 }
 
-func arraystring(b Array) (s String) {
-       s = gostringsize(b.nel);
+func slicebytetostring(b Slice) (s String) {
+       s = gostringsize(b.len);
        mcpy(s.str, b.array, s.len);
 }
 
 
-func arraystringi(b Array) (s String) {
+func sliceinttostring(b Slice) (s String) {
        int32 siz1, siz2, i;
        int32 *a;
        byte dum[8];
 
        a = (int32*)b.array;
        siz1 = 0;
-       for(i=0; i<b.nel; i++) {
+       for(i=0; i<b.len; i++) {
                siz1 += runetochar(dum, a[i]);
        }
 
        s = gostringsize(siz1+4);
        siz2 = 0;
-       for(i=0; i<b.nel; i++) {
+       for(i=0; i<b.len; i++) {
                // check for race
                if(siz2 >= siz1)
                        break;
index a03c165af80466a3c05ea2cd3603237b34214923..97501623d3ef381925305e8cf6aee5bdb9bf7613 100644 (file)
 
 // Return a pointer to a byte array containing the symbol table segment.
 void
-sys·symdat(Array *symtab, Array *pclntab)
+sys·symdat(Slice *symtab, Slice *pclntab)
 {
-       Array *a;
+       Slice *a;
        int32 *v;
 
        v = SYMCOUNTS;
 
        a = mal(sizeof *a);
-       a->nel = v[0];
-       a->cap = a->nel;
+       a->len = v[0];
+       a->cap = a->len;
        a->array = SYMDATA;
        symtab = a;
        FLUSH(&symtab);
 
        a = mal(sizeof *a);
-       a->nel = v[1];
-       a->cap = a->nel;
+       a->len = v[1];
+       a->cap = a->len;
        a->array = SYMDATA + v[0];
        pclntab = a;
        FLUSH(&pclntab);
@@ -274,8 +274,8 @@ splitpcln(void)
        line = 0;
        for(; p < ep; p++) {
                if(f < ef && pc > (f+1)->entry) {
-                       f->pcln.nel = p - f->pcln.array;
-                       f->pcln.cap = f->pcln.nel;
+                       f->pcln.len = p - f->pcln.array;
+                       f->pcln.cap = f->pcln.len;
                        f++;
                        f->pcln.array = p;
                        f->pc0 = pc;
@@ -295,8 +295,8 @@ splitpcln(void)
                pc += PcQuant;
        }
        if(f < ef) {
-               f->pcln.nel = p - f->pcln.array;
-               f->pcln.cap = f->pcln.nel;
+               f->pcln.len = p - f->pcln.array;
+               f->pcln.cap = f->pcln.len;
        }
 }
 
@@ -311,7 +311,7 @@ funcline(Func *f, uint64 targetpc)
        int32 line;
 
        p = f->pcln.array;
-       ep = p + f->pcln.nel;
+       ep = p + f->pcln.len;
        pc = f->pc0;
        line = f->ln0;
        for(; p < ep && pc <= targetpc; p++) {
index 10d0068eac84000bbf1052b293824185d606ce66..86e31ba2aea66d1a215fb3c340001398c5084ae0 100644 (file)
@@ -39,7 +39,7 @@ struct UncommonType
 {
        String *name;
        String *pkgPath;
-       Array mhdr;
+       Slice mhdr;
        Method m[];
 };
 
@@ -62,7 +62,7 @@ struct IMethod
 struct InterfaceType
 {
        Type;
-       Array mhdr;
+       Slice mhdr;
        IMethod m[];
 };