1
0
mirror of https://github.com/golang/go synced 2024-11-19 15:24:46 -07:00

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 <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
This commit is contained in:
Austin Clements 2017-09-22 15:16:26 -04:00
parent 8cb2952f2f
commit 229aaac19e
20 changed files with 85 additions and 85 deletions

View File

@ -677,9 +677,9 @@ TEXT setg<>(SB),NOSPLIT,$-4-0
MOVW g, R0 MOVW g, R0
RET RET
TEXT runtime·getcallerpc(SB),NOSPLIT,$4-8 TEXT runtime·getcallerpc(SB),NOSPLIT,$-4-4
MOVW 8(R13), R0 // LR saved by caller MOVW 0(R13), R0 // LR saved by caller
MOVW R0, ret+4(FP) MOVW R0, ret+0(FP)
RET RET
TEXT runtime·emptyfunc(SB),0,$0-0 TEXT runtime·emptyfunc(SB),0,$0-0

View File

@ -704,9 +704,9 @@ TEXT setg_gcc<>(SB),NOSPLIT,$8
MOVD savedR27-8(SP), R27 MOVD savedR27-8(SP), R27
RET RET
TEXT runtime·getcallerpc(SB),NOSPLIT,$8-16 TEXT runtime·getcallerpc(SB),NOSPLIT,$-8-8
MOVD 16(RSP), R0 // LR saved by caller MOVD 0(RSP), R0 // LR saved by caller
MOVD R0, ret+8(FP) MOVD R0, ret+0(FP)
RET RET
TEXT runtime·abort(SB),NOSPLIT,$-8-0 TEXT runtime·abort(SB),NOSPLIT,$-8-0

View File

@ -616,9 +616,9 @@ TEXT setg_gcc<>(SB),NOSPLIT,$0-0
JAL runtime·save_g(SB) JAL runtime·save_g(SB)
RET RET
TEXT runtime·getcallerpc(SB),NOSPLIT,$8-16 TEXT runtime·getcallerpc(SB),NOSPLIT,$-8-8
MOVV 16(R29), R1 // LR saved by caller MOVV 0(R29), R1 // LR saved by caller
MOVV R1, ret+8(FP) MOVV R1, ret+0(FP)
RET RET
TEXT runtime·abort(SB),NOSPLIT,$-8-0 TEXT runtime·abort(SB),NOSPLIT,$-8-0

View File

@ -619,9 +619,9 @@ TEXT setg_gcc<>(SB),NOSPLIT,$0
JAL runtime·save_g(SB) JAL runtime·save_g(SB)
RET RET
TEXT runtime·getcallerpc(SB),NOSPLIT,$4-8 TEXT runtime·getcallerpc(SB),NOSPLIT,$-4-4
MOVW 8(R29), R1 // LR saved by caller MOVW 0(R29), R1 // LR saved by caller
MOVW R1, ret+4(FP) MOVW R1, ret+0(FP)
RET RET
TEXT runtime·abort(SB),NOSPLIT,$0-0 TEXT runtime·abort(SB),NOSPLIT,$0-0

View File

@ -714,9 +714,9 @@ TEXT setg_gcc<>(SB),NOSPLIT|NOFRAME,$0-0
MOVD R4, LR MOVD R4, LR
RET RET
TEXT runtime·getcallerpc(SB),NOSPLIT,$8-16 TEXT runtime·getcallerpc(SB),NOSPLIT|NOFRAME,$0-8
MOVD FIXED_FRAME+8(R1), R3 // LR saved by caller MOVD 0(R1), R3 // LR saved by caller
MOVD R3, ret+8(FP) MOVD R3, ret+0(FP)
RET RET
TEXT runtime·abort(SB),NOSPLIT|NOFRAME,$0-0 TEXT runtime·abort(SB),NOSPLIT|NOFRAME,$0-0

View File

@ -656,9 +656,9 @@ TEXT setg_gcc<>(SB),NOSPLIT|NOFRAME,$0-0
MOVD R1, LR MOVD R1, LR
RET RET
TEXT runtime·getcallerpc(SB),NOSPLIT,$8-16 TEXT runtime·getcallerpc(SB),NOSPLIT|NOFRAME,$0-8
MOVD 16(R15), R3 // LR saved by caller MOVD 0(R15), R3 // LR saved by caller
MOVD R3, ret+8(FP) MOVD R3, ret+0(FP)
RET RET
TEXT runtime·abort(SB),NOSPLIT|NOFRAME,$0-0 TEXT runtime·abort(SB),NOSPLIT|NOFRAME,$0-0

View File

