They are no longer needed now that C is gone.
goatoi -> atoi
gofuncname/funcname -> funcname/cfuncname
goroundupsize -> already existing roundupsize
Change-Id: I278bc33d279e1fdc5e8a2a04e961c4c1573b28c7
Reviewed-on: https://go-review.googlesource.com/2154
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
dumpint(uint64(f.entry))
dumpint(uint64(s.pc))
dumpint(uint64(s.continpc))
- name := gofuncname(f)
+ name := funcname(f)
if name == "" {
name = "unknown function"
}
dumpstr("?")
dumpint(0)
} else {
- dumpstr(gofuncname(f))
+ dumpstr(funcname(f))
if i > 0 && pc > f.entry {
pc--
}
return mallocgc(size, nil, flagNoScan|flagNoZero)
}
-// round size up to next size class
-func goroundupsize(size uintptr) uintptr {
- if size < maxSmallSize {
- if size <= 1024-8 {
- return uintptr(class_to_size[size_to_class8[(size+7)>>3]])
- }
- return uintptr(class_to_size[size_to_class128[(size-1024+127)>>7]])
- }
- if size+pageSize < size {
- return size
- }
- return (size + pageSize - 1) &^ pageMask
-}
-
func profilealloc(mp *m, x unsafe.Pointer, size uintptr) {
c := mp.mcache
rate := MemProfileRate
return true
}
if _DebugGC > 1 {
- print("scanframe ", gofuncname(f), "\n")
+ print("scanframe ", funcname(f), "\n")
}
if targetpc != f.entry {
targetpc--
if size > minsize {
stkmap := (*stackmap)(funcdata(f, _FUNCDATA_LocalsPointerMaps))
if stkmap == nil || stkmap.n <= 0 {
- print("runtime: frame ", gofuncname(f), " untyped locals ", hex(frame.varp-size), "+", hex(size), "\n")
+ print("runtime: frame ", funcname(f), " untyped locals ", hex(frame.varp-size), "+", hex(size), "\n")
throw("missing stackmap")
}
// Locals bitmap information, scan just the pointers in locals.
if pcdata < 0 || pcdata >= stkmap.n {
// don't know where we are
- print("runtime: pcdata is ", pcdata, " and ", stkmap.n, " locals stack map entries for ", gofuncname(f), " (targetpc=", targetpc, ")\n")
+ print("runtime: pcdata is ", pcdata, " and ", stkmap.n, " locals stack map entries for ", funcname(f), " (targetpc=", targetpc, ")\n")
throw("scanframe: bad symbol table")
}
bv := stackmapdata(stkmap, pcdata)
} else {
stkmap := (*stackmap)(funcdata(f, _FUNCDATA_ArgsPointerMaps))
if stkmap == nil || stkmap.n <= 0 {
- print("runtime: frame ", gofuncname(f), " untyped args ", hex(frame.argp), "+", hex(frame.arglen), "\n")
+ print("runtime: frame ", funcname(f), " untyped args ", hex(frame.argp), "+", hex(frame.arglen), "\n")
throw("missing stackmap")
}
if pcdata < 0 || pcdata >= stkmap.n {
// don't know where we are
- print("runtime: pcdata is ", pcdata, " and ", stkmap.n, " args stack map entries for ", gofuncname(f), " (targetpc=", targetpc, ")\n")
+ print("runtime: pcdata is ", pcdata, " and ", stkmap.n, " args stack map entries for ", funcname(f), " (targetpc=", targetpc, ")\n")
throw("scanframe: bad symbol table")
}
bv = stackmapdata(stkmap, pcdata)
if defersc >= uintptr(len(m)) {
break
}
- siz := goroundupsize(totaldefersize(i))
+ siz := roundupsize(totaldefersize(i))
if m[defersc] < 0 {
m[defersc] = int32(siz)
continue
}
if d == nil {
// Allocate new defer+args.
- total := goroundupsize(totaldefersize(uintptr(siz)))
+ total := roundupsize(totaldefersize(uintptr(siz)))
d = (*_defer)(mallocgc(total, deferType, 0))
}
d.siz = siz
sched.lastpoll = uint64(nanotime())
procs := 1
- if n := goatoi(gogetenv("GOMAXPROCS")); n > 0 {
+ if n := atoi(gogetenv("GOMAXPROCS")); n > 0 {
if n > _MaxGomaxprocs {
n = _MaxGomaxprocs
}
return
}
- ctx.fn = funcname(f)
+ ctx.fn = cfuncname(f)
file, line := funcline(f, ctx.pc)
ctx.line = uintptr(line)
ctx.file = &bytes(file)[0] // assume NUL-terminated
key, value := field[:i], field[i+1:]
for _, v := range dbgvars {
if v.name == key {
- *v.value = int32(goatoi(value))
+ *v.value = int32(atoi(value))
}
}
}
case "crash":
traceback_cache = 2<<1 | 1
default:
- traceback_cache = uint32(goatoi(p)) << 1
+ traceback_cache = uint32(atoi(p)) << 1
}
}
if p == "off" {
return -1
}
- return int32(goatoi(p))
+ return int32(atoi(p))
}
panic(errorString("growslice: cap out of range"))
}
lenmem := uintptr(old.len) * uintptr(et.size)
- capmem := goroundupsize(uintptr(newcap) * uintptr(et.size))
+ capmem := roundupsize(uintptr(newcap) * uintptr(et.size))
newcap = int(capmem / uintptr(et.size))
var p unsafe.Pointer
if et.kind&kindNoPointers != 0 {
// Looks like a junk value in a pointer slot.
// Live analysis wrong?
getg().m.traceback = 2
- print("runtime: bad pointer in frame ", gofuncname(f), " at ", add(scanp, i*ptrSize), ": ", p, "\n")
+ print("runtime: bad pointer in frame ", funcname(f), " at ", add(scanp, i*ptrSize), ": ", p, "\n")
throw("invalid stack pointer")
}
if minp <= up && up < maxp {
if stackDebug >= 3 {
- print("adjust ptr ", p, " ", gofuncname(f), "\n")
+ print("adjust ptr ", p, " ", funcname(f), "\n")
}
*(*unsafe.Pointer)(add(scanp, i*ptrSize)) = unsafe.Pointer(up + delta)
}
// rawbyteslice allocates a new byte slice. The byte slice is not zeroed.
func rawbyteslice(size int) (b []byte) {
- cap := goroundupsize(uintptr(size))
+ cap := roundupsize(uintptr(size))
p := mallocgc(cap, nil, flagNoScan|flagNoZero)
if cap != uintptr(size) {
memclr(add(p, uintptr(size)), cap-uintptr(size))
if uintptr(size) > _MaxMem/4 {
throw("out of memory")
}
- mem := goroundupsize(uintptr(size) * 4)
+ mem := roundupsize(uintptr(size) * 4)
p := mallocgc(mem, nil, flagNoScan|flagNoZero)
if mem != uintptr(size)*4 {
memclr(add(p, uintptr(size)*4), mem-uintptr(size)*4)
return len(s) >= len(t) && s[:len(t)] == t
}
-func goatoi(s string) int {
+func atoi(s string) int {
n := 0
for len(s) > 0 && '0' <= s[0] && s[0] <= '9' {
n = n*10 + int(s[0]) - '0'
f2 := (*_func)(unsafe.Pointer(&pclntable[ftab[i+1].funcoff]))
f2name := "end"
if i+1 < nftab {
- f2name = gofuncname(f2)
+ f2name = funcname(f2)
}
- println("function symbol table not sorted by program counter:", hex(ftab[i].entry), gofuncname(f1), ">", hex(ftab[i+1].entry), f2name)
+ println("function symbol table not sorted by program counter:", hex(ftab[i].entry), funcname(f1), ">", hex(ftab[i+1].entry), f2name)
for j := 0; j <= i; j++ {
- print("\t", hex(ftab[j].entry), " ", gofuncname((*_func)(unsafe.Pointer(&pclntable[ftab[j].funcoff]))), "\n")
+ print("\t", hex(ftab[j].entry), " ", funcname((*_func)(unsafe.Pointer(&pclntable[ftab[j].funcoff]))), "\n")
}
throw("invalid runtime symbol table")
}
// Name returns the name of the function.
func (f *Func) Name() string {
- return gofuncname(f.raw())
+ return funcname(f.raw())
}
// Entry returns the entry address of the function.
return -1
}
- print("runtime: invalid pc-encoded table f=", gofuncname(f), " pc=", hex(pc), " targetpc=", hex(targetpc), " tab=", p, "\n")
+ print("runtime: invalid pc-encoded table f=", funcname(f), " pc=", hex(pc), " targetpc=", hex(targetpc), " tab=", p, "\n")
p = pclntable[off:]
pc = f.entry
return -1
}
-func funcname(f *_func) *byte {
+func cfuncname(f *_func) *byte {
if f == nil || f.nameoff == 0 {
return nil
}
return (*byte)(unsafe.Pointer(&pclntable[f.nameoff]))
}
-func gofuncname(f *_func) string {
- return gostringnocopy(funcname(f))
+func funcname(f *_func) string {
+ return gostringnocopy(cfuncname(f))
}
func funcline1(f *_func, targetpc uintptr, strict bool) (file string, line int32) {
fileno := int(pcvalue(f, f.pcfile, targetpc, strict))
line = pcvalue(f, f.pcln, targetpc, strict)
if fileno == -1 || line == -1 || fileno >= len(filetab) {
- // print("looking for ", hex(targetpc), " in ", gofuncname(f), " got file=", fileno, " line=", lineno, "\n")
+ // print("looking for ", hex(targetpc), " in ", funcname(f), " got file=", fileno, " line=", lineno, "\n")
return "?", 0
}
file = gostringnocopy(&pclntable[filetab[fileno]])
// But if callback is set, we're doing a garbage collection and must
// get everything, so crash loudly.
if callback != nil {
- print("runtime: unexpected return pc for ", gofuncname(f), " called from ", hex(frame.lr), "\n")
+ print("runtime: unexpected return pc for ", funcname(f), " called from ", hex(frame.lr), "\n")
throw("unknown caller pc")
}
}
if (n > 0 || flags&_TraceTrap == 0) && frame.pc > f.entry && !waspanic {
tracepc--
}
- print(gofuncname(f), "(")
+ print(funcname(f), "(")
argp := (*[100]uintptr)(unsafe.Pointer(frame.argp))
for i := uintptr(0); i < frame.arglen/ptrSize; i++ {
if i >= 10 {
frame.arglen = uintptr(f.args)
if needArgMap && f.args == _ArgsSizeUnknown {
// Extract argument bitmaps for reflect stubs from the calls they made to reflect.
- switch gofuncname(f) {
+ switch funcname(f) {
case "reflect.makeFuncStub", "reflect.methodValueCall":
arg0 := frame.sp
if usesLR {
}
fn := *(**[2]uintptr)(unsafe.Pointer(arg0))
if fn[0] != f.entry {
- print("runtime: confused by ", gofuncname(f), "\n")
+ print("runtime: confused by ", funcname(f), "\n")
throw("reflect mismatch")
}
bv := (*bitvector)(unsafe.Pointer(fn[1]))
pc := gp.gopc
f := findfunc(pc)
if f != nil && showframe(f, gp) && gp.goid != 1 {
- print("created by ", gofuncname(f), "\n")
+ print("created by ", funcname(f), "\n")
tracepc := pc // back up to CALL instruction for funcline.
if pc > f.entry {
tracepc -= _PCQuantum
return true
}
traceback := gotraceback(nil)
- name := gostringnocopy(funcname(f))
+ name := funcname(f)
// Special case: always show runtime.panic frame, so that we can
// see where a panic started in the middle of a stack trace.