From: Josh Bleecher Snyder Date: Tue, 11 Apr 2017 14:44:33 +0000 (-0700) Subject: cmd/internal/obj/arm64: don't immediate dereference new prog X-Git-Tag: go1.9beta1~746 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=2122fc6358c926846ea70c8497f94f9b8c8a49c3;p=gostls13.git cmd/internal/obj/arm64: don't immediate dereference new prog Noticed by Cherry while reviewing CL 40252. The alternative to this is to place t on the stack, like t := obj.Prog{Ctxt: ctxt} However, there are only a couple of places where we manually construct Progs, which is useful. This isn't hot enough code to warrant breaking abstraction layers to avoid an allocation. Passes toolstash-check. Change-Id: I46c79090b60641c90ee977b750ba5c708aca8ecf Reviewed-on: https://go-review.googlesource.com/40373 Run-TryBot: Josh Bleecher Snyder Reviewed-by: Cherry Zhang TryBot-Result: Gobot Gobot --- diff --git a/src/cmd/internal/obj/arm64/asm7.go b/src/cmd/internal/obj/arm64/asm7.go index 40f124d75f..b9529dd163 100644 --- a/src/cmd/internal/obj/arm64/asm7.go +++ b/src/cmd/internal/obj/arm64/asm7.go @@ -732,7 +732,7 @@ func (c *ctxt7) flushpool(p *obj.Prog, skip int) { func (c *ctxt7) addpool(p *obj.Prog, a *obj.Addr) { cls := c.aclass(a) lit := c.instoffset - t := *c.newprog() + t := c.newprog() t.As = AWORD sz := 4 @@ -804,7 +804,7 @@ func (c *ctxt7) addpool(p *obj.Prog, a *obj.Addr) { } q := c.newprog() - *q = t + *q = *t q.Pc = int64(c.pool.size) if c.blitrl == nil { c.blitrl = q