Commit 303b69fe authored by Matthew Dempsky's avatar Matthew Dempsky

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/30817Reviewed-by: default avatarAustin Clements <austin@google.com>
parent 943f5afe
...@@ -272,14 +272,10 @@ func duintptr(s *Sym, off int, v uint64) int { ...@@ -272,14 +272,10 @@ func duintptr(s *Sym, off int, v uint64) int {
} }
func dbvec(s *Sym, off int, bv bvec) 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] word := bv.b[j/32]
off = duint8(s, off, uint8(word>>(uint(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 return off
} }
......
...@@ -603,5 +603,5 @@ func stackmapdata(stkmap *stackmap, n int32) bitvector { ...@@ -603,5 +603,5 @@ func stackmapdata(stkmap *stackmap, n int32) bitvector {
if n < 0 || n >= stkmap.n { if n < 0 || n >= stkmap.n {
throw("stackmapdata: index out of range") 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))))}
} }
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