@ -122,7 +122,7 @@ func chanbuf(c *hchan, i uint) unsafe.Pointer {
// entry point for c <- x from compiled code // entry point for c <- x from compiled code
//go:nosplit //go:nosplit
func chansend1(c *hchan, elem unsafe.Pointer) { func chansend1(c *hchan, elem unsafe.Pointer) {
chansend(c, elem, true, getcallerpc(unsafe.Pointer(&c))) chansend(c, elem, true, getcallerpc())
} }
/* /*
@ -334,7 +334,7 @@ func closechan(c *hchan) {
} }
if raceenabled { if raceenabled {
callerpc := getcallerpc(unsafe.Pointer(&c)) callerpc := getcallerpc()
racewritepc(unsafe.Pointer(c), callerpc, funcPC(closechan)) racewritepc(unsafe.Pointer(c), callerpc, funcPC(closechan))
racerelease(unsafe.Pointer(c)) racerelease(unsafe.Pointer(c))
} }
@ -606,7 +606,7 @@ func recv(c *hchan, sg *sudog, ep unsafe.Pointer, unlockf func(), skip int) {
// } // }
// //
func selectnbsend(c *hchan, elem unsafe.Pointer) (selected bool) { func selectnbsend(c *hchan, elem unsafe.Pointer) (selected bool) {
return chansend(c, elem, false, getcallerpc(unsafe.Pointer(&c))) return chansend(c, elem, false, getcallerpc())
} }
// compiler implements // compiler implements
@ -656,7 +656,7 @@ func selectnbrecv2(elem unsafe.Pointer, received *bool, c *hchan) (selected bool
//go:linkname reflect_chansend reflect.chansend //go:linkname reflect_chansend reflect.chansend
func reflect_chansend(c *hchan, elem unsafe.Pointer, nb bool) (selected bool) { func reflect_chansend(c *hchan, elem unsafe.Pointer, nb bool) (selected bool) {
return chansend(c, elem, !nb, getcallerpc(unsafe.Pointer(&c))) return chansend(c, elem, !nb, getcallerpc())
} }
//go:linkname reflect_chanrecv reflect.chanrecv //go:linkname reflect_chanrecv reflect.chanrecv

View File

@ -333,7 +333,7 @@ func makemap(t *maptype, hint int, h *hmap) *hmap {
// hold onto it for very long. // hold onto it for very long.
func mapaccess1(t *maptype, h *hmap, key unsafe.Pointer) unsafe.Pointer { func mapaccess1(t *maptype, h *hmap, key unsafe.Pointer) unsafe.Pointer {
if raceenabled && h != nil { if raceenabled && h != nil {
callerpc := getcallerpc(unsafe.Pointer(&t)) callerpc := getcallerpc()
pc := funcPC(mapaccess1) pc := funcPC(mapaccess1)
racereadpc(unsafe.Pointer(h), callerpc, pc) racereadpc(unsafe.Pointer(h), callerpc, pc)
raceReadObjectPC(t.key, key, callerpc, pc) raceReadObjectPC(t.key, key, callerpc, pc)
@ -385,7 +385,7 @@ func mapaccess1(t *maptype, h *hmap, key unsafe.Pointer) unsafe.Pointer {
func mapaccess2(t *maptype, h *hmap, key unsafe.Pointer) (unsafe.Pointer, bool) { func mapaccess2(t *maptype, h *hmap, key unsafe.Pointer) (unsafe.Pointer, bool) {
if raceenabled && h != nil { if raceenabled && h != nil {
callerpc := getcallerpc(unsafe.Pointer(&t)) callerpc := getcallerpc()
pc := funcPC(mapaccess2) pc := funcPC(mapaccess2)
racereadpc(unsafe.Pointer(h), callerpc, pc) racereadpc(unsafe.Pointer(h), callerpc, pc)
raceReadObjectPC(t.key, key, callerpc, pc) raceReadObjectPC(t.key, key, callerpc, pc)
@ -498,7 +498,7 @@ func mapassign(t *maptype, h *hmap, key unsafe.Pointer) unsafe.Pointer {
panic(plainError("assignment to entry in nil map")) panic(plainError("assignment to entry in nil map"))
} }
if raceenabled { if raceenabled {
callerpc := getcallerpc(unsafe.Pointer(&t)) callerpc := getcallerpc()
pc := funcPC(mapassign) pc := funcPC(mapassign)
racewritepc(unsafe.Pointer(h), callerpc, pc) racewritepc(unsafe.Pointer(h), callerpc, pc)
raceReadObjectPC(t.key, key, callerpc, pc) raceReadObjectPC(t.key, key, callerpc, pc)
@ -606,7 +606,7 @@ done:
func mapdelete(t *maptype, h *hmap, key unsafe.Pointer) { func mapdelete(t *maptype, h *hmap, key unsafe.Pointer) {
if raceenabled && h != nil { if raceenabled && h != nil {
callerpc := getcallerpc(unsafe.Pointer(&t)) callerpc := getcallerpc()
pc := funcPC(mapdelete) pc := funcPC(mapdelete)
racewritepc(unsafe.Pointer(h), callerpc, pc) racewritepc(unsafe.Pointer(h), callerpc, pc)
raceReadObjectPC(t.key, key, callerpc, pc) raceReadObjectPC(t.key, key, callerpc, pc)
@ -681,7 +681,7 @@ search:
// Both need to have zeroed hiter since the struct contains pointers. // Both need to have zeroed hiter since the struct contains pointers.
func mapiterinit(t *maptype, h *hmap, it *hiter) { func mapiterinit(t *maptype, h *hmap, it *hiter) {
if raceenabled && h != nil { if raceenabled && h != nil {
callerpc := getcallerpc(unsafe.Pointer(&t)) callerpc := getcallerpc()
racereadpc(unsafe.Pointer(h), callerpc, funcPC(mapiterinit)) racereadpc(unsafe.Pointer(h), callerpc, funcPC(mapiterinit))
} }
@ -731,7 +731,7 @@ func mapiterinit(t *maptype, h *hmap, it *hiter) {
func mapiternext(it *hiter) { func mapiternext(it *hiter) {
h := it.h h := it.h
if raceenabled { if raceenabled {
callerpc := getcallerpc(unsafe.Pointer(&it)) callerpc := getcallerpc()
racereadpc(unsafe.Pointer(h), callerpc, funcPC(mapiternext)) racereadpc(unsafe.Pointer(h), callerpc, funcPC(mapiternext))
} }
if h.flags&hashWriting != 0 { if h.flags&hashWriting != 0 {
@ -1225,7 +1225,7 @@ func reflect_maplen(h *hmap) int {
return 0 return 0
} }
if raceenabled { if raceenabled {
callerpc := getcallerpc(unsafe.Pointer(&h)) callerpc := getcallerpc()
racereadpc(unsafe.Pointer(h), callerpc, funcPC(reflect_maplen)) racereadpc(unsafe.Pointer(h), callerpc, funcPC(reflect_maplen))
} }
return h.count return h.count

View File

@ -11,7 +11,7 @@ import (
func mapaccess1_fast32(t *maptype, h *hmap, key uint32) unsafe.Pointer { func mapaccess1_fast32(t *maptype, h *hmap, key uint32) unsafe.Pointer {
if raceenabled && h != nil { if raceenabled && h != nil {
callerpc := getcallerpc(unsafe.Pointer(&t)) callerpc := getcallerpc()
racereadpc(unsafe.Pointer(h), callerpc, funcPC(mapaccess1_fast32)) racereadpc(unsafe.Pointer(h), callerpc, funcPC(mapaccess1_fast32))
} }
if h == nil || h.count == 0 { if h == nil || h.count == 0 {
@ -51,7 +51,7 @@ func mapaccess1_fast32(t *maptype, h *hmap, key uint32) unsafe.Pointer {
func mapaccess2_fast32(t *maptype, h *hmap, key uint32) (unsafe.Pointer, bool) { func mapaccess2_fast32(t *maptype, h *hmap, key uint32) (unsafe.Pointer, bool) {
if raceenabled && h != nil { if raceenabled && h != nil {
callerpc := getcallerpc(unsafe.Pointer(&t)) callerpc := getcallerpc()
racereadpc(unsafe.Pointer(h), callerpc, funcPC(mapaccess2_fast32)) racereadpc(unsafe.Pointer(h), callerpc, funcPC(mapaccess2_fast32))
} }
if h == nil || h.count == 0 { if h == nil || h.count == 0 {
@ -91,7 +91,7 @@ func mapaccess2_fast32(t *maptype, h *hmap, key uint32) (unsafe.Pointer, bool) {
func mapaccess1_fast64(t *maptype, h *hmap, key uint64) unsafe.Pointer { func mapaccess1_fast64(t *maptype, h *hmap, key uint64) unsafe.Pointer {
if raceenabled && h != nil { if raceenabled && h != nil {
callerpc := getcallerpc(unsafe.Pointer(&t)) callerpc := getcallerpc()
racereadpc(unsafe.Pointer(h), callerpc, funcPC(mapaccess1_fast64)) racereadpc(unsafe.Pointer(h), callerpc, funcPC(mapaccess1_fast64))
} }
if h == nil || h.count == 0 { if h == nil || h.count == 0 {
@ -131,7 +131,7 @@ func mapaccess1_fast64(t *maptype, h *hmap, key uint64) unsafe.Pointer {
func mapaccess2_fast64(t *maptype, h *hmap, key uint64) (unsafe.Pointer, bool) { func mapaccess2_fast64(t *maptype, h *hmap, key uint64) (unsafe.Pointer, bool) {
if raceenabled && h != nil { if raceenabled && h != nil {
callerpc := getcallerpc(unsafe.Pointer(&t)) callerpc := getcallerpc()
racereadpc(unsafe.Pointer(h), callerpc, funcPC(mapaccess2_fast64)) racereadpc(unsafe.Pointer(h), callerpc, funcPC(mapaccess2_fast64))
} }
if h == nil || h.count == 0 { if h == nil || h.count == 0 {
@ -171,7 +171,7 @@ func mapaccess2_fast64(t *maptype, h *hmap, key uint64) (unsafe.Pointer, bool) {
func mapaccess1_faststr(t *maptype, h *hmap, ky string) unsafe.Pointer { func mapaccess1_faststr(t *maptype, h *hmap, ky string) unsafe.Pointer {
if raceenabled && h != nil { if raceenabled && h != nil {
callerpc := getcallerpc(unsafe.Pointer(&t)) callerpc := getcallerpc()
racereadpc(unsafe.Pointer(h), callerpc, funcPC(mapaccess1_faststr)) racereadpc(unsafe.Pointer(h), callerpc, funcPC(mapaccess1_faststr))
} }
if h == nil || h.count == 0 { if h == nil || h.count == 0 {
@ -260,7 +260,7 @@ dohash:
func mapaccess2_faststr(t *maptype, h *hmap, ky string) (unsafe.Pointer, bool) { func mapaccess2_faststr(t *maptype, h *hmap, ky string) (unsafe.Pointer, bool) {
if raceenabled && h != nil { if raceenabled && h != nil {
callerpc := getcallerpc(unsafe.Pointer(&t)) callerpc := getcallerpc()
racereadpc(unsafe.Pointer(h), callerpc, funcPC(mapaccess2_faststr)) racereadpc(unsafe.Pointer(h), callerpc, funcPC(mapaccess2_faststr))
} }
if h == nil || h.count == 0 { if h == nil || h.count == 0 {
@ -352,7 +352,7 @@ func mapassign_fast32(t *maptype, h *hmap, key uint32) unsafe.Pointer {
panic(plainError("assignment to entry in nil map")) panic(plainError("assignment to entry in nil map"))
} }
if raceenabled { if raceenabled {
callerpc := getcallerpc(unsafe.Pointer(&t)) callerpc := getcallerpc()
racewritepc(unsafe.Pointer(h), callerpc, funcPC(mapassign_fast32)) racewritepc(unsafe.Pointer(h), callerpc, funcPC(mapassign_fast32))
} }
if h.flags&hashWriting != 0 { if h.flags&hashWriting != 0 {
@ -441,7 +441,7 @@ func mapassign_fast64(t *maptype, h *hmap, key uint64) unsafe.Pointer {
panic(plainError("assignment to entry in nil map")) panic(plainError("assignment to entry in nil map"))
} }
if raceenabled { if raceenabled {
callerpc := getcallerpc(unsafe.Pointer(&t)) callerpc := getcallerpc()
racewritepc(unsafe.Pointer(h), callerpc, funcPC(mapassign_fast64)) racewritepc(unsafe.Pointer(h), callerpc, funcPC(mapassign_fast64))
} }
if h.flags&hashWriting != 0 { if h.flags&hashWriting != 0 {
@ -536,7 +536,7 @@ func mapassign_faststr(t *maptype, h *hmap, ky string) unsafe.Pointer {
panic(plainError("assignment to entry in nil map")) panic(plainError("assignment to entry in nil map"))
} }
if raceenabled { if raceenabled {
callerpc := getcallerpc(unsafe.Pointer(&t)) callerpc := getcallerpc()
racewritepc(unsafe.Pointer(h), callerpc, funcPC(mapassign_faststr)) racewritepc(unsafe.Pointer(h), callerpc, funcPC(mapassign_faststr))
} }
if h.flags&hashWriting != 0 { if h.flags&hashWriting != 0 {
@ -623,7 +623,7 @@ done:
func mapdelete_fast32(t *maptype, h *hmap, key uint32) { func mapdelete_fast32(t *maptype, h *hmap, key uint32) {
if raceenabled && h != nil { if raceenabled && h != nil {
callerpc := getcallerpc(unsafe.Pointer(&t)) callerpc := getcallerpc()
racewritepc(unsafe.Pointer(h), callerpc, funcPC(mapdelete_fast32)) racewritepc(unsafe.Pointer(h), callerpc, funcPC(mapdelete_fast32))
} }
if h == nil || h.count == 0 { if h == nil || h.count == 0 {
@ -672,7 +672,7 @@ search:
func mapdelete_fast64(t *maptype, h *hmap, key uint64) { func mapdelete_fast64(t *maptype, h *hmap, key uint64) {
if raceenabled && h != nil { if raceenabled && h != nil {
callerpc := getcallerpc(unsafe.Pointer(&t)) callerpc := getcallerpc()
racewritepc(unsafe.Pointer(h), callerpc, funcPC(mapdelete_fast64)) racewritepc(unsafe.Pointer(h), callerpc, funcPC(mapdelete_fast64))
} }
if h == nil || h.count == 0 { if h == nil || h.count == 0 {
@ -721,7 +721,7 @@ search:
func mapdelete_faststr(t *maptype, h *hmap, ky string) { func mapdelete_faststr(t *maptype, h *hmap, ky string) {
if raceenabled && h != nil { if raceenabled && h != nil {
callerpc := getcallerpc(unsafe.Pointer(&t)) callerpc := getcallerpc()
racewritepc(unsafe.Pointer(h), callerpc, funcPC(mapdelete_faststr)) racewritepc(unsafe.Pointer(h), callerpc, funcPC(mapdelete_faststr))
} }
if h == nil || h.count == 0 { if h == nil || h.count == 0 {

View File

@ -272,7 +272,7 @@ func panicnildottype(want *_type) {
func convT2E(t *_type, elem unsafe.Pointer) (e eface) { func convT2E(t *_type, elem unsafe.Pointer) (e eface) {
if raceenabled { if raceenabled {
raceReadObjectPC(t, elem, getcallerpc(unsafe.Pointer(&t)), funcPC(convT2E)) raceReadObjectPC(t, elem, getcallerpc(), funcPC(convT2E))
} }
if msanenabled { if msanenabled {
msanread(elem, t.size) msanread(elem, t.size)
@ -288,7 +288,7 @@ func convT2E(t *_type, elem unsafe.Pointer) (e eface) {
func convT2E16(t *_type, elem unsafe.Pointer) (e eface) { func convT2E16(t *_type, elem unsafe.Pointer) (e eface) {
if raceenabled { if raceenabled {
raceReadObjectPC(t, elem, getcallerpc(unsafe.Pointer(&t)), funcPC(convT2E16)) raceReadObjectPC(t, elem, getcallerpc(), funcPC(convT2E16))
} }
if msanenabled { if msanenabled {
msanread(elem, t.size) msanread(elem, t.size)
@ -307,7 +307,7 @@ func convT2E16(t *_type, elem unsafe.Pointer) (e eface) {
func convT2E32(t *_type, elem unsafe.Pointer) (e eface) { func convT2E32(t *_type, elem unsafe.Pointer) (e eface) {
if raceenabled { if raceenabled {
raceReadObjectPC(t, elem, getcallerpc(unsafe.Pointer(&t)), funcPC(convT2E32)) raceReadObjectPC(t, elem, getcallerpc(), funcPC(convT2E32))
} }
if msanenabled { if msanenabled {
msanread(elem, t.size) msanread(elem, t.size)
@ -326,7 +326,7 @@ func convT2E32(t *_type, elem unsafe.Pointer) (e eface) {
func convT2E64(t *_type, elem unsafe.Pointer) (e eface) { func convT2E64(t *_type, elem unsafe.Pointer) (e eface) {
if raceenabled { if raceenabled {
raceReadObjectPC(t, elem, getcallerpc(unsafe.Pointer(&t)), funcPC(convT2E64)) raceReadObjectPC(t, elem, getcallerpc(), funcPC(convT2E64))
} }
if msanenabled { if msanenabled {
msanread(elem, t.size) msanread(elem, t.size)
@ -345,7 +345,7 @@ func convT2E64(t *_type, elem unsafe.Pointer) (e eface) {
func convT2Estring(t *_type, elem unsafe.Pointer) (e eface) { func convT2Estring(t *_type, elem unsafe.Pointer) (e eface) {
if raceenabled { if raceenabled {
raceReadObjectPC(t, elem, getcallerpc(unsafe.Pointer(&t)), funcPC(convT2Estring)) raceReadObjectPC(t, elem, getcallerpc(), funcPC(convT2Estring))
} }
if msanenabled { if msanenabled {
msanread(elem, t.size) msanread(elem, t.size)
@ -364,7 +364,7 @@ func convT2Estring(t *_type, elem unsafe.Pointer) (e eface) {
func convT2Eslice(t *_type, elem unsafe.Pointer) (e eface) { func convT2Eslice(t *_type, elem unsafe.Pointer) (e eface) {
if raceenabled { if raceenabled {
raceReadObjectPC(t, elem, getcallerpc(unsafe.Pointer(&t)), funcPC(convT2Eslice)) raceReadObjectPC(t, elem, getcallerpc(), funcPC(convT2Eslice))
} }
if msanenabled { if msanenabled {
msanread(elem, t.size) msanread(elem, t.size)
@ -383,7 +383,7 @@ func convT2Eslice(t *_type, elem unsafe.Pointer) (e eface) {
func convT2Enoptr(t *_type, elem unsafe.Pointer) (e eface) { func convT2Enoptr(t *_type, elem unsafe.Pointer) (e eface) {
if raceenabled { if raceenabled {
raceReadObjectPC(t, elem, getcallerpc(unsafe.Pointer(&t)), funcPC(convT2Enoptr)) raceReadObjectPC(t, elem, getcallerpc(), funcPC(convT2Enoptr))
} }
if msanenabled { if msanenabled {
msanread(elem, t.size) msanread(elem, t.size)
@ -398,7 +398,7 @@ func convT2Enoptr(t *_type, elem unsafe.Pointer) (e eface) {
func convT2I(tab *itab, elem unsafe.Pointer) (i iface) { func convT2I(tab *itab, elem unsafe.Pointer) (i iface) {
t := tab._type t := tab._type
if raceenabled { if raceenabled {
raceReadObjectPC(t, elem, getcallerpc(unsafe.Pointer(&tab)), funcPC(convT2I)) raceReadObjectPC(t, elem, getcallerpc(), funcPC(convT2I))
} }
if msanenabled { if msanenabled {
msanread(elem, t.size) msanread(elem, t.size)
@ -413,7 +413,7 @@ func convT2I(tab *itab, elem unsafe.Pointer) (i iface) {
func convT2I16(tab *itab, elem unsafe.Pointer) (i iface) { func convT2I16(tab *itab, elem unsafe.Pointer) (i iface) {
t := tab._type t := tab._type
if raceenabled { if raceenabled {
raceReadObjectPC(t, elem, getcallerpc(unsafe.Pointer(&tab)), funcPC(convT2I16)) raceReadObjectPC(t, elem, getcallerpc(), funcPC(convT2I16))
} }
if msanenabled { if msanenabled {
msanread(elem, t.size) msanread(elem, t.size)
@ -433,7 +433,7 @@ func convT2I16(tab *itab, elem unsafe.Pointer) (i iface) {
func convT2I32(tab *itab, elem unsafe.Pointer) (i iface) { func convT2I32(tab *itab, elem unsafe.Pointer) (i iface) {
t := tab._type t := tab._type
if raceenabled { if raceenabled {
raceReadObjectPC(t, elem, getcallerpc(unsafe.Pointer(&tab)), funcPC(convT2I32)) raceReadObjectPC(t, elem, getcallerpc(), funcPC(convT2I32))
} }
if msanenabled { if msanenabled {
msanread(elem, t.size) msanread(elem, t.size)
@ -453,7 +453,7 @@ func convT2I32(tab *itab, elem unsafe.Pointer) (i iface) {
func convT2I64(tab *itab, elem unsafe.Pointer) (i iface) { func convT2I64(tab *itab, elem unsafe.Pointer) (i iface) {
t := tab._type t := tab._type
if raceenabled { if raceenabled {
raceReadObjectPC(t, elem, getcallerpc(unsafe.Pointer(&tab)), funcPC(convT2I64)) raceReadObjectPC(t, elem, getcallerpc(), funcPC(convT2I64))
} }
if msanenabled { if msanenabled {
msanread(elem, t.size) msanread(elem, t.size)
@ -473,7 +473,7 @@ func convT2I64(tab *itab, elem unsafe.Pointer) (i iface) {
func convT2Istring(tab *itab, elem unsafe.Pointer) (i iface) { func convT2Istring(tab *itab, elem unsafe.Pointer) (i iface) {
t := tab._type t := tab._type
if raceenabled { if raceenabled {
raceReadObjectPC(t, elem, getcallerpc(unsafe.Pointer(&tab)), funcPC(convT2Istring)) raceReadObjectPC(t, elem, getcallerpc(), funcPC(convT2Istring))
} }
if msanenabled { if msanenabled {
msanread(elem, t.size) msanread(elem, t.size)
@ -493,7 +493,7 @@ func convT2Istring(tab *itab, elem unsafe.Pointer) (i iface) {
func convT2Islice(tab *itab, elem unsafe.Pointer) (i iface) { func convT2Islice(tab *itab, elem unsafe.Pointer) (i iface) {
t := tab._type t := tab._type
if raceenabled { if raceenabled {
raceReadObjectPC(t, elem, getcallerpc(unsafe.Pointer(&tab)), funcPC(convT2Islice)) raceReadObjectPC(t, elem, getcallerpc(), funcPC(convT2Islice))
} }
if msanenabled { if msanenabled {
msanread(elem, t.size) msanread(elem, t.size)
@ -513,7 +513,7 @@ func convT2Islice(tab *itab, elem unsafe.Pointer) (i iface) {
func convT2Inoptr(tab *itab, elem unsafe.Pointer) (i iface) { func convT2Inoptr(tab *itab, elem unsafe.Pointer) (i iface) {
t := tab._type t := tab._type
if raceenabled { if raceenabled {
raceReadObjectPC(t, elem, getcallerpc(unsafe.Pointer(&tab)), funcPC(convT2Inoptr)) raceReadObjectPC(t, elem, getcallerpc(), funcPC(convT2Inoptr))
} }
if msanenabled { if msanenabled {
msanread(elem, t.size) msanread(elem, t.size)

View File

@ -258,8 +258,8 @@ func typedmemmove(typ *_type, dst, src unsafe.Pointer) {
//go:linkname reflect_typedmemmove reflect.typedmemmove //go:linkname reflect_typedmemmove reflect.typedmemmove
func reflect_typedmemmove(typ *_type, dst, src unsafe.Pointer) { func reflect_typedmemmove(typ *_type, dst, src unsafe.Pointer) {
if raceenabled { if raceenabled {
raceWriteObjectPC(typ, dst, getcallerpc(unsafe.Pointer(&typ)), funcPC(reflect_typedmemmove)) raceWriteObjectPC(typ, dst, getcallerpc(), funcPC(reflect_typedmemmove))
raceReadObjectPC(typ, src, getcallerpc(unsafe.Pointer(&typ)), funcPC(reflect_typedmemmove)) raceReadObjectPC(typ, src, getcallerpc(), funcPC(reflect_typedmemmove))
} }
if msanenabled { if msanenabled {
msanwrite(dst, typ.size) msanwrite(dst, typ.size)
@ -321,7 +321,7 @@ func typedslicecopy(typ *_type, dst, src slice) int {
srcp := src.array srcp := src.array
if raceenabled { if raceenabled {
callerpc := getcallerpc(unsafe.Pointer(&typ)) callerpc := getcallerpc()
pc := funcPC(slicecopy) pc := funcPC(slicecopy)
racewriterangepc(dstp, uintptr(n)*typ.size, callerpc, pc) racewriterangepc(dstp, uintptr(n)*typ.size, callerpc, pc)
racereadrangepc(srcp, uintptr(n)*typ.size, callerpc, pc) racereadrangepc(srcp, uintptr(n)*typ.size, callerpc, pc)
@ -390,7 +390,7 @@ func reflect_typedslicecopy(elemType *_type, dst, src slice) int {
size := uintptr(n) * elemType.size size := uintptr(n) * elemType.size
if raceenabled { if raceenabled {
callerpc := getcallerpc(unsafe.Pointer(&elemType)) callerpc := getcallerpc()
pc := funcPC(reflect_typedslicecopy) pc := funcPC(reflect_typedslicecopy)
racewriterangepc(dst.array, size, callerpc, pc) racewriterangepc(dst.array, size, callerpc, pc)
racereadrangepc(src.array, size, callerpc, pc) racereadrangepc(src.array, size, callerpc, pc)

View File

@ -596,7 +596,7 @@ func record(r *MemProfileRecord, b *bucket) {
r.AllocObjects = int64(mp.active.allocs) r.AllocObjects = int64(mp.active.allocs)
r.FreeObjects = int64(mp.active.frees) r.FreeObjects = int64(mp.active.frees)
if raceenabled { if raceenabled {
racewriterangepc(unsafe.Pointer(&r.Stack0[0]), unsafe.Sizeof(r.Stack0), getcallerpc(unsafe.Pointer(&r)), funcPC(MemProfile)) racewriterangepc(unsafe.Pointer(&r.Stack0[0]), unsafe.Sizeof(r.Stack0), getcallerpc(), funcPC(MemProfile))
} }
if msanenabled { if msanenabled {
msanwrite(unsafe.Pointer(&r.Stack0[0]), unsafe.Sizeof(r.Stack0)) msanwrite(unsafe.Pointer(&r.Stack0[0]), unsafe.Sizeof(r.Stack0))
@ -644,7 +644,7 @@ func BlockProfile(p []BlockProfileRecord) (n int, ok bool) {
r.Count = bp.count r.Count = bp.count
r.Cycles = bp.cycles r.Cycles = bp.cycles
if raceenabled { if raceenabled {
racewriterangepc(unsafe.Pointer(&r.Stack0[0]), unsafe.Sizeof(r.Stack0), getcallerpc(unsafe.Pointer(&p)), funcPC(BlockProfile)) racewriterangepc(unsafe.Pointer(&r.Stack0[0]), unsafe.Sizeof(r.Stack0), getcallerpc(), funcPC(BlockProfile))
} }
if msanenabled { if msanenabled {
msanwrite(unsafe.Pointer(&r.Stack0[0]), unsafe.Sizeof(r.Stack0)) msanwrite(unsafe.Pointer(&r.Stack0[0]), unsafe.Sizeof(r.Stack0))
@ -741,7 +741,7 @@ func GoroutineProfile(p []StackRecord) (n int, ok bool) {
// Save current goroutine. // Save current goroutine.
sp := getcallersp(unsafe.Pointer(&p)) sp := getcallersp(unsafe.Pointer(&p))
pc := getcallerpc(unsafe.Pointer(&p)) pc := getcallerpc()
systemstack(func() { systemstack(func() {
saveg(pc, sp, gp, &r[0]) saveg(pc, sp, gp, &r[0])
}) })
@ -786,7 +786,7 @@ func Stack(buf []byte, all bool) int {
if len(buf) > 0 { if len(buf) > 0 {
gp := getg() gp := getg()
sp := getcallersp(unsafe.Pointer(&buf)) sp := getcallersp(unsafe.Pointer(&buf))
pc := getcallerpc(unsafe.Pointer(&buf)) pc := getcallerpc()
systemstack(func() { systemstack(func() {
g0 := getg() g0 := getg()
// Force traceback=1 to override GOTRACEBACK setting, // Force traceback=1 to override GOTRACEBACK setting,
@ -826,7 +826,7 @@ func tracealloc(p unsafe.Pointer, size uintptr, typ *_type) {
} }
if gp.m.curg == nil || gp == gp.m.curg { if gp.m.curg == nil || gp == gp.m.curg {
goroutineheader(gp) goroutineheader(gp)
pc := getcallerpc(unsafe.Pointer(&p)) pc := getcallerpc()
sp := getcallersp(unsafe.Pointer(&p)) sp := getcallersp(unsafe.Pointer(&p))
systemstack(func() { systemstack(func() {
traceback(pc, sp, 0, gp) traceback(pc, sp, 0, gp)
@ -846,7 +846,7 @@ func tracefree(p unsafe.Pointer, size uintptr) {
gp.m.traceback = 2 gp.m.traceback = 2
print("tracefree(", p, ", ", hex(size), ")\n") print("tracefree(", p, ", ", hex(size), ")\n")
goroutineheader(gp) goroutineheader(gp)
pc := getcallerpc(unsafe.Pointer(&p)) pc := getcallerpc()
sp := getcallersp(unsafe.Pointer(&p)) sp := getcallersp(unsafe.Pointer(&p))
systemstack(func() { systemstack(func() {
traceback(pc, sp, 0, gp) traceback(pc, sp, 0, gp)

View File

@ -701,7 +701,7 @@ func stdcall(fn stdFunction) uintptr {
if mp.profilehz != 0 { if mp.profilehz != 0 {
// leave pc/sp for cpu profiler // leave pc/sp for cpu profiler
mp.libcallg.set(gp) mp.libcallg.set(gp)
mp.libcallpc = getcallerpc(unsafe.Pointer(&fn)) mp.libcallpc = getcallerpc()
// sp must be the last, because once async cpu profiler finds // sp must be the last, because once async cpu profiler finds
// all three values to be non-zero, it will use them // all three values to be non-zero, it will use them
mp.libcallsp = getcallersp(unsafe.Pointer(&fn)) mp.libcallsp = getcallersp(unsafe.Pointer(&fn))

View File

@ -83,7 +83,7 @@ func deferproc(siz int32, fn *funcval) { // arguments of fn follow fn
// Until the copy completes, we can only call nosplit routines. // Until the copy completes, we can only call nosplit routines.
sp := getcallersp(unsafe.Pointer(&siz)) sp := getcallersp(unsafe.Pointer(&siz))
argp := uintptr(unsafe.Pointer(&fn)) + unsafe.Sizeof(fn) argp := uintptr(unsafe.Pointer(&fn)) + unsafe.Sizeof(fn)
callerpc := getcallerpc(unsafe.Pointer(&siz)) callerpc := getcallerpc()
d := newdefer(siz) d := newdefer(siz)
if d._panic != nil { if d._panic != nil {
@ -591,7 +591,7 @@ func startpanic() {
//go:nosplit //go:nosplit
func dopanic(unused int) { func dopanic(unused int) {
pc := getcallerpc(unsafe.Pointer(&unused)) pc := getcallerpc()
sp := getcallersp(unsafe.Pointer(&unused)) sp := getcallersp(unsafe.Pointer(&unused))
gp := getg() gp := getg()
systemstack(func() { systemstack(func() {

View File

@ -2545,7 +2545,7 @@ func reentersyscall(pc, sp uintptr) {
// Standard syscall entry used by the go syscall library and normal cgo calls. // Standard syscall entry used by the go syscall library and normal cgo calls.
//go:nosplit //go:nosplit
func entersyscall(dummy int32) { func entersyscall(dummy int32) {
reentersyscall(getcallerpc(unsafe.Pointer(&dummy)), getcallersp(unsafe.Pointer(&dummy))) reentersyscall(getcallerpc(), getcallersp(unsafe.Pointer(&dummy)))
} }
func entersyscall_sysmon() { func entersyscall_sysmon() {
@ -2588,7 +2588,7 @@ func entersyscallblock(dummy int32) {
_g_.m.p.ptr().syscalltick++ _g_.m.p.ptr().syscalltick++
// Leave SP around for GC and traceback. // Leave SP around for GC and traceback.
pc := getcallerpc(unsafe.Pointer(&dummy)) pc := getcallerpc()
sp := getcallersp(unsafe.Pointer(&dummy)) sp := getcallersp(unsafe.Pointer(&dummy))
save(pc, sp) save(pc, sp)
_g_.syscallsp = _g_.sched.sp _g_.syscallsp = _g_.sched.sp
@ -2613,7 +2613,7 @@ func entersyscallblock(dummy int32) {
systemstack(entersyscallblock_handoff) systemstack(entersyscallblock_handoff)
// Resave for traceback during blocked call. // Resave for traceback during blocked call.
save(getcallerpc(unsafe.Pointer(&dummy)), getcallersp(unsafe.Pointer(&dummy))) save(getcallerpc(), getcallersp(unsafe.Pointer(&dummy)))
_g_.m.locks-- _g_.m.locks--
} }
@ -2941,7 +2941,7 @@ func malg(stacksize int32) *g {
//go:nosplit //go:nosplit
func newproc(siz int32, fn *funcval) { func newproc(siz int32, fn *funcval) {
argp := add(unsafe.Pointer(&fn), sys.PtrSize) argp := add(unsafe.Pointer(&fn), sys.PtrSize)
pc := getcallerpc(unsafe.Pointer(&siz)) pc := getcallerpc()
systemstack(func() { systemstack(func() {
newproc1(fn, (*uint8)(argp), siz, 0, pc) newproc1(fn, (*uint8)(argp), siz, 0, pc)
}) })

View File

@ -73,7 +73,7 @@ func newselect(sel *hselect, selsize int64, size int32) {
} }
func selectsend(sel *hselect, c *hchan, elem unsafe.Pointer) { func selectsend(sel *hselect, c *hchan, elem unsafe.Pointer) {
pc := getcallerpc(unsafe.Pointer(&sel)) pc := getcallerpc()
i := sel.ncase i := sel.ncase
if i >= sel.tcase { if i >= sel.tcase {
throw("selectsend: too many cases") throw("selectsend: too many cases")
@ -94,7 +94,7 @@ func selectsend(sel *hselect, c *hchan, elem unsafe.Pointer) {
} }
func selectrecv(sel *hselect, c *hchan, elem unsafe.Pointer, received *bool) { func selectrecv(sel *hselect, c *hchan, elem unsafe.Pointer, received *bool) {
pc := getcallerpc(unsafe.Pointer(&sel)) pc := getcallerpc()
i := sel.ncase i := sel.ncase
if i >= sel.tcase { if i >= sel.tcase {
throw("selectrecv: too many cases") throw("selectrecv: too many cases")
@ -116,7 +116,7 @@ func selectrecv(sel *hselect, c *hchan, elem unsafe.Pointer, received *bool) {
} }
func selectdefault(sel *hselect) { func selectdefault(sel *hselect) {
pc := getcallerpc(unsafe.Pointer(&sel)) pc := getcallerpc()
i := sel.ncase i := sel.ncase
if i >= sel.tcase { if i >= sel.tcase {
throw("selectdefault: too many cases") throw("selectdefault: too many cases")

View File

@ -81,7 +81,7 @@ func makeslice64(et *_type, len64, cap64 int64) slice {
// The SSA backend might prefer the new length or to return only ptr/cap and save stack space. // The SSA backend might prefer the new length or to return only ptr/cap and save stack space.
func growslice(et *_type, old slice, cap int) slice { func growslice(et *_type, old slice, cap int) slice {
if raceenabled { if raceenabled {
callerpc := getcallerpc(unsafe.Pointer(&et)) callerpc := getcallerpc()
racereadrangepc(old.array, uintptr(old.len*int(et.size)), callerpc, funcPC(growslice)) racereadrangepc(old.array, uintptr(old.len*int(et.size)), callerpc, funcPC(growslice))
} }
if msanenabled { if msanenabled {
@ -179,7 +179,7 @@ func slicecopy(to, fm slice, width uintptr) int {
} }
if raceenabled { if raceenabled {
callerpc := getcallerpc(unsafe.Pointer(&to)) callerpc := getcallerpc()
pc := funcPC(slicecopy) pc := funcPC(slicecopy)
racewriterangepc(to.array, uintptr(n*int(width)), callerpc, pc) racewriterangepc(to.array, uintptr(n*int(width)), callerpc, pc)
racereadrangepc(fm.array, uintptr(n*int(width)), callerpc, pc) racereadrangepc(fm.array, uintptr(n*int(width)), callerpc, pc)
@ -210,7 +210,7 @@ func slicestringcopy(to []byte, fm string) int {
} }
if raceenabled { if raceenabled {
callerpc := getcallerpc(unsafe.Pointer(&to)) callerpc := getcallerpc()
pc := funcPC(slicestringcopy) pc := funcPC(slicestringcopy)
racewriterangepc(unsafe.Pointer(&to[0]), uintptr(n), callerpc, pc) racewriterangepc(unsafe.Pointer(&to[0]), uintptr(n), callerpc, pc)
} }

View File

@ -80,7 +80,7 @@ func slicebytetostring(buf *tmpBuf, b []byte) (str string) {
if raceenabled { if raceenabled {
racereadrangepc(unsafe.Pointer(&b[0]), racereadrangepc(unsafe.Pointer(&b[0]),
uintptr(l), uintptr(l),
getcallerpc(unsafe.Pointer(&buf)), getcallerpc(),
funcPC(slicebytetostring)) funcPC(slicebytetostring))
} }
if msanenabled { if msanenabled {
@ -134,7 +134,7 @@ func slicebytetostringtmp(b []byte) string {
if raceenabled && len(b) > 0 { if raceenabled && len(b) > 0 {
racereadrangepc(unsafe.Pointer(&b[0]), racereadrangepc(unsafe.Pointer(&b[0]),
uintptr(len(b)), uintptr(len(b)),
getcallerpc(unsafe.Pointer(&b)), getcallerpc(),
funcPC(slicebytetostringtmp)) funcPC(slicebytetostringtmp))
} }
if msanenabled && len(b) > 0 { if msanenabled && len(b) > 0 {
@ -183,7 +183,7 @@ func slicerunetostring(buf *tmpBuf, a []rune) string {
if raceenabled && len(a) > 0 { if raceenabled && len(a) > 0 {
racereadrangepc(unsafe.Pointer(&a[0]), racereadrangepc(unsafe.Pointer(&a[0]),
uintptr(len(a))*unsafe.Sizeof(a[0]), uintptr(len(a))*unsafe.Sizeof(a[0]),
getcallerpc(unsafe.Pointer(&buf)), getcallerpc(),
funcPC(slicerunetostring)) funcPC(slicerunetostring))
} }
if msanenabled && len(a) > 0 { if msanenabled && len(a) > 0 {

View File

@ -198,7 +198,7 @@ func publicationBarrier()
// getcallerpc returns the program counter (PC) of its caller's caller. // getcallerpc returns the program counter (PC) of its caller's caller.
// getcallersp returns the stack pointer (SP) of its caller's caller. // getcallersp returns the stack pointer (SP) of its caller's caller.
// For both, the argp must be a pointer to the caller's first function argument. // argp must be a pointer to the caller's first function argument.
// The implementation may or may not use argp, depending on // The implementation may or may not use argp, depending on
// the architecture. The implementation may be a compiler // the architecture. The implementation may be a compiler
// intrinsic; there is not necessarily code implementing this // intrinsic; there is not necessarily code implementing this
@ -207,7 +207,7 @@ func publicationBarrier()
// For example: // For example:
// //
// func f(arg1, arg2, arg3 int) { // func f(arg1, arg2, arg3 int) {
// pc := getcallerpc(unsafe.Pointer(&arg1)) // pc := getcallerpc()
// sp := getcallersp(unsafe.Pointer(&arg1)) // sp := getcallersp(unsafe.Pointer(&arg1))
// } // }
// //
@ -227,7 +227,7 @@ func publicationBarrier()
// immediately and can only be passed to nosplit functions. // immediately and can only be passed to nosplit functions.
//go:noescape //go:noescape
func getcallerpc(argp unsafe.Pointer) uintptr func getcallerpc() uintptr
//go:nosplit //go:nosplit
func getcallersp(argp unsafe.Pointer) uintptr { func getcallersp(argp unsafe.Pointer) uintptr {

View File

@ -714,7 +714,7 @@ func traceback1(pc, sp, lr uintptr, gp *g, flags uint) {
func callers(skip int, pcbuf []uintptr) int { func callers(skip int, pcbuf []uintptr) int {
sp := getcallersp(unsafe.Pointer(&skip)) sp := getcallersp(unsafe.Pointer(&skip))
pc := getcallerpc(unsafe.Pointer(&skip)) pc := getcallerpc()
gp := getg() gp := getg()
var n int var n int
systemstack(func() { systemstack(func() {