mirror of
https://github.com/golang/go
synced 2024-11-17 07:45:09 -07:00
runtime: short-circuit typedmemmove when dst==src
Change-Id: I855268a4c0d07ad602ec90f5da66422d3d87c5f2 Reviewed-on: https://go-review.googlesource.com/94595 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
68def82008
commit
486caa26d7
@ -154,6 +154,9 @@ import (
|
|||||||
//
|
//
|
||||||
//go:nosplit
|
//go:nosplit
|
||||||
func typedmemmove(typ *_type, dst, src unsafe.Pointer) {
|
func typedmemmove(typ *_type, dst, src unsafe.Pointer) {
|
||||||
|
if dst == src {
|
||||||
|
return
|
||||||
|
}
|
||||||
if typ.kind&kindNoPointers == 0 {
|
if typ.kind&kindNoPointers == 0 {
|
||||||
bulkBarrierPreWrite(uintptr(dst), uintptr(src), typ.size)
|
bulkBarrierPreWrite(uintptr(dst), uintptr(src), typ.size)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user