From: Josh Bleecher Snyder Date: Mon, 13 Nov 2017 05:36:20 +0000 (-0800) Subject: runtime: short-circuit typedmemmove when dst==src X-Git-Tag: go1.11beta1~1437 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=486caa26d7cd40e7aa9b1ca5d1360d093562eef4;p=gostls13.git runtime: short-circuit typedmemmove when dst==src Change-Id: I855268a4c0d07ad602ec90f5da66422d3d87c5f2 Reviewed-on: https://go-review.googlesource.com/94595 Run-TryBot: Josh Bleecher Snyder Reviewed-by: Keith Randall --- diff --git a/src/runtime/mbarrier.go b/src/runtime/mbarrier.go index c446db93d2..b6c5ee0658 100644 --- a/src/runtime/mbarrier.go +++ b/src/runtime/mbarrier.go @@ -154,6 +154,9 @@ import ( // //go:nosplit func typedmemmove(typ *_type, dst, src unsafe.Pointer) { + if dst == src { + return + } if typ.kind&kindNoPointers == 0 { bulkBarrierPreWrite(uintptr(dst), uintptr(src), typ.size) }