Skip to content

Commit 229aaac

Browse files
committed
runtime: remove getcallerpc argument
Now that getcallerpc is a compiler intrinsic on x86 and non-x86 platforms don't need the argument, we can drop it. Sadly, this doesn't let us remove any dummy arguments since all of those cases also use getcallersp, which still takes the argument pointer, but this is at least an improvement. Change-Id: I9c34a41cf2c18cba57f59938390bf9491efb22d2 Reviewed-on: https://go-review.googlesource.com/65474 Run-TryBot: Austin Clements <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: David Chase <[email protected]>
1 parent 8cb2952 commit 229aaac

20 files changed

+85
-85
lines changed

src/runtime/asm_arm.s

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -677,9 +677,9 @@ TEXT setg<>(SB),NOSPLIT,$-4-0
677677
MOVW g, R0
678678
RET
679679

680-
TEXT runtime·getcallerpc(SB),NOSPLIT,$4-8
681-
MOVW 8(R13), R0 // LR saved by caller
682-
MOVW R0, ret+4(FP)
680+
TEXT runtime·getcallerpc(SB),NOSPLIT,$-4-4
681+
MOVW 0(R13), R0 // LR saved by caller
682+
MOVW R0, ret+0(FP)
683683
RET
684684

685685
TEXT runtime·emptyfunc(SB),0,$0-0

src/runtime/asm_arm64.s

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -704,9 +704,9 @@ TEXT setg_gcc<>(SB),NOSPLIT,$8
704704
MOVD savedR27-8(SP), R27
705705
RET
706706

707-
TEXT runtime·getcallerpc(SB),NOSPLIT,$8-16
708-
MOVD 16(RSP), R0 // LR saved by caller
709-
MOVD R0, ret+8(FP)
707+
TEXT runtime·getcallerpc(SB),NOSPLIT,$-8-8
708+
MOVD 0(RSP), R0 // LR saved by caller
709+
MOVD R0, ret+0(FP)
710710
RET
711711

712712
TEXT runtime·abort(SB),NOSPLIT,$-8-0

src/runtime/asm_mips64x.s

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -616,9 +616,9 @@ TEXT setg_gcc<>(SB),NOSPLIT,$0-0
616616
JAL runtime·save_g(SB)
617617
RET
618618

619-
TEXT runtime·getcallerpc(SB),NOSPLIT,$8-16
620-
MOVV 16(R29), R1 // LR saved by caller
621-
MOVV R1, ret+8(FP)
619+
TEXT runtime·getcallerpc(SB),NOSPLIT,$-8-8
620+
MOVV 0(R29), R1 // LR saved by caller
621+
MOVV R1, ret+0(FP)
622622
RET
623623

624624
TEXT runtime·abort(SB),NOSPLIT,$-8-0

src/runtime/asm_mipsx.s

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -619,9 +619,9 @@ TEXT setg_gcc<>(SB),NOSPLIT,$0
619619
JAL runtime·save_g(SB)
620620
RET
621621

622-
TEXT runtime·getcallerpc(SB),NOSPLIT,$4-8
623-
MOVW 8(R29), R1 // LR saved by caller
624-
MOVW R1, ret+4(FP)
622+
TEXT runtime·getcallerpc(SB),NOSPLIT,$-4-4
623+
MOVW 0(R29), R1 // LR saved by caller
624+
MOVW R1, ret+0(FP)
625625
RET
626626

627627
TEXT runtime·abort(SB),NOSPLIT,$0-0

src/runtime/asm_ppc64x.s

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -714,9 +714,9 @@ TEXT setg_gcc<>(SB),NOSPLIT|NOFRAME,$0-0
714714
MOVD R4, LR
715715
RET
716716

717-
TEXT runtime·getcallerpc(SB),NOSPLIT,$8-16
718-
MOVD FIXED_FRAME+8(R1), R3 // LR saved by caller
719-
MOVD R3, ret+8(FP)
717+
TEXT runtime·getcallerpc(SB),NOSPLIT|NOFRAME,$0-8
718+
MOVD 0(R1), R3 // LR saved by caller
719+
MOVD R3, ret+0(FP)
720720
RET
721721

