mirror of
https://github.com/golang/go
synced 2024-09-05 07:54:46 +00:00
cmd/compile: refactor stackmap dumping code
Also, fix a byte-ordering problem with stack maps for assembly function signatures on big-endian targets. Change-Id: I6e8698f5fbb04b31771a65f4a8f3f9c045ff3c98 Reviewed-on: https://go-review.googlesource.com/30816 Reviewed-by: Austin Clements <austin@google.com>
This commit is contained in:
parent
15817e409b
commit
943f5afe22
|
@ -271,6 +271,19 @@ func duintptr(s *Sym, off int, v uint64) int {
|
|||
return duintxx(s, off, v, Widthptr)
|
||||
}
|
||||
|
||||
func dbvec(s *Sym, off int, bv bvec) int {
|
||||
for j := 0; int32(j) < bv.n; j += 32 {
|
||||
word := bv.b[j/32]
|
||||
|
||||
// Runtime reads the bitmaps as byte arrays. Oblige.
|
||||
off = duint8(s, off, uint8(word))
|
||||
off = duint8(s, off, uint8(word>>8))
|
||||
off = duint8(s, off, uint8(word>>16))
|
||||
off = duint8(s, off, uint8(word>>24))
|
||||
}
|
||||
return off
|
||||
}
|
||||
|
||||
// stringConstantSyms holds the pair of symbols we create for a
|
||||
// constant string.
|
||||
type stringConstantSyms struct {
|
||||
|
|
|
@ -157,15 +157,11 @@ func emitptrargsmap() {
|
|||
onebitwalktype1(Curfn.Type.Params(), &xoffset, bv)
|
||||
}
|
||||
|
||||
for j := 0; int32(j) < bv.n; j += 32 {
|
||||
off = duint32(sym, off, bv.b[j/32])
|
||||
}
|
||||
off = dbvec(sym, off, bv)
|
||||
if Curfn.Type.Results().NumFields() > 0 {
|
||||
xoffset = 0
|
||||
onebitwalktype1(Curfn.Type.Results(), &xoffset, bv)
|
||||
for j := 0; int32(j) < bv.n; j += 32 {
|
||||
off = duint32(sym, off, bv.b[j/32])
|
||||
}
|
||||
off = dbvec(sym, off, bv)
|
||||
}
|
||||
|
||||
ggloblsym(sym, int32(off), obj.RODATA|obj.LOCAL)
|
||||
|
|
|
@ -1666,7 +1666,7 @@ func livenessprintdebug(lv *Liveness) {
|
|||
// Dumps a slice of bitmaps to a symbol as a sequence of uint32 values. The
|
||||
// first word dumped is the total number of bitmaps. The second word is the
|
||||
// length of the bitmaps. All bitmaps are assumed to be of equal length. The
|
||||
// words that are followed are the raw bitmap words.
|
||||
// remaining bytes are the raw bitmaps.
|
||||
func onebitwritesymbol(arr []bvec, sym *Sym) {
|
||||
off := 4 // number of bitmaps, to fill in later
|
||||
off = duint32(sym, off, uint32(arr[0].n)) // number of bits in each bitmap
|
||||
|
@ -1678,16 +1678,7 @@ func onebitwritesymbol(arr []bvec, sym *Sym) {
|
|||
if bv.b == nil {
|
||||
break
|
||||
}
|
||||
for j := 0; int32(j) < bv.n; j += 32 {
|
||||
word := bv.b[j/32]
|
||||
|
||||
// Runtime reads the bitmaps as byte arrays. Oblige.
|
||||
off = duint8(sym, off, uint8(word))
|
||||
|
||||
off = duint8(sym, off, uint8(word>>8))
|
||||
off = duint8(sym, off, uint8(word>>16))
|
||||
off = duint8(sym, off, uint8(word>>24))
|
||||
}
|
||||
off = dbvec(sym, off, bv)
|
||||
}
|
||||
|
||||
duint32(sym, 0, uint32(i)) // number of bitmaps
|
||||
|
|
Loading…
Reference in a new issue