cmd/compile: escape analysis reports that make() is using a non-constant size after inlining with a constant size #47524
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.
Performance
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
What did you expect to see?
translate() inlines into toLower() and resulting toLower() will also inline into it's caller. So in lookup() when toLower() is inlined would expect the capacity of slice created in translate() to be constant and therefore able to be reserved on the stack.
What did you see instead?
make([]byte, 0, cap)
escapes to heap (non-constant size), when it is inlined into lookup().If use a fixed capacity like
make([]byte, 0, 32)
in translate() the slice is always reserved on the stack.The text was updated successfully, but these errors were encountered: