mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: make expandCalls preserve types of pointer stores
This is accomplished by checking for simple stores of pointer types and leaving them alone. The failure case was when a *mspan (not in heap) stored type was replaced by unsafe.Pointer. Updates #40724. Change-Id: I529e1705bf58fb0e64e60d48fd550b3a407e57e7 Reviewed-on: https://go-review.googlesource.com/c/go/+/305672 Trust: David Chase <drchase@google.com> Run-TryBot: David Chase <drchase@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
parent
c847932804
commit
ca3aefc4a9
2 changed files with 7 additions and 1 deletions
|
|
@ -1114,6 +1114,9 @@ func expandCalls(f *Func) {
|
||||||
for _, v := range b.Values {
|
for _, v := range b.Values {
|
||||||
if v.Op == OpStore {
|
if v.Op == OpStore {
|
||||||
t := v.Aux.(*types.Type)
|
t := v.Aux.(*types.Type)
|
||||||
|
if t.IsPtrShaped() { // Everything already fits, and this ensures pointer type properties aren't discarded (e.g, notinheap)
|
||||||
|
continue
|
||||||
|
}
|
||||||
source := v.Args[1]
|
source := v.Args[1]
|
||||||
tSrc := source.Type
|
tSrc := source.Type
|
||||||
iAEATt := x.isAlreadyExpandedAggregateType(t)
|
iAEATt := x.isAlreadyExpandedAggregateType(t)
|
||||||
|
|
@ -1422,7 +1425,7 @@ func (x *expandState) newArgToMemOrRegs(baseArg, toReplace *Value, offset int64,
|
||||||
if x.debug {
|
if x.debug {
|
||||||
x.indent(3)
|
x.indent(3)
|
||||||
defer x.indent(-3)
|
defer x.indent(-3)
|
||||||
x.Printf("newArgToMemOrRegs(base=%s; toReplace=%s; t=%s; memOff=%d; regOff=%d)\n", baseArg.String(), toReplace.LongString(), t, offset, regOffset)
|
x.Printf("newArgToMemOrRegs(base=%s; toReplace=%s; t=%s; memOff=%d; regOff=%d)\n", baseArg.String(), toReplace.LongString(), t.String(), offset, regOffset)
|
||||||
}
|
}
|
||||||
key := selKey{baseArg, offset, t.Width, t}
|
key := selKey{baseArg, offset, t.Width, t}
|
||||||
w := x.commonArgs[key]
|
w := x.commonArgs[key]
|
||||||
|
|
|
||||||
|
|
@ -139,6 +139,9 @@ func (v *Value) AuxArm64BitField() arm64BitField {
|
||||||
|
|
||||||
// long form print. v# = opcode <type> [aux] args [: reg] (names)
|
// long form print. v# = opcode <type> [aux] args [: reg] (names)
|
||||||
func (v *Value) LongString() string {
|
func (v *Value) LongString() string {
|
||||||
|
if v == nil {
|
||||||
|
return "<NIL VALUE>"
|
||||||
|
}
|
||||||
s := fmt.Sprintf("v%d = %s", v.ID, v.Op)
|
s := fmt.Sprintf("v%d = %s", v.ID, v.Op)
|
||||||
s += " <" + v.Type.String() + ">"
|
s += " <" + v.Type.String() + ">"
|
||||||
s += v.auxString()
|
s += v.auxString()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue