cmd/gc, runtime: rename writebarrierfat to typedmemmove
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>
diff --git a/src/cmd/gc/builtin.c b/src/cmd/gc/builtin.c
index aeeaded..3432844 100644
--- a/src/cmd/gc/builtin.c
+++ b/src/cmd/gc/builtin.c
@@ -113,8 +113,8 @@
"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"
diff --git a/src/cmd/gc/runtime.go b/src/cmd/gc/runtime.go
index c600771..c805731 100644
--- a/src/cmd/gc/runtime.go
+++ b/src/cmd/gc/runtime.go
@@ -144,8 +144,8 @@
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
diff --git a/src/cmd/gc/walk.c b/src/cmd/gc/walk.c
index 1025361..df97f17 100644
--- a/src/cmd/gc/walk.c
+++ b/src/cmd/gc/walk.c
@@ -2096,8 +2096,8 @@
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 @@
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);
}
diff --git a/src/runtime/mgc0.go b/src/runtime/mgc0.go
index 7b92d59..9f4e3c8 100644
--- a/src/runtime/mgc0.go
+++ b/src/runtime/mgc0.go
@@ -288,8 +288,8 @@
// 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 @@
}
//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 @@
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 @@
// out of the array they point into.
i := uint(0)
for {
- writebarrierfat(typ, dstp, srcp)
+ typedmemmove(typ, dstp, srcp)
if i++; i >= n {
break
}
diff --git a/src/runtime/slice.go b/src/runtime/slice.go
index 8264cd6..62d6b7c 100644
--- a/src/runtime/slice.go
+++ b/src/runtime/slice.go
@@ -88,7 +88,7 @@
// 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))
}
}