diff options
Diffstat (limited to 'src/cmd/internal/obj/pcln.go')
| -rw-r--r-- | src/cmd/internal/obj/pcln.go | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/cmd/internal/obj/pcln.go b/src/cmd/internal/obj/pcln.go index 9770c96fcc..b1536eb224 100644 --- a/src/cmd/internal/obj/pcln.go +++ b/src/cmd/internal/obj/pcln.go @@ -64,7 +64,7 @@ func funcpctab(ctxt *Link, dst *Pcdata, func_ *LSym, desc string, valfunc func(* if val == oldval && started != 0 { val = valfunc(ctxt, func_, val, p, 1, arg) if ctxt.Debugpcln != 0 { - fmt.Fprintf(ctxt.Bso, "%6x %6s %v\n", uint64(int64(p.Pc)), "", p) + fmt.Fprintf(ctxt.Bso, "%6x %6s %v\n", uint64(p.Pc), "", p) } continue } @@ -76,7 +76,7 @@ func funcpctab(ctxt *Link, dst *Pcdata, func_ *LSym, desc string, valfunc func(* if p.Link != nil && p.Link.Pc == p.Pc { val = valfunc(ctxt, func_, val, p, 1, arg) if ctxt.Debugpcln != 0 { - fmt.Fprintf(ctxt.Bso, "%6x %6s %v\n", uint64(int64(p.Pc)), "", p) + fmt.Fprintf(ctxt.Bso, "%6x %6s %v\n", uint64(p.Pc), "", p) } continue } @@ -96,11 +96,11 @@ func funcpctab(ctxt *Link, dst *Pcdata, func_ *LSym, desc string, valfunc func(* // where the 0x80 bit indicates that the integer continues. if ctxt.Debugpcln != 0 { - fmt.Fprintf(ctxt.Bso, "%6x %6d %v\n", uint64(int64(p.Pc)), val, p) + fmt.Fprintf(ctxt.Bso, "%6x %6d %v\n", uint64(p.Pc), val, p) } if started != 0 { - addvarint(ctxt, dst, uint32((p.Pc-pc)/int64(ctxt.Arch.Minlc))) + addvarint(ctxt, dst, uint32((p.Pc-pc)/int64(ctxt.Arch.MinLC))) pc = p.Pc } @@ -118,9 +118,9 @@ func funcpctab(ctxt *Link, dst *Pcdata, func_ *LSym, desc string, valfunc func(* if started != 0 { if ctxt.Debugpcln != 0 { - fmt.Fprintf(ctxt.Bso, "%6x done\n", uint64(int64(func_.Text.Pc)+func_.Size)) + fmt.Fprintf(ctxt.Bso, "%6x done\n", uint64(func_.Text.Pc+func_.Size)) } - addvarint(ctxt, dst, uint32((func_.Size-pc)/int64(ctxt.Arch.Minlc))) + addvarint(ctxt, dst, uint32((func_.Size-pc)/int64(ctxt.Arch.MinLC))) addvarint(ctxt, dst, 0) // terminator } @@ -158,19 +158,18 @@ func pctofileline(ctxt *Link, sym *LSym, oldval int32, p *Prog, phase int32, arg return int32(pcln.Lastindex) } - var i int32 - for i = 0; i < int32(len(pcln.File)); i++ { - file := pcln.File[i] + for i, file := range pcln.File { if file == f { pcln.Lastfile = f - pcln.Lastindex = int(i) + pcln.Lastindex = i return int32(i) } } + i := len(pcln.File) pcln.File = append(pcln.File, f) pcln.Lastfile = f - pcln.Lastindex = int(i) - return i + pcln.Lastindex = i + return int32(i) } // pctospadj computes the sp adjustment in effect. |
