diff options
author | Keith Randall <khr@golang.org> | 2015-11-05 12:39:56 -0800 |
---|---|---|
committer | Keith Randall <khr@golang.org> | 2015-11-07 02:42:12 +0000 |
commit | 4b7d5f0b941c75e678d60e84602155ea9e73bab6 (patch) | |
tree | 14adb10bb9f88fbfcda921032ab192230daccb61 /src/runtime/memclr_386.s | |
parent | 321a40721bbfcb9bcf6113d4e8afd1bc030f1d8f (diff) | |
download | go-4b7d5f0b941c75e678d60e84602155ea9e73bab6.tar.gz go-4b7d5f0b941c75e678d60e84602155ea9e73bab6.zip |
runtime: memmove/memclr pointers atomically
Make sure that we're moving or zeroing pointers atomically.
Anything that is a multiple of pointer size and at least
pointer aligned might have pointers in it. All the code looks
ok except for the 1-pointer-sized moves.
Fixes #13160
Update #12552
Change-Id: Ib97d9b918fa9f4cc5c56c67ed90255b7fdfb7b45
Reviewed-on: https://go-review.googlesource.com/16668
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/runtime/memclr_386.s')
-rw-r--r-- | src/runtime/memclr_386.s | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/runtime/memclr_386.s b/src/runtime/memclr_386.s index 3f20b69c82..ce962f35da 100644 --- a/src/runtime/memclr_386.s +++ b/src/runtime/memclr_386.s @@ -21,7 +21,8 @@ tail: CMPL BX, $2 JBE _1or2 CMPL BX, $4 - JBE _3or4 + JB _3 + JE _4 CMPL BX, $8 JBE _5through8 CMPL BX, $16 @@ -68,9 +69,13 @@ _1or2: RET _0: RET -_3or4: +_3: MOVW AX, (DI) - MOVW AX, -2(DI)(BX*1) + MOVB AX, 2(DI) + RET +_4: + // We need a separate case for 4 to make sure we clear pointers atomically. + MOVL AX, (DI) RET _5through8: MOVL AX, (DI) |