cmd/compile: Inaccurate AuxInt value for newobject call #68631
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Go version
go version go1.23rc2 linux/arm64
Output of
go env
in your module/workspace:What did you do?
When I look at the call to
runtime.newobject
in SSA, it looks like the AuxInt value is inaccurate.I think It is larger than expected. In addition, the value is larger in ARM64 than in AMD64.
My test code
temp.go
:Build, dump SSA and view assembly code:
ARM64(SSA dump in
before insert phis
phase):ARM64(assembly code):
AMD64(SSA dump in
before insert phis
phase):AMD64(assembly code):
In ARM64:
The
newobject
's AuxInt is 24. The test1's AuxInt is 8. Note thetest1
function that has only one input parameter and one return value.The stack space of the
main
function uses 48 bytes.In AMD64:
The
newobject
's AuxInt is 16. Thetest1
's AuxInt is 8.The stack space of the
main
function uses 24 bytes (0x10 + 8).The
StaticLECall
ingo/src/cmd/compile/internal/ssa/_gen/genericOps.go
Line 436 in 30b6fd6
Here, AuxInt indicates the size of the input parameter, but it is not specified whether the mem parameter is included. It is suspected that the mem parameter is not included.
The
auxCallOff
ingo/src/cmd/compile/internal/ssa/op.go
Line 365 in 30b6fd6
Here, AuxInt indicates includes the size of the input and output parameters?
The runtime call newobject may emit at (*state).newObject at
go/src/cmd/compile/internal/ssagen/ssa.go
Line 713 in 30b6fd6
In this way, it call
(*state).rtcall
atgo/src/cmd/compile/internal/ssagen/ssa.go
Line 5941 in 30b6fd6
AuxInt appears to be the sum of the size of the input and output parameters and
FixedFrameSize
.The common call test1 may emit at (*state).call at
go/src/cmd/compile/internal/ssagen/ssa.go
Line 5353 in 30b6fd6
In this way, AuxInt mostly equal to
(*ABIParamResultInfo).ArgWidth()
, This should be the size of the stack space to be used when calling. The space includes the spill space of the register transfer parameter, and the space on the stack of the input and output parameters of the stack transfer parameter.So, I've got a lot of explanations for AuxInt of this situation and I'm confused.
From the main function assembly, I think the space used on the stack is larger than what is actually needed.
The gray areas that are marked here are what I consider to be unused space.
For other functions that use the
(*state).rtcall
, the situation may be similar.This should have happened in previous versions of go.
I haven't been able to find out if anyone else has had the same problem.
Thank you for your reading.
My understanding may be incorrect, please point it out, thanks.
What did you see happen?
The caller's stack space used by newobject is larger than my expected. It's AuxInt is inaccurate?
What did you expect to see?
More precise AuxInt of newobject and other runtime calls?
The text was updated successfully, but these errors were encountered: