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: should not spill Duff-adjusted address #16515
Comments
I can go on fix it if we agree to do Duff-adjustment in |
(note for me) ARM SSA may also has this problem, not for DUFFZERO, but for LoweredZero/LoweredMove for very large objects. |
/cc @RLH @randall77 The AMD64 aspect of this issue is a regression, so we should try to fix it for 1.7. |
Confirmed for ARM(32) with |
CL https://golang.org/cl/25300 mentions this issue. |
…ro/Move on ARM Instead of comparing the address of the end of the memory to zero/copy, comparing the address of the last element, which is a valid pointer. Also unify large and unaligned Zero/Move, by passing alignment as AuxInt. Fixes #16515 for ARM. Change-Id: I19a62b31c5acf5c55c16a89bea1039c926dc91e5 Reviewed-on: https://go-review.googlesource.com/25300 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com>
CL https://golang.org/cl/25309 mentions this issue. |
What version of Go are you using (
go version
)?go version devel +c80e0d3 Wed Jul 27 05:43:36 2016 +0000 darwin/amd64
In SSA, Duff-adjusted address may be spilled and reused if there are more than one Duff calls within the same function. On AMD64, this address is currently spilled as a scalar, which means if the stack is moved, the spilled value is no longer useful. This is demonstrated with the first call of
f
in the following code:where
f
is compiled toRun with SSA on:
(ok running with SSA off)
Note that it does not work if we change the type of the spill to pointer, since Duff-adjusted address (in this case
x-16
) may not point to valid object, causing stack scanning code to panic (may not always happen):One solution is to do Duff-adjustment in
genValue
, so reg allocator cannot see the intermediate value.Found when doing ARM64 port.
/cc @aclements
The text was updated successfully, but these errors were encountered: