]> Cypherpunks repositories - gostls13.git/commit
runtime: prevent pointless jmp in amd64 and 386 memmove
authorJosh Bleecher Snyder <josharian@gmail.com>
Fri, 1 Aug 2014 13:21:08 +0000 (06:21 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Fri, 1 Aug 2014 13:21:08 +0000 (06:21 -0700)
commitbc9e160443f33f979aeb79dd92ac73876841e36e
tree6bc51e7043b6da2018c51eec25c6dfb26e53502c
parent74b62b48644acffd20ca5de9111048dd731c3a06
runtime: prevent pointless jmp in amd64 and 386 memmove

6a and 8a rearrange memmove such that the fallthrough from move_1or2 to move_0 ends up being a JMP to a RET. Insert an explicit RET to prevent such silliness.

Do the same for memclr as prophylaxis.

benchmark                old ns/op     new ns/op     delta
BenchmarkMemmove1        4.59          4.13          -10.02%
BenchmarkMemmove2        4.58          4.13          -9.83%

LGTM=khr
R=golang-codereviews, dvyukov, minux, ruiu, bradfitz, khr
CC=golang-codereviews
https://golang.org/cl/120930043
src/pkg/runtime/memclr_386.s
src/pkg/runtime/memclr_amd64.s
src/pkg/runtime/memclr_plan9_386.s
src/pkg/runtime/memmove_386.s
src/pkg/runtime/memmove_amd64.s
src/pkg/runtime/memmove_plan9_386.s
src/pkg/runtime/memmove_plan9_amd64.s