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: use cheaper runtime.writeBarrier check #15245

Closed
josharian opened this issue Apr 12, 2016 · 3 comments
Closed

cmd/compile: use cheaper runtime.writeBarrier check #15245

josharian opened this issue Apr 12, 2016 · 3 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. Performance release-blocker
Milestone

Comments

@josharian
Copy link
Contributor

The pre-SSA backend checked the value of runtime.writeBarrier with:

CMPB    runtime.writeBarrier(SB), $0
JNE $0, 167

The SSA backend uses:

MOVL    runtime.writeBarrier(SB), AX
TESTB   AL, AL
JNE $0, 168

The old version is one instruction and one byte shorter and does not use a register.

I tried and failed to use the old check in CL 21817. Generating flags directly from memory does not play nicely with how we currently handle flags; see Keith's comments.

This issue is so that we don't forget, and to discuss alternative approaches.

@josharian josharian added this to the Unplanned milestone Apr 12, 2016
@randall77
Copy link
Contributor

Possibly add a new SSA block, WBEnabled, which acts like an If block but takes a memory instead of a flag as its input. It can generate the CMPB $0, runtime.writeBarrier(SB) instruction implicitly (as part of genBlock).

@josharian
Copy link
Contributor Author

Thanks. Once @aclements has indicated what direction he'd like to take on #14921, I'll give that a try.

@gopherbot
Copy link

Change https://golang.org/cl/86035 mentions this issue: cmd/compile: implement comparisons directly with memory

@bradfitz bradfitz modified the milestones: Unplanned, Go1.11 Jan 4, 2018
@bradfitz bradfitz added NeedsFix The path to resolution is known, but the work has not been done. release-blocker labels Jan 4, 2018
@golang golang locked and limited conversation to collaborators Feb 26, 2019
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 release-blocker
Projects
None yet
Development

No branches or pull requests

4 participants