From f545b05aaec2d13e664ce48ce2c258bcfce307c4 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Thu, 4 Sep 2014 15:53:45 -0400 Subject: 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 --- src/pkg/runtime/slice.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/pkg/runtime/slice.go') 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)) -- cgit v1.3