l := todo[len(todo)-1]
todo = todo[:len(todo)-1]
- base := l.derefs
+ derefs := l.derefs
// If l.derefs < 0, then l's address flows to root.
- addressOf := base < 0
+ addressOf := derefs < 0
if addressOf {
// For a flow path like "root = &l; l = x",
// l's address flows to root, but x's does
// not. We recognize this by lower bounding
- // base at 0.
- base = 0
+ // derefs at 0.
+ derefs = 0
// If l's address flows to a non-transient
// location, then l can't be transiently
if l.isName(PPARAM) {
if (logopt.Enabled() || Debug.m >= 2) && !l.escapes {
if Debug.m >= 2 {
- fmt.Printf("%s: parameter %v leaks to %s with derefs=%d:\n", linestr(l.n.Pos), l.n, e.explainLoc(root), base)
+ fmt.Printf("%s: parameter %v leaks to %s with derefs=%d:\n", linestr(l.n.Pos), l.n, e.explainLoc(root), derefs)
}
explanation := e.explainPath(root, l)
if logopt.Enabled() {
logopt.LogOpt(l.n.Pos, "leak", "escape", e.curfn.funcname(),
- fmt.Sprintf("parameter %v leaks to %s with derefs=%d", l.n, e.explainLoc(root), base), explanation)
+ fmt.Sprintf("parameter %v leaks to %s with derefs=%d", l.n, e.explainLoc(root), derefs), explanation)
}
}
- l.leakTo(root, base)
+ l.leakTo(root, derefs)
}
// If l's address flows somewhere that
if edge.src.escapes {
continue
}
- derefs := base + edge.derefs
- if edge.src.walkgen != walkgen || edge.src.derefs > derefs {
+ d := derefs + edge.derefs
+ if edge.src.walkgen != walkgen || edge.src.derefs > d {
edge.src.walkgen = walkgen
- edge.src.derefs = derefs
+ edge.src.derefs = d
edge.src.dst = l
edge.src.dstEdgeIdx = i
todo = append(todo, edge.src)
"strings"
)
-func makePos(base *src.PosBase, line, col uint) src.XPos {
- return Ctxt.PosTable.XPos(src.MakePos(base, line, col))
+func makePos(b *src.PosBase, line, col uint) src.XPos {
+ return Ctxt.PosTable.XPos(src.MakePos(b, line, col))
}
func isSpace(c rune) bool {
if s[0] != '0' {
return
}
- base := s[1]
- if base == 'b' || base == 'B' {
+ radix := s[1]
+ if radix == 'b' || radix == 'B' {
yyerrorv("go1.13", "binary literals")
return
}
- if base == 'o' || base == 'O' {
+ if radix == 'o' || radix == 'O' {
yyerrorv("go1.13", "0o/0O-style octal literals")
return
}
- if lit.Kind != syntax.IntLit && (base == 'x' || base == 'X') {
+ if lit.Kind != syntax.IntLit && (radix == 'x' || radix == 'X') {
yyerrorv("go1.13", "hexadecimal floating-point literals")
}
}
// arr must be an ONAME. slicesym does not modify n.
func slicesym(n, arr *Node, lencap int64) {
s := n.Sym.Linksym()
- base := n.Xoffset
+ off := n.Xoffset
if arr.Op != ONAME {
Fatalf("slicesym non-name arr %v", arr)
}
- s.WriteAddr(Ctxt, base, Widthptr, arr.Sym.Linksym(), arr.Xoffset)
- s.WriteInt(Ctxt, base+sliceLenOffset, Widthptr, lencap)
- s.WriteInt(Ctxt, base+sliceCapOffset, Widthptr, lencap)
+ s.WriteAddr(Ctxt, off, Widthptr, arr.Sym.Linksym(), arr.Xoffset)
+ s.WriteInt(Ctxt, off+sliceLenOffset, Widthptr, lencap)
+ s.WriteInt(Ctxt, off+sliceCapOffset, Widthptr, lencap)
}
// addrsym writes the static address of a to n. a must be an ONAME.
// to do with its offset in the user variable.
func stackOffset(slot ssa.LocalSlot) int32 {
n := slot.N.(*Node)
- var base int64
+ var off int64
switch n.Class() {
case PAUTO:
if Ctxt.FixedFrameSize() == 0 {
- base -= int64(Widthptr)
+ off -= int64(Widthptr)
}
if objabi.Framepointer_enabled || objabi.GOARCH == "arm64" {
// There is a word space for FP on ARM64 even if the frame pointer is disabled
- base -= int64(Widthptr)
+ off -= int64(Widthptr)
}
case PPARAM, PPARAMOUT:
- base += Ctxt.FixedFrameSize()
+ off += Ctxt.FixedFrameSize()
}
- return int32(base + n.Xoffset + slot.Off)
+ return int32(off + n.Xoffset + slot.Off)
}
// createComplexVar builds a single DWARF variable entry and location list.
// less(i) should return a boolean expression. If it evaluates true,
// then cases before i will be tested; otherwise, cases i and later.
//
-// base(i, nif) should setup nif (an OIF node) to test case i. In
+// leaf(i, nif) should setup nif (an OIF node) to test case i. In
// particular, it should set nif.Left and nif.Nbody.
-func binarySearch(n int, out *Nodes, less func(i int) *Node, base func(i int, nif *Node)) {
+func binarySearch(n int, out *Nodes, less func(i int) *Node, leaf func(i int, nif *Node)) {
const binarySearchMin = 4 // minimum number of cases for binary search
var do func(lo, hi int, out *Nodes)
if n < binarySearchMin {
for i := lo; i < hi; i++ {
nif := nod(OIF, nil, nil)
- base(i, nif)
+ leaf(i, nif)
lineno = lineno.WithNotStmt()
nif.Left = typecheck(nif.Left, ctxExpr)
nif.Left = defaultlit(nif.Left, nil)
// Since r->left may be mutated by typechecking, check it explicitly
// first to track it correctly.
n.Left.Left = typecheck(n.Left.Left, ctxExpr)
- base := n.Left.Left
+ sbase := n.Left.Left
n.Left = typecheck(n.Left, ctxExpr)
if n.Left.Type == nil {
return 0
}
- // Sum offsets for dots until we reach base.
+ // Sum offsets for dots until we reach sbase.
var v int64
- for r := n.Left; r != base; r = r.Left {
+ for r := n.Left; r != sbase; r = r.Left {
switch r.Op {
case ODOTPTR:
// For Offsetof(s.f), s may itself be a pointer,
// but accessing f must not otherwise involve
// indirection via embedded pointer types.
- if r.Left != base {
+ if r.Left != sbase {
yyerror("invalid expression %v: selector implies indirection of embedded %v", n, r.Left)
return 0
}