Commit ca360c39 authored by David Chase's avatar David Chase

cmd/compile: better XPos for rematerialized values and JMPs

This attempts to choose better values for values that are
rematerialized (uses the XPos of the consumer, not the
original) and for unconditional branches (uses the last
assigned XPos in the block).

The JMP branches seem to sometimes end up with a PC in the
destination block, I think because of register movement
or rematerialization that gets placed in predecessor blocks.
This may be acceptable because (eyeball-empirically) that is
often the line number of the target block, so the line number
flow is correct.

Added proper test, that checks both -N -l and regular compilation.
The test is also capable (for gdb, delve soon) of tracking
variable printing based on comments in the source code.

There's substantial room for improvement in debugger behavior.

Updates #21098.

Change-Id: I13abd48a39141583b85576a015f561065819afd0
Reviewed-on: https://go-review.googlesource.com/50610
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarKeith Randall <khr@golang.org>
parent da4d740f
......@@ -205,6 +205,12 @@ func buildssa(fn *Node, worker int) *ssa.Func {
s.popLine()
}
for _, b := range s.f.Blocks {
if b.Pos != src.NoXPos {
updateUnsetPredPos(b)
}
}
s.insertPhis()
// Don't carry reference this around longer than necessary
......@@ -215,6 +221,30 @@ func buildssa(fn *Node, worker int) *ssa.Func {
return s.f
}
func updateUnsetPredPos(b *ssa.Block) {
for _, e := range b.Preds {
p := e.Block()
if p.Pos == src.NoXPos && p.Kind == ssa.BlockPlain {
pos := b.Pos
// TODO: This ought to be produce a better result, but it causes
// line 46 ("scanner := bufio.NewScanner(reader)")
// to drop out of gdb-dbg and dlv-dbg debug-next traces for hist.go.
for _, v := range b.Values {
if v.Op == ssa.OpVarDef || v.Op == ssa.OpVarKill || v.Op == ssa.OpVarLive || v.Op == ssa.OpCopy && v.Type == types.TypeMem {
continue
}
if v.Pos != src.NoXPos {
pos = v.Pos
break
}
}
p.Pos = pos
updateUnsetPredPos(p) // We do not expect long chains of these, thus recursion is okay.
}
}
return
}
type state struct {
// configuration (arch) information
config *ssa.Config
......@@ -263,6 +293,8 @@ type state struct {
// line number stack. The current line number is top of stack
line []src.XPos
// the last line number processed; it may have been popped
lastPos src.XPos
// list of panic calls by function name and line number.
// Used to deduplicate panic calls.
......@@ -344,7 +376,14 @@ func (s *state) endBlock() *ssa.Block {
s.defvars[b.ID] = s.vars
s.curBlock = nil
s.vars = nil
b.Pos = s.peekPos()
if len(b.Values) == 0 && b.Kind == ssa.BlockPlain {
// Empty plain blocks get the line of their successor (handled after all blocks created),
// except for increment blocks in For statements (handled in ssa conversion of OFOR),
// and for blocks ending in GOTO/BREAK/CONTINUE.
b.Pos = src.NoXPos
} else {
b.Pos = s.lastPos
}
return b
}
......@@ -357,7 +396,10 @@ func (s *state) pushLine(line src.XPos) {
if Debug['K'] != 0 {
Warn("buildssa: unknown position (line 0)")
}
} else {
s.lastPos = line
}
s.line = append(s.line, line)
}
......@@ -515,8 +557,11 @@ func (s *state) stmtList(l Nodes) {
// stmt converts the statement n to SSA and adds it to s.
func (s *state) stmt(n *Node) {
s.pushLine(n.Pos)
defer s.popLine()
if !(n.Op == OVARKILL || n.Op == OVARLIVE) {
// OVARKILL and OVARLIVE are invisible to the programmer, so we don't use their line numbers to avoid confusion in debugging.
s.pushLine(n.Pos)
defer s.popLine()
}
// If s.curBlock is nil, and n isn't a label (which might have an associated goto somewhere),
// then this code is dead. Stop here.
......@@ -629,6 +674,7 @@ func (s *state) stmt(n *Node) {
}
b := s.endBlock()
b.Pos = s.lastPos // Do this even if b is an empty block.
b.AddEdgeTo(lab.target)
case OAS:
......@@ -805,6 +851,7 @@ func (s *state) stmt(n *Node) {
}
b := s.endBlock()
b.Pos = s.lastPos // Do this even if b is an empty block.
b.AddEdgeTo(to)
case OFOR, OFORUNTIL:
......@@ -870,6 +917,11 @@ func (s *state) stmt(n *Node) {
}
if b := s.endBlock(); b != nil {
b.AddEdgeTo(bCond)
// It can happen that bIncr ends in a block containing only VARKILL,
// and that muddles the debugging experience.
if n.Op != OFORUNTIL && b.Pos == src.NoXPos {
b.Pos = bCond.Pos
}
}
if n.Op == OFORUNTIL {
......@@ -4642,6 +4694,7 @@ type FloatingEQNEJump struct {
func (s *SSAGenState) oneFPJump(b *ssa.Block, jumps *FloatingEQNEJump) {
p := s.Prog(jumps.Jump)
p.To.Type = obj.TYPE_BRANCH
p.Pos = b.Pos
to := jumps.Index
s.Branches = append(s.Branches, Branch{p, b.Succs[to].Block()})
}
......@@ -4658,6 +4711,7 @@ func (s *SSAGenState) FPJump(b, next *ssa.Block, jumps *[2][2]FloatingEQNEJump)
s.oneFPJump(b, &jumps[1][0])
s.oneFPJump(b, &jumps[1][1])
q := s.Prog(obj.AJMP)
q.Pos = b.Pos
q.To.Type = obj.TYPE_BRANCH
s.Branches = append(s.Branches, Branch{q, b.Succs[1].Block()})
}
......
This diff is collapsed.
......@@ -488,7 +488,7 @@ func (s *regAllocState) allocValToReg(v *Value, mask regMask, nospill bool, pos
c = s.curBlock.NewValue1(pos, OpCopy, v.Type, s.regs[r2].c)
} else if v.rematerializeable() {
// Rematerialize instead of loading from the spill location.
c = v.copyIntoNoXPos(s.curBlock)
c = v.copyIntoWithXPos(s.curBlock, pos)
} else {
// Load v from its spill location.
spill := s.makeSpill(v, s.curBlock)
......@@ -2000,7 +2000,7 @@ func (e *edgeState) processDest(loc Location, vid ID, splice **Value, pos src.XP
// register to accomplish this.
r := e.findRegFor(v.Type)
e.erase(r)
x = v.copyIntoNoXPos(e.p)
x = v.copyIntoWithXPos(e.p, pos)
e.set(r, vid, x, false, pos)
// Make sure we spill with the size of the slot, not the
// size of x (which might be wider due to our dropping
......
./testdata/hist.go
35: func main() {
36: hist := make([]int, 100)
37: var reader io.Reader = strings.NewReader(cannedInput) //gdb-dbg=(hist/A,cannedInput/A)
38: if len(os.Args) > 1 {
43: return
47: for scanner.Scan() {
48: s := scanner.Text()
49: i, err := strconv.ParseInt(s, 10, 64)
50: if err != nil { //gdb-dbg=(i)
54: hist = ensure(int(i), hist)
55: hist[int(i)]++
47: for scanner.Scan() {
48: s := scanner.Text()
49: i, err := strconv.ParseInt(s, 10, 64)
50: if err != nil { //gdb-dbg=(i)
54: hist = ensure(int(i), hist)
55: hist[int(i)]++
47: for scanner.Scan() {
48: s := scanner.Text()
49: i, err := strconv.ParseInt(s, 10, 64)
50: if err != nil { //gdb-dbg=(i)
54: hist = ensure(int(i), hist)
55: hist[int(i)]++
47: for scanner.Scan() {
48: s := scanner.Text()
49: i, err := strconv.ParseInt(s, 10, 64)
50: if err != nil { //gdb-dbg=(i)
54: hist = ensure(int(i), hist)
55: hist[int(i)]++
47: for scanner.Scan() {
48: s := scanner.Text()
49: i, err := strconv.ParseInt(s, 10, 64)
50: if err != nil { //gdb-dbg=(i)
54: hist = ensure(int(i), hist)
55: hist[int(i)]++
47: for scanner.Scan() {
48: s := scanner.Text()
49: i, err := strconv.ParseInt(s, 10, 64)
50: if err != nil { //gdb-dbg=(i)
54: hist = ensure(int(i), hist)
55: hist[int(i)]++
47: for scanner.Scan() {
48: s := scanner.Text()
49: i, err := strconv.ParseInt(s, 10, 64)
50: if err != nil { //gdb-dbg=(i)
54: hist = ensure(int(i), hist)
55: hist[int(i)]++
47: for scanner.Scan() {
48: s := scanner.Text()
49: i, err := strconv.ParseInt(s, 10, 64)
50: if err != nil { //gdb-dbg=(i)
54: hist = ensure(int(i), hist)
55: hist[int(i)]++
47: for scanner.Scan() {
48: s := scanner.Text()
49: i, err := strconv.ParseInt(s, 10, 64)
50: if err != nil { //gdb-dbg=(i)
54: hist = ensure(int(i), hist)
55: hist[int(i)]++
47: for scanner.Scan() {
48: s := scanner.Text()
49: i, err := strconv.ParseInt(s, 10, 64)
50: if err != nil { //gdb-dbg=(i)
54: hist = ensure(int(i), hist)
55: hist[int(i)]++
47: for scanner.Scan() {
57: t := 0
58: n := 0
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
63: t += i * a
64: n += a
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
59: for i, a := range hist {
60: if a == 0 {
63: t += i * a
64: n += a
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
63: t += i * a
64: n += a
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
63: t += i * a
64: n += a
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
68: }
/usr/local/google/home/drchase/work/go/src/runtime/proc.go
201: if atomic.Load(&runningPanicDefers) != 0 {
210: if atomic.Load(&panicking) != 0 {
214: exit(0)
/usr/local/google/home/drchase/work/go/src/cmd/compile/internal/ssa/testdata/hist.go
35: func main() {
35: func main() {
36: hist := make([]int, 100)
37: var reader io.Reader = strings.NewReader(cannedInput) //gdb-dbg=(hist/A,cannedInput/A)
$1 = {array = <A>, len = 100, cap = 100}
$2 = <A> "1\n1\n1\n1\n2\n2\n2\n4\n4\n8\n"
38: if len(os.Args) > 1 {
43: return
47: for scanner.Scan() {
48: s := scanner.Text()
49: i, err := strconv.ParseInt(s, 10, 64)
50: if err != nil { //gdb-dbg=(i)
$3 = 1
54: hist = ensure(int(i), hist)
55: hist[int(i)]++
47: for scanner.Scan() {
48: s := scanner.Text()
49: i, err := strconv.ParseInt(s, 10, 64)
50: if err != nil { //gdb-dbg=(i)
$4 = 1
54: hist = ensure(int(i), hist)
55: hist[int(i)]++
47: for scanner.Scan() {
48: s := scanner.Text()
49: i, err := strconv.ParseInt(s, 10, 64)
50: if err != nil { //gdb-dbg=(i)
$5 = 1
54: hist = ensure(int(i), hist)
55: hist[int(i)]++
47: for scanner.Scan() {
48: s := scanner.Text()
49: i, err := strconv.ParseInt(s, 10, 64)
50: if err != nil { //gdb-dbg=(i)
$6 = 1
54: hist = ensure(int(i), hist)
55: hist[int(i)]++
47: for scanner.Scan() {
48: s := scanner.Text()
49: i, err := strconv.ParseInt(s, 10, 64)
50: if err != nil { //gdb-dbg=(i)
$7 = 2
54: hist = ensure(int(i), hist)
55: hist[int(i)]++
47: for scanner.Scan() {
48: s := scanner.Text()
49: i, err := strconv.ParseInt(s, 10, 64)
50: if err != nil { //gdb-dbg=(i)
$8 = 2
54: hist = ensure(int(i), hist)
55: hist[int(i)]++
47: for scanner.Scan() {
48: s := scanner.Text()
49: i, err := strconv.ParseInt(s, 10, 64)
50: if err != nil { //gdb-dbg=(i)
$9 = 2
54: hist = ensure(int(i), hist)
55: hist[int(i)]++
47: for scanner.Scan() {
48: s := scanner.Text()
49: i, err := strconv.ParseInt(s, 10, 64)
50: if err != nil { //gdb-dbg=(i)
$10 = 4
54: hist = ensure(int(i), hist)
55: hist[int(i)]++
47: for scanner.Scan() {
48: s := scanner.Text()
49: i, err := strconv.ParseInt(s, 10, 64)
50: if err != nil { //gdb-dbg=(i)
$11 = 4
54: hist = ensure(int(i), hist)
55: hist[int(i)]++
47: for scanner.Scan() {
48: s := scanner.Text()
49: i, err := strconv.ParseInt(s, 10, 64)
50: if err != nil { //gdb-dbg=(i)
$12 = 8
54: hist = ensure(int(i), hist)
55: hist[int(i)]++
47: for scanner.Scan() {
57: t := 0
58: n := 0
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
63: t += i * a
64: n += a
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
$13 = 4
$14 = 1
$15 = 4
59: for i, a := range hist {
60: if a == 0 {
63: t += i * a
64: n += a
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
$16 = 7
$17 = 2
$18 = 10
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
63: t += i * a
64: n += a
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
$19 = 9
$20 = 4
$21 = 18
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
63: t += i * a
64: n += a
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
$22 = 10
$23 = 8
$24 = 26
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
60: if a == 0 {
61: continue
59: for i, a := range hist {
68: }
/usr/local/google/home/drchase/work/go/src/runtime/proc.go
201: if atomic.Load(&runningPanicDefers) != 0 {
201: if atomic.Load(&runningPanicDefers) != 0 {
210: if atomic.Load(&panicking) != 0 {
214: exit(0)
./testdata/hist.go
35: func main() {
36: hist := make([]int, 100)
37: var reader io.Reader = strings.NewReader(cannedInput) //gdb-dbg=(hist/A,cannedInput/A)
13: "strings"
/usr/local/google/home/drchase/work/go/src/strings/reader.go
150: func NewReader(s string) *Reader { return &Reader{s, 0, -1} }
./testdata/hist.go
38: if len(os.Args) > 1 {
8: "bufio"
/usr/local/google/home/drchase/work/go/src/bufio/scan.go
84: split: ScanLines,
74: MaxScanTokenSize = 64 * 1024
./testdata/hist.go
47: for scanner.Scan() {
47: for scanner.Scan() {
/usr/local/google/home/drchase/work/go/src/bufio/scan.go
107: return string(s.token)
./testdata/hist.go
49: i, err := strconv.ParseInt(s, 10, 64)
50: if err != nil { //gdb-dbg=(i)
54: hist = ensure(int(i), hist)
55: hist[int(i)]++
55: hist[int(i)]++
47: for scanner.Scan() {
/usr/local/google/home/drchase/work/go/src/bufio/scan.go
107: return string(s.token)
./testdata/hist.go
49: i, err := strconv.ParseInt(s, 10, 64)
50: if err != nil { //gdb-dbg=(i)
54: hist = ensure(int(i), hist)
55: hist[int(i)]++
55: hist[int(i)]++
47: for scanner.Scan() {
/usr/local/google/home/drchase/work/go/src/bufio/scan.go
107: return string(s.token)
./testdata/hist.go
49: i, err := strconv.ParseInt(s, 10, 64)
50: if err != nil { //gdb-dbg=(i)
54: hist = ensure(int(i), hist)
55: hist[int(i)]++
55: hist[int(i)]++
47: for scanner.Scan() {
/usr/local/google/home/drchase/work/go/src/bufio/scan.go
107: return string(s.token)
./testdata/hist.go
49: i, err := strconv.ParseInt(s, 10, 64)
50: if err != nil { //gdb-dbg=(i)
54: hist = ensure(int(i), hist)
55: hist[int(i)]++
55: hist[int(i)]++
47: for scanner.Scan() {
/usr/local/google/home/drchase/work/go/src/bufio/scan.go
107: return string(s.token)
./testdata/hist.go
49: i, err := strconv.ParseInt(s, 10, 64)
50: if err != nil { //gdb-dbg=(i)
54: hist = ensure(int(i), hist)
55: hist[int(i)]++
55: hist[int(i)]++
47: for scanner.Scan() {
/usr/local/google/home/drchase/work/go/src/bufio/scan.go
107: return string(s.token)
./testdata/hist.go
49: i, err := strconv.ParseInt(s, 10, 64)
50: if err != nil { //gdb-dbg=(i)
54: hist = ensure(int(i), hist)
55: hist[int(i)]++
55: hist[int(i)]++
47: for scanner.Scan() {
/usr/local/google/home/drchase/work/go/src/bufio/scan.go
107: return string(s.token)
./testdata/hist.go
49: i, err := strconv.ParseInt(s, 10, 64)
50: if err != nil { //gdb-dbg=(i)
54: hist = ensure(int(i), hist)
55: hist[int(i)]++
55: hist[int(i)]++
47: for scanner.Scan() {
/usr/local/google/home/drchase/work/go/src/bufio/scan.go
107: return string(s.token)
./testdata/hist.go
49: i, err := strconv.ParseInt(s, 10, 64)
50: if err != nil { //gdb-dbg=(i)
54: hist = ensure(int(i), hist)
55: hist[int(i)]++
55: hist[int(i)]++
47: for scanner.Scan() {
/usr/local/google/home/drchase/work/go/src/bufio/scan.go
107: return string(s.token)
./testdata/hist.go
49: i, err := strconv.ParseInt(s, 10, 64)
50: if err != nil { //gdb-dbg=(i)
54: hist = ensure(int(i), hist)
55: hist[int(i)]++
55: hist[int(i)]++
47: for scanner.Scan() {
/usr/local/google/home/drchase/work/go/src/bufio/scan.go
107: return string(s.token)
./testdata/hist.go
49: i, err := strconv.ParseInt(s, 10, 64)
50: if err != nil { //gdb-dbg=(i)
54: hist = ensure(int(i), hist)
55: hist[int(i)]++
55: hist[int(i)]++
47: for scanner.Scan() {
59: for i, a := range hist {
60: if a == 0 {
60: if a == 0 {
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
64: n += a
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
63: t += i * a
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
63: t += i * a
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
59: for i, a := range hist {
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
60: if a == 0 {
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
64: n += a
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
63: t += i * a
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
63: t += i * a
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
59: for i, a := range hist {
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
60: if a == 0 {
60: if a == 0 {
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
64: n += a
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
63: t += i * a
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
63: t += i * a
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
59: for i, a := range hist {
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
64: n += a
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
63: t += i * a
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
63: t += i * a
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
59: for i, a := range hist {
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
68: }
/usr/local/google/home/drchase/work/go/src/runtime/proc.go
201: if atomic.Load(&runningPanicDefers) != 0 {
210: if atomic.Load(&panicking) != 0 {
214: exit(0)
/usr/local/google/home/drchase/work/go/src/cmd/compile/internal/ssa/testdata/hist.go
35: func main() {
35: func main() {
36: hist := make([]int, 100)
37: var reader io.Reader = strings.NewReader(cannedInput) //gdb-dbg=(hist/A,cannedInput/A)
13: "strings"
150: func NewReader(s string) *Reader { return &Reader{s, 0, -1} }
38: if len(os.Args) > 1 {
8: "bufio"
84: split: ScanLines,
74: MaxScanTokenSize = 64 * 1024
47: for scanner.Scan() {
107: return string(s.token)
49: i, err := strconv.ParseInt(s, 10, 64)
50: if err != nil { //gdb-dbg=(i)
54: hist = ensure(int(i), hist)
55: hist[int(i)]++
47: for scanner.Scan() {
107: return string(s.token)
49: i, err := strconv.ParseInt(s, 10, 64)
50: if err != nil { //gdb-dbg=(i)
54: hist = ensure(int(i), hist)
55: hist[int(i)]++
47: for scanner.Scan() {
107: return string(s.token)
49: i, err := strconv.ParseInt(s, 10, 64)
50: if err != nil { //gdb-dbg=(i)
54: hist = ensure(int(i), hist)
55: hist[int(i)]++
47: for scanner.Scan() {
107: return string(s.token)
49: i, err := strconv.ParseInt(s, 10, 64)
50: if err != nil { //gdb-dbg=(i)
54: hist = ensure(int(i), hist)
55: hist[int(i)]++
47: for scanner.Scan() {
107: return string(s.token)
49: i, err := strconv.ParseInt(s, 10, 64)
50: if err != nil { //gdb-dbg=(i)
54: hist = ensure(int(i), hist)
55: hist[int(i)]++
47: for scanner.Scan() {
107: return string(s.token)
49: i, err := strconv.ParseInt(s, 10, 64)
50: if err != nil { //gdb-dbg=(i)
54: hist = ensure(int(i), hist)
55: hist[int(i)]++
47: for scanner.Scan() {
107: return string(s.token)
49: i, err := strconv.ParseInt(s, 10, 64)
50: if err != nil { //gdb-dbg=(i)
54: hist = ensure(int(i), hist)
55: hist[int(i)]++
47: for scanner.Scan() {
107: return string(s.token)
49: i, err := strconv.ParseInt(s, 10, 64)
50: if err != nil { //gdb-dbg=(i)
54: hist = ensure(int(i), hist)
55: hist[int(i)]++
47: for scanner.Scan() {
107: return string(s.token)
49: i, err := strconv.ParseInt(s, 10, 64)
50: if err != nil { //gdb-dbg=(i)
54: hist = ensure(int(i), hist)
55: hist[int(i)]++
47: for scanner.Scan() {
107: return string(s.token)
49: i, err := strconv.ParseInt(s, 10, 64)
50: if err != nil { //gdb-dbg=(i)
54: hist = ensure(int(i), hist)
55: hist[int(i)]++
47: for scanner.Scan() {
59: for i, a := range hist {
60: if a == 0 {
60: if a == 0 {
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
64: n += a
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
63: t += i * a
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
63: t += i * a
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
59: for i, a := range hist {
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
60: if a == 0 {
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
64: n += a
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
63: t += i * a
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
63: t += i * a
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
59: for i, a := range hist {
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
60: if a == 0 {
60: if a == 0 {
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
64: n += a
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
63: t += i * a
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
63: t += i * a
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
59: for i, a := range hist {
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
64: n += a
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
63: t += i * a
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
63: t += i * a
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
59: for i, a := range hist {
65: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
60: if a == 0 {
68: }
/usr/local/google/home/drchase/work/go/src/runtime/proc.go
201: if atomic.Load(&runningPanicDefers) != 0 {
201: if atomic.Load(&runningPanicDefers) != 0 {
210: if atomic.Load(&panicking) != 0 {
214: exit(0)
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"bufio"
"fmt"
"io"
"os"
"strconv"
"strings"
)
func ensure(n int, sl []int) []int {
for len(sl) <= n {
sl = append(sl, 0)
}
return sl
}
var cannedInput string = `1
1
1
1
2
2
2
4
4
8
`
func main() {
hist := make([]int, 100)
var reader io.Reader = strings.NewReader(cannedInput) //gdb-dbg=(hist/A,cannedInput/A)
if len(os.Args) > 1 {
var err error
reader, err = os.Open(os.Args[1])
if err != nil {
fmt.Fprintf(os.Stderr, "There was an error opening %s: %v\n", os.Args[1], err)
return
}
}
scanner := bufio.NewScanner(reader)
for scanner.Scan() {
s := scanner.Text()
i, err := strconv.ParseInt(s, 10, 64)
if err != nil { //gdb-dbg=(i)
fmt.Fprintf(os.Stderr, "There was an error: %v\n", err)
return
}
hist = ensure(int(i), hist)
hist[int(i)]++
}
t := 0
n := 0
for i, a := range hist {
if a == 0 {
continue
}
t += i * a
n += a
fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
}
}
......@@ -240,7 +240,13 @@ func (v *Value) copyInto(b *Block) *Value {
// The copied value receives no source code position to avoid confusing changes
// in debugger information (the intended user is the register allocator).
func (v *Value) copyIntoNoXPos(b *Block) *Value {
c := b.NewValue0(src.NoXPos, v.Op, v.Type) // Lose the position, this causes line number churn otherwise.
return v.copyIntoWithXPos(b, src.NoXPos)
}
// copyIntoWithXPos makes a new value identical to v and adds it to the end of b.
// The supplied position is used as the position of the new value.
func (v *Value) copyIntoWithXPos(b *Block, pos src.XPos) *Value {
c := b.NewValue0(pos, v.Op, v.Type)
c.Aux = v.Aux
c.AuxInt = v.AuxInt
c.AddArgs(v.Args...)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment