runtime: scan register backing store on ia64
[official-gcc.git] / libgo / go / runtime / proflabel.go
blobff73fe4856f71d2bf6e078476fc6bb2bb1fcfbdc
1 // Copyright 2017 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 package runtime
7 import "unsafe"
9 var labelSync uintptr
11 //go:linkname runtime_setProfLabel runtime_pprof.runtime_setProfLabel
12 func runtime_setProfLabel(labels unsafe.Pointer) {
13 // Introduce race edge for read-back via profile.
14 // This would more properly use &getg().labels as the sync address,
15 // but we do the read in a signal handler and can't call the race runtime then.
17 // This uses racereleasemerge rather than just racerelease so
18 // the acquire in profBuf.read synchronizes with *all* prior
19 // setProfLabel operations, not just the most recent one. This
20 // is important because profBuf.read will observe different
21 // labels set by different setProfLabel operations on
22 // different goroutines, so it needs to synchronize with all
23 // of them (this wouldn't be an issue if we could synchronize
24 // on &getg().labels since we would synchronize with each
25 // most-recent labels write separately.)
27 // racereleasemerge is like a full read-modify-write on
28 // labelSync, rather than just a store-release, so it carries
29 // a dependency on the previous racereleasemerge, which
30 // ultimately carries forward to the acquire in profBuf.read.
31 if raceenabled {
32 racereleasemerge(unsafe.Pointer(&labelSync))
34 getg().labels = labels
37 //go:linkname runtime_getProfLabel runtime_pprof.runtime_getProfLabel
38 func runtime_getProfLabel() unsafe.Pointer {
39 return getg().labels