-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/compile: for small objects, use constants directly instead of copying from statictmp #21561
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
Comments
We do this a few places already. IIRC, the cutoff we have used for "up to some small constant in size" is whether it is SSA-able. |
Change https://golang.org/cl/197560 mentions this issue: |
Change https://golang.org/cl/199280 mentions this issue: |
Ops, this is wrong reference. |
Change https://golang.org/cl/199558 mentions this issue: |
We're allowed to remove a write barrier when both the old value in memory and the new value we're writing are not heap pointers. Improve both those checks a little bit. A pointer is known to not be a heap pointer if it is read from read-only memory. This sometimes happens for loads of pointers from string constants in read-only memory. Do a better job of tracking which parts of memory are known to be zero. Before we just kept track of a range of offsets in the most recently allocated object. For code that initializes the new object's fields in a nonstandard order, that tracking is imprecise. Instead, keep a bit map of the first 64 words of that object, so we can track precisely what we know to be zeroed. The new scheme is only precise up to the first 512 bytes of the object. After that, we'll use write barriers unnecessarily. Hopefully most initializers of large objects will use typedmemmove, which does only one write barrier check for the whole initialization. Fixes #34723 Update #21561 Change-Id: Idf6e1b7d525042fb67961302d4fc6f941393cac8 Reviewed-on: https://go-review.googlesource.com/c/go/+/199558 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
generates:
Note that the
7
is written by loading from a readonly global and writing to the slice. We should just use afor the last 2 lines.
Up to some small constant in size, emitting the constants explicitly instead of copying them from a statictmp is better.
The text was updated successfully, but these errors were encountered: