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 | e2028e576e4086142f45c441c4b3d73832dca41d (patch) | |
tree | e89aae453723a4d00e469204e32f8eb7da8a4c86 /src | |
parent | 797899b6e7ae3d9c0528d91f0fb6184246045cf3 (diff) | |
download | go-e2028e576e4086142f45c441c4b3d73832dca41d.tar.gz |
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://codereview.appspot.com/120930043
Diffstat (limited to 'src')
-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 4b7580cb4..aeabad413 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 6b79363b2..01c6a415c 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 9b496785a..ed5dbbd3c 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 1fd9ba2bc..51b08d56d 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 672fce90b..339c5dd41 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 187616cd0..5ac5c27d4 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 60108273c..3664e45ae 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: |