Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compile: do not escape pure value type on dottype2 conversion #15796

Closed
tshprecher opened this issue May 23, 2016 · 2 comments
Closed

cmd/compile: do not escape pure value type on dottype2 conversion #15796

tshprecher opened this issue May 23, 2016 · 2 comments
Milestone

Comments

@tshprecher
Copy link
Contributor

  1. What version of Go are you using (go version)?

    go version devel +cdcb827 Wed May 18 04:43:32 2016 +0000 darwin/amd64

  2. What operating system and processor architecture are you using (go env)?

    GOARCH="amd64"
    GOBIN=""
    GOEXE=""
    GOHOSTARCH="amd64"
    GOHOSTOS="darwin"
    GOOS="darwin"
    GOPATH="/Users/tshprecher/Workspace/go"
    GORACE=""
    GOROOT="/Users/tshprecher/Workspace/golang"
    GOTOOLDIR="/Users/tshprecher/Workspace/golang/pkg/tool/darwin_amd64"
    CC="clang"
    GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -gno-record-gcc-switches -fno-common"
    CXX="clang++"
    CGO_ENABLED="1"

  3. What did you do?

    This is a followup to runtime: scalability problem with allocation #13805. I made this fix for the ODOTTYPE node type, but not for ODOTTYPE2.

    input:

    package p
    
    func setPointer(p *int, v interface{}) {
        *p, _ = v.(int)
    }
    
    func main() {
        var i int
        setPointer(&i, 1)
    }
    
  4. What did you expect to see?

    dottype_esc.go:9: main 1 does not escape

  5. What did you see instead?

    dottype_esc.go:9: 1 escapes to heap

@ianlancetaylor ianlancetaylor added this to the Go1.8 milestone May 24, 2016
@tshprecher
Copy link
Contributor Author

sent out for review. complete output for 'go tool compile -m' on the example input above:

dottype_esc.go:3: can inline setPointer
dottype_esc.go:7: can inline main
dottype_esc.go:9: inlining call to setPointer
dottype_esc.go:3: setPointer p does not escape
dottype_esc.go:3: setPointer v does not escape
dottype_esc.go:9: main &i does not escape
dottype_esc.go:9: main 1 does not escape

The int does not escape anymore.

@gopherbot
Copy link

CL https://golang.org/cl/24906 mentions this issue.

@golang golang locked and limited conversation to collaborators Oct 10, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants