diff --git a/src/cmd/gc/builtin.c b/src/cmd/gc/builtin.c index aeeadedca67..34328441f5a 100644 --- a/src/cmd/gc/builtin.c +++ b/src/cmd/gc/builtin.c @@ -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" diff --git a/src/cmd/gc/runtime.go b/src/cmd/gc/runtime.go index c6007714ce2..c8057314309 100644 --- a/src/cmd/gc/runtime.go +++ b/src/cmd/gc/runtime.go @@ -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 diff --git a/src/cmd/gc/walk.c b/src/cmd/gc/walk.c index 1025361cf81..df97f17670a 100644 --- a/src/cmd/gc/walk.c +++ b/src/cmd/gc/walk.c @@ -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); } diff --git a/src/runtime/mgc0.go b/src/runtime/mgc0.go index 7b92d595c0f..9f4e3c855f5 100644 --- a/src/runtime/mgc0.go +++ b/src/runtime/mgc0.go @@ -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 } diff --git a/src/runtime/slice.go b/src/runtime/slice.go index 8264cd6956f..62d6b7ce877 100644 --- a/src/runtime/slice.go +++ b/src/runtime/slice.go @@ -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)) } }