722722
TEXT runtime·abort(SB),NOSPLIT|NOFRAME,$0-0

src/runtime/asm_s390x.s

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -656,9 +656,9 @@ TEXT setg_gcc<>(SB),NOSPLIT|NOFRAME,$0-0
656656
MOVD R1, LR
657657
RET
658658

659-
TEXT runtime·getcallerpc(SB),NOSPLIT,$8-16
660-
MOVD 16(R15), R3 // LR saved by caller
661-
MOVD R3, ret+8(FP)
659+
TEXT runtime·getcallerpc(SB),NOSPLIT|NOFRAME,$0-8
660+
MOVD 0(R15), R3 // LR saved by caller
661+
MOVD R3, ret+0(FP)
662662
RET
663663

664664
TEXT runtime·abort(SB),NOSPLIT|NOFRAME,$0-0

src/runtime/chan.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ func chanbuf(c *hchan, i uint) unsafe.Pointer {
122122
// entry point for c <- x from compiled code
123123
//go:nosplit
124124
func chansend1(c *hchan, elem unsafe.Pointer) {
125-
chansend(c, elem, true, getcallerpc(unsafe.Pointer(&c)))
125+
chansend(c, elem, true, getcallerpc())
126126
}
127127

128128
/*
@@ -334,7 +334,7 @@ func closechan(c *hchan) {
334334
}
335335

336336
if raceenabled {
337-
callerpc := getcallerpc(unsafe.Pointer(&c))
337+
callerpc := getcallerpc()
338338
racewritepc(unsafe.Pointer(c), callerpc, funcPC(closechan))
339339
racerelease(unsafe.Pointer(c))
340340
}
@@ -606,7 +606,7 @@ func recv(c *hchan, sg *sudog, ep unsafe.Pointer, unlockf func(), skip int) {
606606
// }
607607
//
608608
func selectnbsend(c *hchan, elem unsafe.Pointer) (selected bool) {
609-
return chansend(c, elem, false, getcallerpc(unsafe.Pointer(&c)))
609+
return chansend(c, elem, false, getcallerpc())
610610
}
611611

612612
// compiler implements
@@ -656,7 +656,7 @@ func selectnbrecv2(elem unsafe.Pointer, received *bool, c *hchan) (selected bool
656656

657657
//go:linkname reflect_chansend reflect.chansend
658658
func reflect_chansend(c *hchan, elem unsafe.Pointer, nb bool) (selected bool) {
659-
return chansend(c, elem, !nb, getcallerpc(unsafe.Pointer(&c)))
659+
return chansend(c, elem, !nb, getcallerpc())
660660
}
661661

662662
//go:linkname reflect_chanrecv reflect.chanrecv

src/runtime/hashmap.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ func makemap(t *maptype, hint int, h *hmap) *hmap {
333333
// hold onto it for very long.
334334
func mapaccess1(t *maptype, h *hmap, key unsafe.Pointer) unsafe.Pointer {
335335
if raceenabled && h != nil {
336-
callerpc := getcallerpc(unsafe.Pointer(&t))
336+
callerpc := getcallerpc()
337337
pc := funcPC(mapaccess1)
338338
racereadpc(unsafe.Pointer(h), callerpc, pc)
339339
raceReadObjectPC(t.key, key, callerpc, pc)
@@ -385,7 +385,7 @@ func mapaccess1(t *maptype, h *hmap, key unsafe.Pointer) unsafe.Pointer {
385385

386386
func mapaccess2(t *maptype, h *hmap, key unsafe.Pointer) (unsafe.Pointer, bool) {
387387
if raceenabled && h != nil {
388-
callerpc := getcallerpc(unsafe.Pointer(&t))
388+
callerpc := getcallerpc()
389389
pc := funcPC(mapaccess2)
390390
racereadpc(unsafe.Pointer(h), callerpc, pc)
391391
raceReadObjectPC(t.key, key, callerpc, pc)
@@ -498,7 +498,7 @@ func mapassign(t *maptype, h *hmap, key unsafe.Pointer) unsafe.Pointer {
498498
panic(plainError("assignment to entry in nil map"))
499499
}
500500
if raceenabled {
501-
callerpc := getcallerpc(unsafe.Pointer(&t))
501+
callerpc := getcallerpc()
502502
pc := funcPC(mapassign)
503503
racewritepc(unsafe.Pointer(h), callerpc, pc)
504504
raceReadObjectPC(t.key, key, callerpc, pc)
@@ -606,7 +606,7 @@ done:
606606

607607
func mapdelete(t *maptype, h *hmap, key unsafe.Pointer) {
608608
if raceenabled && h != nil {
609-
callerpc := getcallerpc(unsafe.Pointer(&t))
609+
callerpc := getcallerpc()
610610
pc := funcPC(mapdelete)
611611
racewritepc(unsafe.Pointer(h), callerpc, pc)
612612
raceReadObjectPC(t.key, key, callerpc, pc)
@@ -681,7 +681,7 @@ search:
681681
// Both need to have zeroed hiter since the struct contains pointers.
682682
func mapiterinit(t *maptype, h *hmap, it *hiter) {
683683
if raceenabled && h != nil {
684-
callerpc := getcallerpc(unsafe.Pointer(&t))
684+
callerpc := getcallerpc()
685685
racereadpc(unsafe.Pointer(h), callerpc, funcPC(mapiterinit))
686686
}
687687

@@ -731,7 +731,7 @@ func mapiterinit(t *maptype, h *hmap, it *hiter) {
731731
func mapiternext(it *hiter) {
732732
h := it.h
733733
if raceenabled {
734-
callerpc := getcallerpc(unsafe.Pointer(&it))
734+
callerpc := getcallerpc()
735735
racereadpc(unsafe.Pointer(h), callerpc, funcPC(mapiternext))
736736
}
737737
if h.flags&hashWriting != 0 {
@@ -1225,7 +1225,7 @@ func reflect_maplen(h *hmap) int {
12251225
return 0
12261226
}
12271227
if raceenabled {
1228-
callerpc := getcallerpc(unsafe.Pointer(&h))
1228+
callerpc := getcallerpc()
12291229
racereadpc(unsafe.Pointer(h), callerpc, funcPC(reflect_maplen))
12301230
}
12311231
return h.count

src/runtime/hashmap_fast.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111

1212
func mapaccess1_fast32(t *maptype, h *hmap, key uint32) unsafe.Pointer {
1313
if raceenabled && h != nil {
14-
callerpc := getcallerpc(unsafe.Pointer(&t))
14+
callerpc := getcallerpc()
1515
racereadpc(unsafe.Pointer(h), callerpc, funcPC(mapaccess1_fast32))
1616
}
1717
if h == nil || h.count == 0 {
@@ -51,7 +51,7 @@ func mapaccess1_fast32(t *maptype, h *hmap, key uint32) unsafe.Pointer {
5151

5252
func mapaccess2_fast32(t *maptype, h *hmap, key uint32) (unsafe.Pointer, bool) {
5353
if raceenabled && h != nil {
54-
callerpc := getcallerpc(unsafe.Pointer(&t))
54+
callerpc := getcallerpc()
5555
racereadpc(unsafe.Pointer(h), callerpc, funcPC(mapaccess2_fast32))
5656
}
5757
if h == nil || h.count == 0 {
@@ -91,7 +91,7 @@ func mapaccess2_fast32(t *maptype, h *hmap, key uint32) (unsafe.Pointer, bool) {
9191

9292
func mapaccess1_fast64(t *maptype, h *hmap, key uint64) unsafe.Pointer {
9393
if raceenabled && h != nil {
94-
callerpc := getcallerpc(unsafe.Pointer(&t))
94+
callerpc := getcallerpc()
9595
racereadpc(unsafe.Pointer(h), callerpc, funcPC(mapaccess1_fast64))
9696
}
9797
if h == nil || h.count == 0 {
@@ -131,7 +131,7 @@ func mapaccess1_fast64(t *maptype, h *hmap, key uint64) unsafe.Pointer {
131131

132132
func mapaccess2_fast64(t *maptype, h *hmap, key uint64) (unsafe.Pointer, bool) {
133133
if raceenabled && h != nil {
134-
callerpc := getcallerpc(unsafe.Pointer(&t))
134+
callerpc := getcallerpc()
135135
racereadpc(unsafe.Pointer(h), callerpc, funcPC(mapaccess2_fast64))
136136
}
137137
if h == nil || h.count == 0 {
@@ -171,7 +171,7 @@ func mapaccess2_fast64(t *maptype, h *hmap, key uint64) (unsafe.Pointer, bool) {
171171

172172
func mapaccess1_faststr(t *maptype, h *hmap, ky string) unsafe.Pointer {
173173
if raceenabled && h != nil {
174-
callerpc := getcallerpc(unsafe.Pointer(&t))
174+
callerpc := getcallerpc()
175175
racereadpc(unsafe.Pointer(h), callerpc, funcPC(mapaccess1_faststr))
176176
}
177177
if h == nil || h.count == 0 {
@@ -260,7 +260,7 @@ dohash:
260260

261261
func mapaccess2_faststr(t *maptype, h *hmap, ky string) (unsafe.Pointer, bool) {
262262
if raceenabled && h != nil {
263-
callerpc := getcallerpc(unsafe.Pointer(&t))
263+
callerpc := getcallerpc()
264264
racereadpc(unsafe.Pointer(h), callerpc, funcPC(mapaccess2_faststr))
265265
}
266266
if h == nil || h.count == 0 {
@@ -352,7 +352,7 @@ func mapassign_fast32(t *maptype, h *hmap, key uint32) unsafe.Pointer {
352352
panic(plainError("assignment to entry in nil map"))
353353
}
354354
if raceenabled {
355-
callerpc := getcallerpc(unsafe.Pointer(&t))
355+
callerpc := getcallerpc()
356356
racewritepc(unsafe.Pointer(h), callerpc, funcPC(mapassign_fast32))
357357
}
358358
if h.flags&hashWriting != 0 {
@@ -441,7 +441,7 @@ func mapassign_fast64(t *maptype, h *hmap, key uint64) unsafe.Pointer {
441441
panic(plainError("assignment to entry in nil map"))
442442
}
443443
if raceenabled {
444-
callerpc := getcallerpc(unsafe.Pointer(&t))
444+
callerpc := getcallerpc()
445445
racewritepc(unsafe.Pointer(h), callerpc, funcPC(mapassign_fast64))
446446
}
447447
if h.flags&hashWriting != 0 {
@@ -536,7 +536,7 @@ func mapassign_faststr(t *maptype, h *hmap, ky string) unsafe.Pointer {
536536
panic(plainError("assignment to entry in nil map"))
537537
}
538538
if raceenabled {
539-
callerpc := getcallerpc(unsafe.Pointer(&t))
539+
callerpc := getcallerpc()
540540
racewritepc(unsafe.Pointer(h), callerpc, funcPC(mapassign_faststr))
541541
}
542542
if h.flags&hashWriting != 0 {
@@ -623,7 +623,7 @@ done:
623623

624624
func mapdelete_fast32(t *maptype, h *hmap, key uint32) {
625625
if raceenabled && h != nil {
626-
callerpc := getcallerpc(unsafe.Pointer(&t))
626+
callerpc := getcallerpc()
627627
racewritepc(unsafe.Pointer(h), callerpc, funcPC(mapdelete_fast32))
628628
}
629629
if h == nil || h.count == 0 {
@@ -672,7 +672,7 @@ search:
672672

673673
func mapdelete_fast64(t *maptype, h *hmap, key uint64) {
674674
if raceenabled && h != nil {
675-
callerpc := getcallerpc(unsafe.Pointer(&t))
675+
callerpc := getcallerpc()
676676
racewritepc(unsafe.Pointer(h), callerpc, funcPC(mapdelete_fast64))
677677
}
678678
if h == nil || h.count == 0 {
@@ -721,7 +721,7 @@ search:
721721

722722
func mapdelete_faststr(t *maptype, h *hmap, ky string) {
723723
if raceenabled && h != nil {
724-
callerpc := getcallerpc(unsafe.Pointer(&t))
724+
callerpc := getcallerpc()
725725
racewritepc(unsafe.Pointer(h), callerpc, funcPC(mapdelete_faststr))
726726
}
727727
if h == nil || h.count == 0 {

0 commit comments

Comments
 (0)