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

runtime: handle 3 and 4 bytes separately in memclrNoHeapPointers? #23930

josharian opened this issue Feb 19, 2018 · 2 comments


None yet
3 participants
Copy link

commented Feb 19, 2018

In memcpy, we separated the 3 and 4 byte cases on amd64 to allow load/store forwarding. Should we do the same in memclrNoHeapPointers? Should we generally audit the two routines to make sure they're in sync as needed, and cross-reference in docs?

Somewhat related: #23306

cc @randall77 @TocarIP

@josharian josharian added this to the Go1.11 milestone Feb 19, 2018


This comment has been minimized.

Copy link

commented Mar 26, 2018

I don't think so. I've tried recreating Issue18740 for memclr, but it proved to be quite difficult, memory is either cleared in bulk before allocation or memclr is inlined into single MOVL. More generally speaking it makes sense to have different implementation of memmove and memclr (at least for larger sizes), due to different memory access pattern. E. g. memmove will trash 2x cache and will stop fitting into uop cache earlier, because it needs 2x uops (extra read per each write)


This comment has been minimized.

Copy link
Contributor Author

commented Mar 28, 2018

Thanks for looking into it, Ilya. Closing.

@josharian josharian closed this Mar 28, 2018

@golang golang locked and limited conversation to collaborators Mar 28, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.