Skip to content

Commit 7045e6f

Browse files
committed
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 <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Austin Clements <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]>
1 parent fd29d03 commit 7045e6f

File tree

12 files changed

+0
-141
lines changed

12 files changed

+0
-141
lines changed

src/runtime/asm_386.s

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1637,19 +1637,6 @@ TEXT runtime·goexit(SB),NOSPLIT,$0-0
16371637
// traceback from goexit1 must hit code range of goexit
16381638
BYTE $0x90 // NOP
16391639

1640-
// Prefetching doesn't seem to help.
1641-
TEXT runtime·prefetcht0(SB),NOSPLIT,$0-4
1642-
RET
1643-
1644-
TEXT runtime·prefetcht1(SB),NOSPLIT,$0-4
1645-
RET
1646-
1647-
TEXT runtime·prefetcht2(SB),NOSPLIT,$0-4
1648-
RET
1649-
1650-
TEXT runtime·prefetchnta(SB),NOSPLIT,$0-4
1651-
RET
1652-
16531640
// Add a module's moduledata to the linked list of moduledata objects. This
16541641
// is called from .init_array by a function generated in the linker and so
16551642
// follows the platform ABI wrt register preservation -- it only touches AX,

src/runtime/asm_amd64.s

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2339,26 +2339,6 @@ TEXT runtime·goexit(SB),NOSPLIT,$0-0
23392339
// traceback from goexit1 must hit code range of goexit
23402340
BYTE $0x90 // NOP
23412341

2342-
TEXT runtime·prefetcht0(SB),NOSPLIT,$0-8
2343-
MOVQ addr+0(FP), AX
2344-
PREFETCHT0 (AX)
2345-
RET
2346-
2347-
TEXT runtime·prefetcht1(SB),NOSPLIT,$0-8
2348-
MOVQ addr+0(FP), AX
2349-
PREFETCHT1 (AX)
2350-
RET
2351-
2352-
TEXT runtime·prefetcht2(SB),NOSPLIT,$0-8
2353-
MOVQ addr+0(FP), AX
2354-
PREFETCHT2 (AX)
2355-
RET
2356-
2357-
TEXT runtime·prefetchnta(SB),NOSPLIT,$0-8
2358-
MOVQ addr+0(FP), AX
2359-
PREFETCHNTA (AX)
2360-
RET
2361-
23622342
// This is called from .init_array and follows the platform, not Go, ABI.
23632343
TEXT runtime·addmoduledata(SB),NOSPLIT,$0-0
23642344
PUSHQ R15 // The access to global variables below implicitly uses R15, which is callee-save

src/runtime/asm_amd64p32.s

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,27 +1042,6 @@ TEXT runtime·goexit(SB),NOSPLIT,$0-0
10421042
// traceback from goexit1 must hit code range of goexit
10431043
BYTE $0x90 // NOP
10441044

1045-
TEXT runtime·prefetcht0(SB),NOSPLIT,$0-4
1046-
MOVL addr+0(FP), AX
1047-
PREFETCHT0 (AX)
1048-
RET
1049-
1050-
TEXT runtime·prefetcht1(SB),NOSPLIT,$0-4
1051-
MOVL addr+0(FP), AX
1052-
PREFETCHT1 (AX)
1053-
RET
1054-
1055-
1056-
TEXT runtime·prefetcht2(SB),NOSPLIT,$0-4
1057-
MOVL addr+0(FP), AX
1058-
PREFETCHT2 (AX)
1059-
RET
1060-
1061-
TEXT runtime·prefetchnta(SB),NOSPLIT,$0-4
1062-
MOVL addr+0(FP), AX
1063-
PREFETCHNTA (AX)
1064-
RET
1065-
10661045
TEXT ·checkASM(SB),NOSPLIT,$0-1
10671046
MOVB $1, ret+0(FP)
10681047
RET

src/runtime/asm_arm.s

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -973,18 +973,6 @@ TEXT runtime·goexit(SB),NOSPLIT,$-4-0
973973
// traceback from goexit1 must hit code range of goexit
974974
MOVW R0, R0 // NOP
975975

976-
TEXT runtime·prefetcht0(SB),NOSPLIT,$0-4
977-
RET
978-
979-
TEXT runtime·prefetcht1(SB),NOSPLIT,$0-4
980-
RET
981-
982-
TEXT runtime·prefetcht2(SB),NOSPLIT,$0-4
983-
RET
984-
985-
TEXT runtime·prefetchnta(SB),NOSPLIT,$0-4
986-
RET
987-
988976
// x -> x/1000000, x%1000000, called from Go with args, results on stack.
989977
TEXT runtime·usplit(SB),NOSPLIT,$0-12
990978
MOVW x+0(FP), R0

src/runtime/asm_arm64.s

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -931,19 +931,6 @@ TEXT runtime·goexit(SB),NOSPLIT,$-8-0
931931
MOVD R0, R0 // NOP
932932
BL runtime·goexit1(SB) // does not return
933933

934-
// TODO(aram): use PRFM here.
935-
TEXT runtime·prefetcht0(SB),NOSPLIT,$0-8
936-
RET
937-
938-
TEXT runtime·prefetcht1(SB),NOSPLIT,$0-8
939-
RET
940-
941-
TEXT runtime·prefetcht2(SB),NOSPLIT,$0-8
942-
RET
943-
944-
TEXT runtime·prefetchnta(SB),NOSPLIT,$0-8
945-
RET
946-
947934
TEXT runtime·sigreturn(SB),NOSPLIT,$0-0
948935
RET
949936

