cmd/link: make Pciter more idiomatic

Rename it to PCIter and convert it to use methods.

Set pcscale once, during construction, to make call sites clearer.

Change some ints to bools.

Use a simple iteration termination condition,
instead of the cap comparison from the c2go translation.

Instead of requiring a Pcdata, which requires one caller
to synthesize a fake Pcdata, just ask for a byte slice.

Passes toolstash-check.

Change-Id: I811da0e929cf4a806bd6d70357ccf2911cd0c737
Reviewed-on: https://go-review.googlesource.com/c/go/+/171770
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Josh Bleecher Snyder 2019-04-12 13:06:52 -07:00
parent 134ef176f0
commit 6d64dd731b
4 changed files with 53 additions and 47 deletions

View file

@ -2112,9 +2112,9 @@ func stkcheck(ctxt *Link, up *chain, depth int) int {
endr := len(s.R)
var ch1 chain
var pcsp Pciter
pcsp := newPCIter(ctxt)
var r *sym.Reloc
for pciterinit(ctxt, &pcsp, &s.FuncInfo.Pcsp); pcsp.done == 0; pciternext(&pcsp) {
for pcsp.init(s.FuncInfo.Pcsp.P); !pcsp.done; pcsp.next() {
// pcsp.value is in effect for [pcsp.pc, pcsp.nextpc).
// Check stack size in effect for this span.