1
0
mirror of https://github.com/golang/go synced 2024-11-05 11:56:12 -07:00

cmd/compile, runtime: stop padding stackmaps to 4 bytes

Shrinks cmd/go's text segment by 0.9%.

   text	   data	    bss	    dec	    hex	filename
6447148	 231643	 146328	6825119	 68249f	go.before
6387404	 231643	 146328	6765375	 673b3f	go.after

Change-Id: I431e8482dbb11a7c1c77f2196cada43d5dad2981
Reviewed-on: https://go-review.googlesource.com/30817
Reviewed-by: Austin Clements <austin@google.com>
This commit is contained in:
Matthew Dempsky 2016-10-11 11:34:20 -07:00
parent 943f5afe22
commit 303b69feb7
2 changed files with 4 additions and 8 deletions

View File

@ -272,14 +272,10 @@ func duintptr(s *Sym, off int, v uint64) int {
}
func dbvec(s *Sym, off int, bv bvec) int {
for j := 0; int32(j) < bv.n; j += 32 {
// Runtime reads the bitmaps as byte arrays. Oblige.
for j := 0; int32(j) < bv.n; j += 8 {
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))
off = duint8(s, off, uint8(word>>(uint(j)%32)))
}
return off
}

View File

@ -603,5 +603,5 @@ func stackmapdata(stkmap *stackmap, n int32) bitvector {
if n < 0 || n >= stkmap.n {
throw("stackmapdata: index out of range")
}
return bitvector{stkmap.nbit, (*byte)(add(unsafe.Pointer(&stkmap.bytedata), uintptr(n*((stkmap.nbit+31)/32*4))))}
return bitvector{stkmap.nbit, (*byte)(add(unsafe.Pointer(&stkmap.bytedata), uintptr(n*((stkmap.nbit+7)/8))))}
}