diff options
| author | Russ Cox <rsc@golang.org> | 2014-09-03 11:10:38 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2014-09-03 11:10:38 -0400 |
| commit | 0e07f1c99f7ba8f657eaab49bfe106abddbe93a9 (patch) | |
| tree | 67691fdac58500e723fca4713fc06caa9d843c7f /src/pkg/runtime/slice.go | |
| parent | 2c780a35b986dec270640115fb3f28a9e1affeaf (diff) | |
| download | go-0e07f1c99f7ba8f657eaab49bfe106abddbe93a9.tar.xz | |
runtime: introduce, use funcPC to convert Go func to PC
This removes the ** unsafe hack.
Real bug fixed at chan.go:101.
LGTM=dave, r, iant
R=golang-codereviews, dave, r, iant
CC=dvyukov, golang-codereviews, khr
https://golang.org/cl/140870044
Diffstat (limited to 'src/pkg/runtime/slice.go')
| -rw-r--r-- | src/pkg/runtime/slice.go | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/pkg/runtime/slice.go b/src/pkg/runtime/slice.go index c282125b44..68a225a509 100644 --- a/src/pkg/runtime/slice.go +++ b/src/pkg/runtime/slice.go @@ -48,9 +48,7 @@ func growslice(t *slicetype, old sliceStruct, n int64) sliceStruct { if raceenabled { callerpc := getcallerpc(unsafe.Pointer(&t)) - fn := growslice - pc := **(**uintptr)(unsafe.Pointer(&fn)) - racereadrangepc(old.array, old.len*int(t.elem.size), callerpc, pc) + racereadrangepc(old.array, old.len*int(t.elem.size), callerpc, funcPC(growslice)) } et := t.elem @@ -105,8 +103,7 @@ func slicecopy(to sliceStruct, fm sliceStruct, width uintptr) int { if raceenabled { callerpc := getcallerpc(unsafe.Pointer(&to)) - fn := slicecopy - pc := **(**uintptr)(unsafe.Pointer(&fn)) + pc := funcPC(slicecopy) racewriterangepc(to.array, n*int(width), callerpc, pc) racereadrangepc(fm.array, n*int(width), callerpc, pc) } @@ -133,8 +130,7 @@ func slicestringcopy(to []byte, fm string) int { if raceenabled { callerpc := getcallerpc(unsafe.Pointer(&to)) - fn := slicestringcopy - pc := **(**uintptr)(unsafe.Pointer(&fn)) + pc := funcPC(slicestringcopy) racewriterangepc(unsafe.Pointer(&to[0]), n, callerpc, pc) } |
