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

Open
josharian opened this issue Jan 11, 2019 · 5 comments
Open

cmd/compile: implement global new(T) without calling newobject #29691

josharian opened this issue Jan 11, 2019 · 5 comments
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsFix The path to resolution is known, but the work has not been done. Performance
Milestone

Comments

@josharian
Copy link
Contributor

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 Performance NeedsFix The path to resolution is known, but the work has not been done. labels Jan 11, 2019
@josharian josharian added this to the Go1.13 milestone Jan 11, 2019
@randall77
Copy link
Contributor

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.

@Skarlso
Copy link
Contributor

Skarlso commented Feb 27, 2019

Hi @josharian! Can I help?

@josharian
Copy link
Contributor Author

Go for it. You'll be looking at sinit.go. It's not particularly clear code, even by compiler standards. I recommend writing yourself a few simplified examples to work off of.

@Skarlso
Copy link
Contributor

Skarlso commented Feb 27, 2019

Sounds lovely. :D But at least I'll learn while trying to figure it out. Which is always good. :)

@Skarlso
Copy link
Contributor

Skarlso commented Mar 17, 2019

Picking this up now. Sorry, was pre-occupied with another issue on packages. :)

@andybons andybons modified the milestones: Go1.13, Go1.14 Jul 8, 2019
@rsc rsc modified the milestones: Go1.14, Backlog Oct 9, 2019
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jul 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsFix The path to resolution is known, but the work has not been done. Performance
Projects
Status: Triage Backlog
Development

No branches or pull requests

6 participants