1
0
mirror of https://github.com/golang/go synced 2024-11-26 20:21:25 -07:00

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>
This commit is contained in:
Russ Cox 2014-12-29 10:05:57 -05:00
parent 7b4df8f018
commit bcadab9349
5 changed files with 13 additions and 13 deletions

View 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"

View 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

View 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);
}

View 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
}

View 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))
}
}