src/runtime/asm_mips64x.s

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -823,18 +823,6 @@ TEXT runtime·goexit(SB),NOSPLIT,$-8-0
823823
// traceback from goexit1 must hit code range of goexit
824824
NOR R0, R0 // NOP
825825

826-
TEXT runtime·prefetcht0(SB),NOSPLIT,$0-8
827-
RET
828-
829-
TEXT runtime·prefetcht1(SB),NOSPLIT,$0-8
830-
RET
831-
832-
TEXT runtime·prefetcht2(SB),NOSPLIT,$0-8
833-
RET
834-
835-
TEXT runtime·prefetchnta(SB),NOSPLIT,$0-8
836-
RET
837-
838826
TEXT ·checkASM(SB),NOSPLIT,$0-1
839827
MOVW $1, R1
840828
MOVB R1, ret+0(FP)

src/runtime/asm_mipsx.s

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -903,18 +903,6 @@ TEXT runtime·goexit(SB),NOSPLIT,$-4-0
903903
// traceback from goexit1 must hit code range of goexit
904904
NOR R0, R0 // NOP
905905

906-
TEXT runtime·prefetcht0(SB),NOSPLIT,$0-4
907-
RET
908-
909-
TEXT runtime·prefetcht1(SB),NOSPLIT,$0-4
910-
RET
911-
912-
TEXT runtime·prefetcht2(SB),NOSPLIT,$0-4
913-
RET
914-
915-
TEXT runtime·prefetchnta(SB),NOSPLIT,$0-4
916-
RET
917-
918906
TEXT ·checkASM(SB),NOSPLIT,$0-1
919907
MOVW $1, R1
920908
MOVB R1, ret+0(FP)

src/runtime/asm_ppc64x.s

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,18 +1353,6 @@ TEXT runtime·goexit(SB),NOSPLIT|NOFRAME,$0-0
13531353
// traceback from goexit1 must hit code range of goexit
13541354
MOVD R0, R0 // NOP
13551355

1356-
TEXT runtime·prefetcht0(SB),NOSPLIT,$0-8
1357-
RET
1358-
1359-
TEXT runtime·prefetcht1(SB),NOSPLIT,$0-8
1360-
RET
1361-
1362-
TEXT runtime·prefetcht2(SB),NOSPLIT,$0-8
1363-
RET
1364-
1365-
TEXT runtime·prefetchnta(SB),NOSPLIT,$0-8
1366-
RET
1367-
13681356
TEXT runtime·sigreturn(SB),NOSPLIT,$0-0
13691357
RET
13701358

src/runtime/asm_s390x.s

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -949,18 +949,6 @@ TEXT runtime·goexit(SB),NOSPLIT|NOFRAME,$0-0
949949
// traceback from goexit1 must hit code range of goexit
950950
BYTE $0x07; BYTE $0x00; // 2-byte nop
951951

952-
TEXT runtime·prefetcht0(SB),NOSPLIT,$0-8
953-
RET
954-
955-
TEXT runtime·prefetcht1(SB),NOSPLIT,$0-8
956-
RET
957-
958-
TEXT runtime·prefetcht2(SB),NOSPLIT,$0-8
959-
RET
960-
961-
TEXT runtime·prefetchnta(SB),NOSPLIT,$0-8
962-
RET
963-
964952
TEXT runtime·sigreturn(SB),NOSPLIT,$0-0
965953
RET
966954

src/runtime/mbitmap.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -449,11 +449,6 @@ func heapBitsForObject(p, refBase, refOff uintptr) (base uintptr, hbits heapBits
449449
return
450450
}
451451

452-
// prefetch the bits.
453-
func (h heapBits) prefetch() {
454-
prefetchnta(uintptr(unsafe.Pointer((h.bitp))))
455-
}
456-
457452
// next returns the heapBits describing the next pointer-sized word in memory.
458453
// That is, if h describes address p, h.next() describes p+ptrSize.
459454
// Note that next does not modify h. The caller must record the result.

src/runtime/runtime1.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,6 @@ var test_z64, test_x64 uint64
9999
func testAtomic64() {
100100
test_z64 = 42
101101
test_x64 = 0
102-
prefetcht0(uintptr(unsafe.Pointer(&test_z64)))
103-
prefetcht1(uintptr(unsafe.Pointer(&test_z64)))
104-
prefetcht2(uintptr(unsafe.Pointer(&test_z64)))
105-
prefetchnta(uintptr(unsafe.Pointer(&test_z64)))
106102
if atomic.Cas64(&test_z64, test_x64, 1) {
107103
throw("cas64 failed")
108104
}

src/runtime/stubs.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -276,11 +276,6 @@ func call1073741824(typ, fn, arg unsafe.Pointer, n, retoffset uint32)
276276

277277
func systemstack_switch()
278278

279-
func prefetcht0(addr uintptr)
280-
func prefetcht1(addr uintptr)
281-
func prefetcht2(addr uintptr)
282-
func prefetchnta(addr uintptr)
283-
284279
// round n up to a multiple of a. a must be a power of 2.
285280
func round(n, a uintptr) uintptr {
286281
return (n + a - 1) &^ (a - 1)

0 commit comments

Comments
 (0)