diff options
| author | Russ Cox <rsc@golang.org> | 2014-09-04 15:53:45 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2014-09-04 15:53:45 -0400 |
| commit | f545b05aaec2d13e664ce48ce2c258bcfce307c4 (patch) | |
| tree | b3765343ac5e3089a6bca40974cb6d46d78da013 /src/pkg/runtime/slice.go | |
| parent | c08d8834ddf8d69daba989a4ee0b5e144fce973d (diff) | |
| download | go-f545b05aaec2d13e664ce48ce2c258bcfce307c4.tar.xz | |
runtime: make more functions safe for Go
Convert no-op race functions.
Everything else is tiny and gets NOSPLITs.
After this, all that is left on darwin is sysAlloc, panic, and gothrow (all pending).
There may be system-specific calls in other builds.
LGTM=iant
R=golang-codereviews, iant
CC=dvyukov, golang-codereviews, khr, r
https://golang.org/cl/140240044
Diffstat (limited to 'src/pkg/runtime/slice.go')
| -rw-r--r-- | src/pkg/runtime/slice.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/pkg/runtime/slice.go b/src/pkg/runtime/slice.go index 68a225a509..3b88927c64 100644 --- a/src/pkg/runtime/slice.go +++ b/src/pkg/runtime/slice.go @@ -48,7 +48,7 @@ func growslice(t *slicetype, old sliceStruct, n int64) sliceStruct { if raceenabled { callerpc := getcallerpc(unsafe.Pointer(&t)) - racereadrangepc(old.array, old.len*int(t.elem.size), callerpc, funcPC(growslice)) + racereadrangepc(old.array, uintptr(old.len*int(t.elem.size)), callerpc, funcPC(growslice)) } et := t.elem @@ -104,8 +104,8 @@ func slicecopy(to sliceStruct, fm sliceStruct, width uintptr) int { if raceenabled { callerpc := getcallerpc(unsafe.Pointer(&to)) pc := funcPC(slicecopy) - racewriterangepc(to.array, n*int(width), callerpc, pc) - racereadrangepc(fm.array, n*int(width), callerpc, pc) + racewriterangepc(to.array, uintptr(n*int(width)), callerpc, pc) + racereadrangepc(fm.array, uintptr(n*int(width)), callerpc, pc) } size := uintptr(n) * width @@ -131,7 +131,7 @@ func slicestringcopy(to []byte, fm string) int { if raceenabled { callerpc := getcallerpc(unsafe.Pointer(&to)) pc := funcPC(slicestringcopy) - racewriterangepc(unsafe.Pointer(&to[0]), n, callerpc, pc) + racewriterangepc(unsafe.Pointer(&to[0]), uintptr(n), callerpc, pc) } memmove(unsafe.Pointer(&to[0]), unsafe.Pointer((*stringStruct)(unsafe.Pointer(&fm)).str), uintptr(n)) |
