aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-11-21 15:57:10 -0500
committerRuss Cox <rsc@golang.org>2014-11-21 15:57:10 -0500
commit8c3f64022a34c140853a3ec6a3be5695e6c05de2 (patch)
treeb6b5dd29f5ec1ca248096e7a4e7e78c8412394f4 /src/runtime
parentcc73a44f67a58198161a159b6ee9e3b18d152ab5 (diff)
downloadgo-8c3f64022a34c140853a3ec6a3be5695e6c05de2.tar.xz
[dev.garbage] runtime: add prefetcht0, prefetcht1, prefetcht2, prefetcht3, prefetchnta for GC
We don't know what we need yet, so add them all. Add them even on x86 architectures (as no-ops) so that the GC can refer to them unconditionally. Eventually we'll know what we want and probably have just one 'prefetch' with an appropriate meaning on each architecture. LGTM=rlh R=rlh CC=golang-codereviews https://golang.org/cl/179160043
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/asm_386.s20
-rw-r--r--src/runtime/asm_amd64.s20
-rw-r--r--src/runtime/asm_amd64p32.s21
-rw-r--r--src/runtime/asm_arm.s12
-rw-r--r--src/runtime/asm_power64x.s12
-rw-r--r--src/runtime/runtime1.go5
-rw-r--r--src/runtime/stubs.go5
7 files changed, 94 insertions, 1 deletions
diff --git a/src/runtime/asm_386.s b/src/runtime/asm_386.s
index a02bb5556f..7cc64a3a49 100644
--- a/src/runtime/asm_386.s
+++ b/src/runtime/asm_386.s
@@ -2285,3 +2285,23 @@ TEXT runtime·getg(SB),NOSPLIT,$0-4
MOVL AX, ret+0(FP)
RET
+TEXT runtime·prefetcht0(SB),NOSPLIT,$0-4
+ MOVL addr+0(FP), AX
+ PREFETCHT0 (AX)
+ RET
+
+TEXT runtime·prefetcht1(SB),NOSPLIT,$0-4
+ MOVL addr+0(FP), AX
+ PREFETCHT1 (AX)
+ RET
+
+
+TEXT runtime·prefetcht2(SB),NOSPLIT,$0-4
+ MOVL addr+0(FP), AX
+ PREFETCHT2 (AX)
+ RET
+
+TEXT runtime·prefetchnta(SB),NOSPLIT,$0-4
+ MOVL addr+0(FP), AX
+ PREFETCHNTA (AX)
+ RET
diff --git a/src/runtime/asm_amd64.s b/src/runtime/asm_amd64.s
index 6e3f5ff6ca..14be2fe92d 100644
--- a/src/runtime/asm_amd64.s
+++ b/src/runtime/asm_amd64.s
@@ -2228,3 +2228,23 @@ TEXT runtime·getg(SB),NOSPLIT,$0-8
MOVQ g(CX), AX
MOVQ AX, ret+0(FP)
RET
+
+TEXT runtime·prefetcht0(SB),NOSPLIT,$0-8
+ MOVQ addr+0(FP), AX
+ PREFETCHT0 (AX)
+ RET
+
+TEXT runtime·prefetcht1(SB),NOSPLIT,$0-8
+ MOVQ addr+0(FP), AX
+ PREFETCHT1 (AX)
+ RET
+
+TEXT runtime·prefetcht2(SB),NOSPLIT,$0-8
+ MOVQ addr+0(FP), AX
+ PREFETCHT2 (AX)
+ RET
+
+TEXT runtime·prefetchnta(SB),NOSPLIT,$0-8
+ MOVQ addr+0(FP), AX
+ PREFETCHNTA (AX)
+ RET
diff --git a/src/runtime/asm_amd64p32.s b/src/runtime/asm_amd64p32.s
index cead3cd075..60c438c1d8 100644
--- a/src/runtime/asm_amd64p32.s
+++ b/src/runtime/asm_amd64p32.s
@@ -1079,3 +1079,24 @@ TEXT runtime·getg(SB),NOSPLIT,$0-4
MOVL g(CX), AX
MOVL AX, ret+0(FP)
RET
+
+TEXT runtime·prefetcht0(SB),NOSPLIT,$0-4
+ MOVL addr+0(FP), AX
+ PREFETCHT0 (AX)
+ RET
+
+TEXT runtime·prefetcht1(SB),NOSPLIT,$0-4
+ MOVL addr+0(FP), AX
+ PREFETCHT1 (AX)
+ RET
+
+
+TEXT runtime·prefetcht2(SB),NOSPLIT,$0-4
+ MOVL addr+0(FP), AX
+ PREFETCHT2 (AX)
+ RET
+
+TEXT runtime·prefetchnta(SB),NOSPLIT,$0-4
+ MOVL addr+0(FP), AX
+ PREFETCHNTA (AX)
+ RET
diff --git a/src/runtime/asm_arm.s b/src/runtime/asm_arm.s
index 583c7ba501..c6c98b4439 100644
--- a/src/runtime/asm_arm.s
+++ b/src/runtime/asm_arm.s
@@ -1320,3 +1320,15 @@ TEXT runtime·goexit(SB),NOSPLIT,$-4-0
TEXT runtime·getg(SB),NOSPLIT,$-4-4
MOVW g, ret+0(FP)
RET
+
+TEXT runtime·prefetcht0(SB),NOSPLIT,$0-4
+ RET
+
+TEXT runtime·prefetcht1(SB),NOSPLIT,$0-4
+ RET
+
+TEXT runtime·prefetcht2(SB),NOSPLIT,$0-4
+ RET
+
+TEXT runtime·prefetchnta(SB),NOSPLIT,$0-4
+ RET
diff --git a/src/runtime/asm_power64x.s b/src/runtime/asm_power64x.s
index ba900c2b3f..6169202ea6 100644
--- a/src/runtime/asm_power64x.s
+++ b/src/runtime/asm_power64x.s
@@ -986,3 +986,15 @@ TEXT _cgo_topofstack(SB),NOSPLIT,$0
TEXT runtime·goexit(SB),NOSPLIT,$-8-0
MOVD R0, R0 // NOP
BL runtime·goexit1(SB) // does not return
+
+TEXT runtime·prefetcht0(SB),NOSPLIT,$0-8
+ RETURN
+
+TEXT runtime·prefetcht1(SB),NOSPLIT,$0-8
+ RETURN
+
+TEXT runtime·prefetcht2(SB),NOSPLIT,$0-8
+ RETURN
+
+TEXT runtime·prefetchnta(SB),NOSPLIT,$0-8
+ RETURN
diff --git a/src/runtime/runtime1.go b/src/runtime/runtime1.go
index 15dea01a3c..9e19b68bee 100644
--- a/src/runtime/runtime1.go
+++ b/src/runtime/runtime1.go
@@ -97,7 +97,10 @@ func testAtomic64() {
z64 = 42
x64 = 0
- // TODO: PREFETCH((unsafe.Pointer)(&z64))
+ prefetcht0(uintptr(unsafe.Pointer(&z64)))
+ prefetcht1(uintptr(unsafe.Pointer(&z64)))
+ prefetcht2(uintptr(unsafe.Pointer(&z64)))
+ prefetchnta(uintptr(unsafe.Pointer(&z64)))
if cas64(&z64, x64, 1) {
gothrow("cas64 failed")
}
diff --git a/src/runtime/stubs.go b/src/runtime/stubs.go
index 217307a1ed..4063e5434b 100644
--- a/src/runtime/stubs.go
+++ b/src/runtime/stubs.go
@@ -231,3 +231,8 @@ func call536870912(fn, arg unsafe.Pointer, n, retoffset uint32)
func call1073741824(fn, arg unsafe.Pointer, n, retoffset uint32)
func systemstack_switch()
+
+func prefetcht0(addr uintptr)
+func prefetcht1(addr uintptr)
+func prefetcht2(addr uintptr)
+func prefetchnta(addr uintptr)