summaryrefslogtreecommitdiff
path: root/src/pkg/runtime/cpuprof.go
diff options
context:
space:
mode:
authorDmitriy Vyukov <dvyukov@google.com>2014-09-03 20:47:30 +0400
committerDmitriy Vyukov <dvyukov@google.com>2014-09-03 20:47:30 +0400
commit7b20cd40e5da2f97b136ff0e6193b08ef0d7085b (patch)
treeaa8443c2d1f827c99c1338a93bc2b41d05554466 /src/pkg/runtime/cpuprof.go
parent548977c7411fb5511eb315420d24fdd0f72ed7a3 (diff)
downloadgo-7b20cd40e5da2f97b136ff0e6193b08ef0d7085b.tar.gz
runtime: adopt race detector for runtime written in Go
Ignore memory access on g0/gsignal. See the issue for context and explanation. Fixes issue 8627. LGTM=khr R=golang-codereviews, mdempsky, khr CC=golang-codereviews, rsc https://codereview.appspot.com/137070043
Diffstat (limited to 'src/pkg/runtime/cpuprof.go')
-rw-r--r--src/pkg/runtime/cpuprof.go10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/pkg/runtime/cpuprof.go b/src/pkg/runtime/cpuprof.go
index b397eafbe..4325d7e1c 100644
--- a/src/pkg/runtime/cpuprof.go
+++ b/src/pkg/runtime/cpuprof.go
@@ -239,9 +239,7 @@ Assoc:
// Reuse the newly evicted entry.
e.depth = uintptr(len(pc))
e.count = 1
- for i := range pc {
- e.stack[i] = pc[i]
- }
+ copy(e.stack[:], pc)
}
// evict copies the given entry's data into the log, so that
@@ -266,10 +264,8 @@ func (p *cpuProfile) evict(e *cpuprofEntry) bool {
q++
log[q] = d
q++
- for i := uintptr(0); i < d; i++ {
- log[q] = e.stack[i]
- q++
- }
+ copy(log[q:], e.stack[:d])
+ q += d
p.nlog = q
e.count = 0
return true