author | Shawn Walker-Salas <shawn.walker@oracle.com> |
Thu, 21 Jan 2016 09:20:59 -0800 | |
changeset 5331 | 9c955076ffe3 |
permissions | -rw-r--r-- |
5331
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
1 |
From fc0f36b2ce201142a9137fa8ea6a55e454d1213f Mon Sep 17 00:00:00 2001 |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
2 |
From: Austin Clements <[email protected]> |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
3 |
Date: Fri, 2 Oct 2015 18:17:54 -0400 |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
4 |
Subject: [PATCH 29/63] [release-branch.go1.5] runtime: use 4 byte writes in |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
5 |
amd64p32 memmove/memclr |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
6 |
|
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
7 |
Currently, amd64p32's memmove and memclr use 8 byte writes as much as |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
8 |
possible and 1 byte writes for the tail of the object. However, if an |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
9 |
object ends with a 4 byte pointer at an 8 byte aligned offset, this |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
10 |
may copy/zero the pointer field one byte at a time, allowing the |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
11 |
garbage collector to observe a partially copied pointer. |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
12 |
|
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
13 |
Fix this by using 4 byte writes instead of 8 byte writes. |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
14 |
|
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
15 |
Updates #12552. |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
16 |
|
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
17 |
Change-Id: I13324fd05756fb25ae57e812e836f0a975b5595c |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
18 |
Reviewed-on: https://go-review.googlesource.com/15370 |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
19 |
Run-TryBot: Austin Clements <[email protected]> |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
20 |
TryBot-Result: Gobot Gobot <[email protected]> |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
21 |
Reviewed-by: Brad Fitzpatrick <[email protected]> |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
22 |
Reviewed-by: Keith Randall <[email protected]> |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
23 |
Reviewed-on: https://go-review.googlesource.com/16908 |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
24 |
Reviewed-by: Russ Cox <[email protected]> |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
25 |
--- |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
26 |
src/runtime/asm_amd64p32.s | 6 +++--- |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
27 |
src/runtime/memmove_nacl_amd64p32.s | 23 +++++++++++++---------- |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
28 |
2 files changed, 16 insertions(+), 13 deletions(-) |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
29 |
|
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
30 |
diff --git a/src/runtime/asm_amd64p32.s b/src/runtime/asm_amd64p32.s |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
31 |
index 6e97256..a001a76 100644 |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
32 |
--- a/src/runtime/asm_amd64p32.s |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
33 |
+++ b/src/runtime/asm_amd64p32.s |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
34 |
@@ -627,12 +627,12 @@ TEXT runtime·memclr(SB),NOSPLIT,$0-8 |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
35 |
MOVL ptr+0(FP), DI |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
36 |
MOVL n+4(FP), CX |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
37 |
MOVQ CX, BX |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
38 |
- ANDQ $7, BX |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
39 |
- SHRQ $3, CX |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
40 |
+ ANDQ $3, BX |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
41 |
+ SHRQ $2, CX |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
42 |
MOVQ $0, AX |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
43 |
CLD |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
44 |
REP |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
45 |
- STOSQ |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
46 |
+ STOSL |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
47 |
MOVQ BX, CX |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
48 |
REP |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
49 |
STOSB |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
50 |
diff --git a/src/runtime/memmove_nacl_amd64p32.s b/src/runtime/memmove_nacl_amd64p32.s |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
51 |
index 373607a..be9e1e5 100644 |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
52 |
--- a/src/runtime/memmove_nacl_amd64p32.s |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
53 |
+++ b/src/runtime/memmove_nacl_amd64p32.s |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
54 |
@@ -4,6 +4,9 @@ |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
55 |
|
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
56 |
#include "textflag.h" |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
57 |
|
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
58 |
+// This could use MOVSQ, but we use MOVSL so that if an object ends in |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
59 |
+// a 4 byte pointer, we copy it as a unit instead of byte by byte. |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
60 |
+ |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
61 |
TEXT runtime·memmove(SB), NOSPLIT, $0-12 |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
62 |
MOVL to+0(FP), DI |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
63 |
MOVL from+4(FP), SI |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
64 |
@@ -14,9 +17,9 @@ TEXT runtime·memmove(SB), NOSPLIT, $0-12 |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
65 |
|
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
66 |
forward: |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
67 |
MOVL BX, CX |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
68 |
- SHRL $3, CX |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
69 |
- ANDL $7, BX |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
70 |
- REP; MOVSQ |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
71 |
+ SHRL $2, CX |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
72 |
+ ANDL $3, BX |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
73 |
+ REP; MOVSL |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
74 |
MOVL BX, CX |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
75 |
REP; MOVSB |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
76 |
RET |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
77 |
@@ -32,13 +35,13 @@ back: |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
78 |
STD |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
79 |
|
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
80 |
MOVL BX, CX |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
81 |
- SHRL $3, CX |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
82 |
- ANDL $7, BX |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
83 |
- SUBL $8, DI |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
84 |
- SUBL $8, SI |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
85 |
- REP; MOVSQ |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
86 |
- ADDL $7, DI |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
87 |
- ADDL $7, SI |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
88 |
+ SHRL $2, CX |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
89 |
+ ANDL $3, BX |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
90 |
+ SUBL $4, DI |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
91 |
+ SUBL $4, SI |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
92 |
+ REP; MOVSL |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
93 |
+ ADDL $3, DI |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
94 |
+ ADDL $3, SI |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
95 |
MOVL BX, CX |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
96 |
REP; MOVSB |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
97 |
CLD |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
98 |
-- |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
99 |
2.6.1 |
9c955076ffe3
PSARC/2015/203 Google Go version 1.5
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
diff
changeset
|
100 |