diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-01-25 20:56:26 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-01-25 20:56:26 +0000 |
commit | df1304ee03f41aed179545d1e8b4684cfd22bbdf (patch) | |
tree | c68d6b2a9f5b82a23171b0a488a4b7e5c63ad860 /libgo/go/runtime | |
parent | 3be18e47c33b61365786831e0f967f42b09922c9 (diff) | |
download | gcc-df1304ee03f41aed179545d1e8b4684cfd22bbdf.zip gcc-df1304ee03f41aed179545d1e8b4684cfd22bbdf.tar.gz gcc-df1304ee03f41aed179545d1e8b4684cfd22bbdf.tar.bz2 |
libgo: Update to weekly.2012-01-15.
From-SVN: r183539
Diffstat (limited to 'libgo/go/runtime')
-rw-r--r-- | libgo/go/runtime/debug.go | 1 | ||||
-rw-r--r-- | libgo/go/runtime/extern.go | 54 |
2 files changed, 10 insertions, 45 deletions
diff --git a/libgo/go/runtime/debug.go b/libgo/go/runtime/debug.go index 1243703..c2b9056 100644 --- a/libgo/go/runtime/debug.go +++ b/libgo/go/runtime/debug.go @@ -19,6 +19,7 @@ func UnlockOSThread() // GOMAXPROCS sets the maximum number of CPUs that can be executing // simultaneously and returns the previous setting. If n < 1, it does not // change the current setting. +// The number of logical CPUs on the local machine can be queried with NumCPU. // This call will go away when the scheduler improves. func GOMAXPROCS(n int) int diff --git a/libgo/go/runtime/extern.go b/libgo/go/runtime/extern.go index 7c986da..25c7470 100644 --- a/libgo/go/runtime/extern.go +++ b/libgo/go/runtime/extern.go @@ -19,8 +19,8 @@ func Gosched() func Goexit() // Caller reports file and line number information about function invocations on -// the calling goroutine's stack. The argument skip is the number of stack frames to -// ascend, with 0 identifying the the caller of Caller. The return values report the +// the calling goroutine's stack. The argument skip is the number of stack frames +// to ascend, with 0 identifying the caller of Caller. The return values report the // program counter, file name, and line number within the file of the corresponding // call. The boolean ok is false if it was not possible to recover the information. func Caller(skip int) (pc uintptr, file string, line int, ok bool) @@ -59,54 +59,18 @@ func (f *Func) Entry() uintptr { return f.entry } // The result will not be accurate if pc is not a program // counter within f. func (f *Func) FileLine(pc uintptr) (file string, line int) { - // NOTE(rsc): If you edit this function, also edit - // symtab.c:/^funcline. That function also has the - // comments explaining the logic. - targetpc := pc - - var pcQuant uintptr = 1 - if GOARCH == "arm" { - pcQuant = 4 - } - - p := f.pcln - pc = f.pc0 - line = int(f.ln0) - i := 0 - //print("FileLine start pc=", pc, " targetpc=", targetpc, " line=", line, - // " tab=", p, " ", p[0], " quant=", pcQuant, " GOARCH=", GOARCH, "\n") - for { - for i < len(p) && p[i] > 128 { - pc += pcQuant * uintptr(p[i]-128) - i++ - } - //print("pc<", pc, " targetpc=", targetpc, " line=", line, "\n") - if pc > targetpc || i >= len(p) { - break - } - if p[i] == 0 { - if i+5 > len(p) { - break - } - line += int(p[i+1]<<24) | int(p[i+2]<<16) | int(p[i+3]<<8) | int(p[i+4]) - i += 5 - } else if p[i] <= 64 { - line += int(p[i]) - i++ - } else { - line -= int(p[i] - 64) - i++ - } - //print("pc=", pc, " targetpc=", targetpc, " line=", line, "\n") - pc += pcQuant - } - file = f.src - return + return funcline_go(f, pc) } +// implemented in symtab.c +func funcline_go(*Func, uintptr) (string, int) + // mid returns the current os thread (m) id. func mid() uint32 +// NumCPU returns the number of logical CPUs on the local machine. +func NumCPU() int + // Semacquire waits until *s > 0 and then atomically decrements it. // It is intended as a simple sleep primitive for use by the synchronization // library and should not be used directly. |