Commit 7045e6f6 authored by Martin Möhrmann's avatar Martin Möhrmann

runtime: remove unused prefetch functions

The only non test user of the assembler prefetch functions is the
heapBits.prefetch function which is itself unused.

The runtime prefetch functions have no functionality on most platforms
and are not inlineable since they are written in assembler. The function
call overhead eliminates the performance gains that could be achieved with
prefetching and would degrade performance for platforms where the functions
are no-ops.

If prefetch functions are needed back again later they can be improved
by avoiding the function call overhead and implementing them as intrinsics.

Change-Id: I52c553cf3607ffe09f0441c6e7a0a818cb21117d
Reviewed-on: https://go-review.googlesource.com/44370
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarAustin Clements <austin@google.com>
Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
parent fd29d03f
......@@ -1637,19 +1637,6 @@ TEXT runtime·goexit(SB),NOSPLIT,$0-0
// traceback from goexit1 must hit code range of goexit
BYTE $0x90 // NOP
// Prefetching doesn't seem to help.
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
// Add a module's moduledata to the linked list of moduledata objects. This
// is called from .init_array by a function generated in the linker and so
// follows the platform ABI wrt register preservation -- it only touches AX,
......
......@@ -2339,26 +2339,6 @@ TEXT runtime·goexit(SB),NOSPLIT,$0-0
// traceback from goexit1 must hit code range of goexit
BYTE $0x90 // NOP
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
// This is called from .init_array and follows the platform, not Go, ABI.
TEXT runtime·addmoduledata(SB),NOSPLIT,$0-0
PUSHQ R15 // The access to global variables below implicitly uses R15, which is callee-save
......
......@@ -1042,27 +1042,6 @@ TEXT runtime·goexit(SB),NOSPLIT,$0-0
// traceback from goexit1 must hit code range of goexit
BYTE $0x90 // NOP
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
TEXT ·checkASM(SB),NOSPLIT,$0-1
MOVB $1, ret+0(FP)
RET
......@@ -973,18 +973,6 @@ TEXT runtime·goexit(SB),NOSPLIT,$-4-0
// traceback from goexit1 must hit code range of goexit
MOVW R0, R0 // NOP
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
// x -> x/1000000, x%1000000, called from Go with args, results on stack.
TEXT runtime·usplit(SB),NOSPLIT,$0-12
MOVW x+0(FP), R0
......
......@@ -931,19 +931,6 @@ TEXT runtime·goexit(SB),NOSPLIT,$-8-0
MOVD R0, R0 // NOP
BL runtime·goexit1(SB) // does not return
// TODO(aram): use PRFM here.
TEXT runtime·prefetcht0(SB),NOSPLIT,$0-8
RET
TEXT runtime·prefetcht1(SB),NOSPLIT,$0-8
RET
TEXT runtime·prefetcht2(SB),NOSPLIT,$0-8
RET
TEXT runtime·prefetchnta(SB),NOSPLIT,$0-8
RET
TEXT runtime·sigreturn(SB),NOSPLIT,$0-0
RET
......
......@@ -823,18 +823,6 @@ TEXT runtime·goexit(SB),NOSPLIT,$-8-0
// traceback from goexit1 must hit code range of goexit
NOR R0, R0 // NOP
TEXT runtime·prefetcht0(SB),NOSPLIT,$0-8
RET
TEXT runtime·prefetcht1(SB),NOSPLIT,$0-8
RET
TEXT runtime·prefetcht2(SB),NOSPLIT,$0-8
RET
TEXT runtime·prefetchnta(SB),NOSPLIT,$0-8
RET
TEXT ·checkASM(SB),NOSPLIT,$0-1
MOVW $1, R1
MOVB R1, ret+0(FP)
......
......@@ -903,18 +903,6 @@ TEXT runtime·goexit(SB),NOSPLIT,$-4-0
// traceback from goexit1 must hit code range of goexit
NOR R0, R0 // NOP
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
TEXT ·checkASM(SB),NOSPLIT,$0-1
MOVW $1, R1
MOVB R1, ret+0(FP)
......
......@@ -1353,18 +1353,6 @@ TEXT runtime·goexit(SB),NOSPLIT|NOFRAME,$0-0
// traceback from goexit1 must hit code range of goexit
MOVD R0, R0 // NOP
TEXT runtime·prefetcht0(SB),NOSPLIT,$0-8
RET
TEXT runtime·prefetcht1(SB),NOSPLIT,$0-8
RET
TEXT runtime·prefetcht2(SB),NOSPLIT,$0-8
RET
TEXT runtime·prefetchnta(SB),NOSPLIT,$0-8
RET
TEXT runtime·sigreturn(SB),NOSPLIT,$0-0
RET
......
......@@ -949,18 +949,6 @@ TEXT runtime·goexit(SB),NOSPLIT|NOFRAME,$0-0
// traceback from goexit1 must hit code range of goexit
BYTE $0x07; BYTE $0x00; // 2-byte nop
TEXT runtime·prefetcht0(SB),NOSPLIT,$0-8
RET
TEXT runtime·prefetcht1(SB),NOSPLIT,$0-8
RET
TEXT runtime·prefetcht2(SB),NOSPLIT,$0-8
RET
TEXT runtime·prefetchnta(SB),NOSPLIT,$0-8
RET
TEXT runtime·sigreturn(SB),NOSPLIT,$0-0
RET
......
......@@ -449,11 +449,6 @@ func heapBitsForObject(p, refBase, refOff uintptr) (base uintptr, hbits heapBits
return
}
// prefetch the bits.
func (h heapBits) prefetch() {
prefetchnta(uintptr(unsafe.Pointer((h.bitp))))
}
// next returns the heapBits describing the next pointer-sized word in memory.
// That is, if h describes address p, h.next() describes p+ptrSize.
// Note that next does not modify h. The caller must record the result.
......
......@@ -99,10 +99,6 @@ var test_z64, test_x64 uint64
func testAtomic64() {
test_z64 = 42
test_x64 = 0
prefetcht0(uintptr(unsafe.Pointer(&test_z64)))
prefetcht1(uintptr(unsafe.Pointer(&test_z64)))
prefetcht2(uintptr(unsafe.Pointer(&test_z64)))
prefetchnta(uintptr(unsafe.Pointer(&test_z64)))
if atomic.Cas64(&test_z64, test_x64, 1) {
throw("cas64 failed")
}
......
......@@ -276,11 +276,6 @@ func call1073741824(typ, 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)
// round n up to a multiple of a. a must be a power of 2.
func round(n, a uintptr) uintptr {
return (n + a - 1) &^ (a - 1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment