diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2018-02-07 22:04:55 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2018-02-07 22:04:55 +0000 |
commit | f1a2d8b1b51ee77499ccf8ed3b4b49ca5307ddb4 (patch) | |
tree | 11e6655920a67f8348528f9cd25ca6b1167eb6d1 /libgo/go/runtime/proc.go | |
parent | 82e259b893021c9b82db80456d409ea6d6bc41d7 (diff) | |
download | gcc-f1a2d8b1b51ee77499ccf8ed3b4b49ca5307ddb4.zip gcc-f1a2d8b1b51ee77499ccf8ed3b4b49ca5307ddb4.tar.gz gcc-f1a2d8b1b51ee77499ccf8ed3b4b49ca5307ddb4.tar.bz2 |
runtime: don't call funcPC from a function
The escape analysis support is not yet good enough to avoid escaping
the argument to funcPC. This causes unnecessary and often harmful
memory allocation. E.g., (*cpuProfile).addExtra can be called from a
signal handler, and it must not allocate memory.
Move the calls to funcPC to use variables instead. This was done in
the original migration to using funcPC, but was not done for newer code.
In one case, in signal handling code, use getSigtramp.
Reviewed-on: https://go-review.googlesource.com/92735
From-SVN: r257463
Diffstat (limited to 'libgo/go/runtime/proc.go')
-rw-r--r-- | libgo/go/runtime/proc.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libgo/go/runtime/proc.go b/libgo/go/runtime/proc.go index 2972daa0..edf4140 100644 --- a/libgo/go/runtime/proc.go +++ b/libgo/go/runtime/proc.go @@ -3369,7 +3369,9 @@ var lostAtomic64Count uint64 var _SystemPC = funcPC(_System) var _ExternalCodePC = funcPC(_ExternalCode) +var _LostExternalCodePC = funcPC(_LostExternalCode) var _GCPC = funcPC(_GC) +var _LostSIGPROFDuringAtomic64PC = funcPC(_LostSIGPROFDuringAtomic64) // Called if we receive a SIGPROF signal. // Called by the signal handler, may run during STW. @@ -3469,7 +3471,7 @@ func sigprofNonGoPC(pc uintptr) { if prof.hz != 0 { stk := []uintptr{ pc, - funcPC(_ExternalCode) + sys.PCQuantum, + _ExternalCodePC + sys.PCQuantum, } cpuprof.addNonGo(stk) } |