]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/gc, runtime: rename writebarrierfat to typedmemmove
authorRuss Cox <rsc@golang.org>
Mon, 29 Dec 2014 15:05:57 +0000 (10:05 -0500)
committerRuss Cox <rsc@golang.org>
Tue, 6 Jan 2015 00:27:20 +0000 (00:27 +0000)
Preparation for replacing many memmove calls in runtime
with typedmemmove, which is a clearer description of what
the routine is doing.

For the same reason, rename writebarriercopy to typedslicecopy.

Change-Id: I6f23bef2c2215509fefba175b16908f76dc7538c
Reviewed-on: https://go-review.googlesource.com/2276
Reviewed-by: Rick Hudson <rlh@golang.org>
src/cmd/gc/builtin.c
src/cmd/gc/runtime.go
src/cmd/gc/walk.c
src/runtime/mgc0.go
src/runtime/slice.go

index aeeadedca67cfc1e1cbc65398a2240cf240e6144..34328441f5aa4fe3b1d58ab53a0e0c903f3d7b61 100644 (file)
@@ -113,8 +113,8 @@ char *runtimeimport =
        "func @\"\".writebarrierfat1101 (@\"\".dst·1 *any, _ *byte, @\"\".src·3 any)\n"
        "func @\"\".writebarrierfat1110 (@\"\".dst·1 *any, _ *byte, @\"\".src·3 any)\n"
        "func @\"\".writebarrierfat1111 (@\"\".dst·1 *any, _ *byte, @\"\".src·3 any)\n"
-       "func @\"\".writebarrierfat (@\"\".typ·1 *byte, @\"\".dst·2 *any, @\"\".src·3 *any)\n"
-       "func @\"\".writebarriercopy (@\"\".typ·2 *byte, @\"\".dst·3 any, @\"\".src·4 any) (? int)\n"
+       "func @\"\".typedmemmove (@\"\".typ·1 *byte, @\"\".dst·2 *any, @\"\".src·3 *any)\n"
+       "func @\"\".typedslicecopy (@\"\".typ·2 *byte, @\"\".dst·3 any, @\"\".src·4 any) (? int)\n"
        "func @\"\".selectnbsend (@\"\".chanType·2 *byte, @\"\".hchan·3 chan<- any, @\"\".elem·4 *any) (? bool)\n"
        "func @\"\".selectnbrecv (@\"\".chanType·2 *byte, @\"\".elem·3 *any, @\"\".hchan·4 <-chan any) (? bool)\n"
        "func @\"\".selectnbrecv2 (@\"\".chanType·2 *byte, @\"\".elem·3 *any, @\"\".received·4 *bool, @\"\".hchan·5 <-chan any) (? bool)\n"
index c6007714ce2ee616260402f752cbbb8c5faf0fd3..c8057314309c15467a88f5c965cf5b6f9335e0c3 100644 (file)
@@ -144,8 +144,8 @@ func writebarrierfat1101(dst *any, _ *byte, src any)
 func writebarrierfat1110(dst *any, _ *byte, src any)
 func writebarrierfat1111(dst *any, _ *byte, src any)
 
-func writebarrierfat(typ *byte, dst *any, src *any)
-func writebarriercopy(typ *byte, dst any, src any) int
+func typedmemmove(typ *byte, dst *any, src *any)
+func typedslicecopy(typ *byte, dst any, src any) int
 
 func selectnbsend(chanType *byte, hchan chan<- any, elem *any) bool
 func selectnbrecv(chanType *byte, elem *any, hchan <-chan any) bool
index 1025361cf819d81b0f2ad668a1413534b5c7d740..df97f17670a0086582333137689a9a7cb6e4c2a0 100644 (file)
@@ -2096,8 +2096,8 @@ applywritebarrier(Node *n, NodeList **init)
                                r = r->left;
                        r = nod(OADDR, r, N);
                        r->etype = 1; // addr does not escape
-                       //warnl(n->lineno, "writebarrierfat %T %N", t, r);
-                       n = mkcall1(writebarrierfn("writebarrierfat", t, r->left->type), T, init,
+                       //warnl(n->lineno, "typedmemmove %T %N", t, r);
+                       n = mkcall1(writebarrierfn("typedmemmove", t, r->left->type), T, init,
                                typename(t), l, r);
                }
        }
@@ -2952,7 +2952,7 @@ copyany(Node *n, NodeList **init, int runtimecall)
        NodeList *l;
        
        if(haspointers(n->left->type->type)) {
-               fn = writebarrierfn("writebarriercopy", n->left->type, n->right->type);
+               fn = writebarrierfn("typedslicecopy", n->left->type, n->right->type);
                return mkcall1(fn, n->type, init, typename(n->left->type->type), n->left, n->right);
        }
 
index 7b92d595c0f98d1259d3873ebc5ded30dc48a853..9f4e3c855f560589f83445c057b517161276a426 100644 (file)
@@ -288,8 +288,8 @@ func writebarrieriface(dst *[2]uintptr, src [2]uintptr) {
 // The implementations are written to wbfat.go.
 
 //go:nosplit
-func writebarrierfat(typ *_type, dst, src unsafe.Pointer) {
-       if !needwb() {
+func typedmemmove(typ *_type, dst, src unsafe.Pointer) {
+       if !needwb() || (typ.kind&kindNoPointers) != 0 {
                memmove(dst, src, typ.size)
                return
        }
@@ -322,7 +322,7 @@ func writebarrierfat(typ *_type, dst, src unsafe.Pointer) {
 }
 
 //go:nosplit
-func writebarriercopy(typ *_type, dst, src slice) int {
+func typedslicecopy(typ *_type, dst, src slice) int {
        n := dst.len
        if n > src.len {
                n = src.len
@@ -347,7 +347,7 @@ func writebarriercopy(typ *_type, dst, src slice) int {
                        srcp = add(srcp, uintptr(n-1)*typ.size)
                        i := uint(0)
                        for {
-                               writebarrierfat(typ, dstp, srcp)
+                               typedmemmove(typ, dstp, srcp)
                                if i++; i >= n {
                                        break
                                }
@@ -359,7 +359,7 @@ func writebarriercopy(typ *_type, dst, src slice) int {
                        // out of the array they point into.
                        i := uint(0)
                        for {
-                               writebarrierfat(typ, dstp, srcp)
+                               typedmemmove(typ, dstp, srcp)
                                if i++; i >= n {
                                        break
                                }
index 8264cd6956f500e5ae74ff461c6803fb7a00601f..62d6b7ce87735e16c83cd9d854bde4c9964ef306 100644 (file)
@@ -88,7 +88,7 @@ func growslice(t *slicetype, old sliceStruct, n int64) sliceStruct {
                // TODO(rsc): Use memmove when !needwb().
                p = newarray(et, uintptr(newcap))
                for i := 0; i < old.len; i++ {
-                       writebarrierfat(et, add(p, uintptr(i)*et.size), add(old.array, uintptr(i)*et.size))
+                       typedmemmove(et, add(p, uintptr(i)*et.size), add(old.array, uintptr(i)*et.size))
                }
        }