diff options
| author | Josh Bleecher Snyder <josharian@gmail.com> | 2014-08-01 06:21:08 -0700 |
|---|---|---|
| committer | Josh Bleecher Snyder <josharian@gmail.com> | 2014-08-01 06:21:08 -0700 |
| commit | bc9e160443f33f979aeb79dd92ac73876841e36e (patch) | |
| tree | 6bc51e7043b6da2018c51eec25c6dfb26e53502c /src/pkg/runtime | |
| parent | 74b62b48644acffd20ca5de9111048dd731c3a06 (diff) | |
| download | go-bc9e160443f33f979aeb79dd92ac73876841e36e.tar.xz | |
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
Diffstat (limited to 'src/pkg/runtime')
| -rw-r--r-- | src/pkg/runtime/memclr_386.s | 1 | ||||
| -rw-r--r-- | src/pkg/runtime/memclr_amd64.s | 1 | ||||
| -rw-r--r-- | src/pkg/runtime/memclr_plan9_386.s | 1 | ||||
| -rw-r--r-- | src/pkg/runtime/memmove_386.s | 1 | ||||
| -rw-r--r-- | src/pkg/runtime/memmove_amd64.s | 1 | ||||
| -rw-r--r-- | src/pkg/runtime/memmove_plan9_386.s | 1 | ||||
| -rw-r--r-- | src/pkg/runtime/memmove_plan9_amd64.s | 1 |
7 files changed, 7 insertions, 0 deletions
diff --git a/src/pkg/runtime/memclr_386.s b/src/pkg/runtime/memclr_386.s index 4b7580cb49..aeabad413e 100644 --- a/src/pkg/runtime/memclr_386.s +++ b/src/pkg/runtime/memclr_386.s @@ -63,6 +63,7 @@ clr_loop: clr_1or2: MOVB AX, (DI) MOVB AX, -1(DI)(BX*1) + RET clr_0: RET clr_3or4: diff --git a/src/pkg/runtime/memclr_amd64.s b/src/pkg/runtime/memclr_amd64.s index 6b79363b24..01c6a415c0 100644 --- a/src/pkg/runtime/memclr_amd64.s +++ b/src/pkg/runtime/memclr_amd64.s @@ -62,6 +62,7 @@ clr_loop: clr_1or2: MOVB AX, (DI) MOVB AX, -1(DI)(BX*1) + RET clr_0: RET clr_3or4: diff --git a/src/pkg/runtime/memclr_plan9_386.s b/src/pkg/runtime/memclr_plan9_386.s index 9b496785a2..ed5dbbd3c6 100644 --- a/src/pkg/runtime/memclr_plan9_386.s +++ b/src/pkg/runtime/memclr_plan9_386.s @@ -32,6 +32,7 @@ clr_tail: clr_1or2: MOVB AX, (DI) MOVB AX, -1(DI)(BX*1) + RET clr_0: RET clr_3or4: diff --git a/src/pkg/runtime/memmove_386.s b/src/pkg/runtime/memmove_386.s index 1fd9ba2bcc..51b08d56d3 100644 --- a/src/pkg/runtime/memmove_386.s +++ b/src/pkg/runtime/memmove_386.s @@ -115,6 +115,7 @@ move_1or2: MOVB -1(SI)(BX*1), CX MOVB AX, (DI) MOVB CX, -1(DI)(BX*1) + RET move_0: RET move_3or4: diff --git a/src/pkg/runtime/memmove_amd64.s b/src/pkg/runtime/memmove_amd64.s index 672fce90b3..339c5dd410 100644 --- a/src/pkg/runtime/memmove_amd64.s +++ b/src/pkg/runtime/memmove_amd64.s @@ -122,6 +122,7 @@ move_1or2: MOVB -1(SI)(BX*1), CX MOVB AX, (DI) MOVB CX, -1(DI)(BX*1) + RET move_0: RET move_3or4: diff --git a/src/pkg/runtime/memmove_plan9_386.s b/src/pkg/runtime/memmove_plan9_386.s index 187616cd0a..5ac5c27d40 100644 --- a/src/pkg/runtime/memmove_plan9_386.s +++ b/src/pkg/runtime/memmove_plan9_386.s @@ -101,6 +101,7 @@ move_1or2: MOVB -1(SI)(BX*1), CX MOVB AX, (DI) MOVB CX, -1(DI)(BX*1) + RET move_0: RET move_3or4: diff --git a/src/pkg/runtime/memmove_plan9_amd64.s b/src/pkg/runtime/memmove_plan9_amd64.s index 60108273cf..3664e45ae2 100644 --- a/src/pkg/runtime/memmove_plan9_amd64.s +++ b/src/pkg/runtime/memmove_plan9_amd64.s @@ -104,6 +104,7 @@ move_1or2: MOVB -1(SI)(BX*1), CX MOVB AX, (DI) MOVB CX, -1(DI)(BX*1) + RET move_0: RET move_3or4: |
