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: implement global new(T) without calling newobject #29691

Open
josharian opened this Issue Jan 11, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@josharian
Copy link
Contributor

josharian commented Jan 11, 2019

package p

var x = new(int)

This generates init code to call newobject (including a write barrier, which I thought wasn't supposed to happen any more?). Instead, we should make a BSS int symbol, and then make x contain a relocation to that symbol.

cc @randall77 @mvdan

@josharian josharian added this to the Go1.13 milestone Jan 11, 2019

@randall77

This comment has been minimized.

Copy link
Contributor

randall77 commented Jan 11, 2019

No, we still need a write barrier when initializing a global location.

The write barriers I changed recently removes them when initializing the contents of the results of a newobject call. Not sure if you're referring to that.

Yes, we can and should allocate the int statically. Small caveat: watch out for #29068.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment