mirror of
https://github.com/golang/go
synced 2024-11-17 13:54:46 -07:00
cmd/compile: remove Value.RemoveArg
It's only used in two places: - The one in regalloc.go can be replaced with v.resetArgs() - The one in rewrite.go can be open coded and can cause wrong usage like the bug that CL 358117 fixed. Change-Id: I125baf237db159d056fe4b1c73072331eea4d06a Reviewed-on: https://go-review.googlesource.com/c/go/+/357965 Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
8dbf3e9393
commit
f686f6a963
@ -1840,7 +1840,7 @@ func (s *regAllocState) regalloc(f *Func) {
|
||||
if s.f.pass.debug > regDebug {
|
||||
fmt.Printf("delete copied value %s\n", c.LongString())
|
||||
}
|
||||
c.RemoveArg(0)
|
||||
c.resetArgs()
|
||||
f.freeValue(c)
|
||||
delete(s.copies, c)
|
||||
progress = true
|
||||
|
@ -816,7 +816,11 @@ func devirtLECall(v *Value, sym *obj.LSym) *Value {
|
||||
v.Op = OpStaticLECall
|
||||
auxcall := v.Aux.(*AuxCall)
|
||||
auxcall.Fn = sym
|
||||
v.RemoveArg(0)
|
||||
// Remove first arg
|
||||
v.Args[0].Uses--
|
||||
copy(v.Args[0:], v.Args[1:])
|
||||
v.Args[len(v.Args)-1] = nil // aid GC
|
||||
v.Args = v.Args[:len(v.Args)-1]
|
||||
return v
|
||||
}
|
||||
|
||||
|
@ -302,12 +302,6 @@ func (v *Value) SetArg(i int, w *Value) {
|
||||
v.Args[i] = w
|
||||
w.Uses++
|
||||
}
|
||||
func (v *Value) RemoveArg(i int) {
|
||||
v.Args[i].Uses--
|
||||
copy(v.Args[i:], v.Args[i+1:])
|
||||
v.Args[len(v.Args)-1] = nil // aid GC
|
||||
v.Args = v.Args[:len(v.Args)-1]
|
||||
}
|
||||
func (v *Value) SetArgs1(a *Value) {
|
||||
v.resetArgs()
|
||||
v.AddArg(a)
|
||||
|
Loading…
Reference in New Issue
Block a user