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: don't mark heap-shadowed variables live #18904

Closed
randall77 opened this issue Feb 2, 2017 · 1 comment
Closed

cmd/compile: don't mark heap-shadowed variables live #18904

randall77 opened this issue Feb 2, 2017 · 1 comment
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. Performance
Milestone

Comments

@randall77
Copy link
Contributor

func f(x *int) (t *int) {
	defer func() {}()
	t = x
	sink = &t
	return
}

var sink **int

Because t escapes, we need to allocate it on the heap. What happens to the stack copy in f's arg area?
Currently, we zero the stack copy at the start of the function, and mark that value as live throughout the function. That's safe, but probably better to mark it dead throughout the function (except during the post deferreturn code which copies the values back to the stack?) and then not bother zeroing it.

@rsc

@randall77 randall77 added this to the Go1.9Maybe milestone Feb 2, 2017
@bradfitz bradfitz added the NeedsFix The path to resolution is known, but the work has not been done. label Jul 20, 2017
@bradfitz bradfitz modified the milestones: Go1.10, Go1.9Maybe Jul 20, 2017
@cherrymui
Copy link
Member

Seems we are not generating the zeroing now. CL https://go-review.googlesource.com/c/go/+/38133 fixes this.

@golang golang locked and limited conversation to collaborators Nov 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. Performance
Projects
None yet
Development

No branches or pull requests

4 participants