-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: register ABI bringup testcase failures (tracking issue) #44816
Comments
OK, here is a second problem (different failure mode). This is on the caller side (requires two packages). Recipe:
Failure mode:
To reproduce, download the cabiTest.zip file, then
|
The following program fails to compile at tip (with
Output:
|
Another ICE at tip:
Output:
|
I don't know what I changed, but now when I run that last test case I get
|
Change https://golang.org/cl/299389 mentions this issue: |
@mknyszek
to see one of them more repeatably. |
Change https://golang.org/cl/299409 mentions this issue: |
Change https://golang.org/cl/299549 mentions this issue: |
Smaller (edited) reproducer of the "invalid instruction" failures:
yields
Says "autogenerated", but appears in the compilation output (v8), must be an artifact of the assembler reporting. I modified the diagnostic printer to be clear about what's being compiled.
|
Found it. I thought that abiutils would render the parameter registers I0, F0, I1, F1 -- in the order that the parameters use them -- and instead it does them I0, I1, F0, F1. Oops. |
Change https://golang.org/cl/299570 mentions this issue: |
Change https://golang.org/cl/299410 mentions this issue: |
Includes test taken from #44816 (comment) and improved debugging output. Updates #44816 Change-Id: I94aeb9c5255f175fe80727be29d218bad54bf7ea Reviewed-on: https://go-review.googlesource.com/c/go/+/299389 Trust: David Chase <[email protected]> Reviewed-by: Cherry Zhang <[email protected]>
Includes more enhancements to debugging output. Updates #44816. Change-Id: I5b21815cf37ed21e7dec6c06f538090f32260203 Reviewed-on: https://go-review.googlesource.com/c/go/+/299409 Trust: David Chase <[email protected]> Reviewed-by: Cherry Zhang <[email protected]>
Old: return the ABI register index of the result (wrong!) New: return the index w/in sequence of result registers (right!) Fixed bug: genCaller0/genCaller0.go:43:9: internal compiler error: 'Caller0': panic during schedule while compiling Caller0: runtime error: index out of range [10] with length 9 Updates #44816. Change-Id: I1111e283658a2d6422986ae3d61bd95d1b9bde5e Reviewed-on: https://go-review.googlesource.com/c/go/+/299549 Trust: David Chase <[email protected]> Reviewed-by: Cherry Zhang <[email protected]>
…umer ABI info producer and consumer had different ideas for register order for parameters. Includes a test, includes improvements to debugging output. Updates #44816. Change-Id: I4812976f7a6c08d6fc02aac1ec0544b1f141cca6 Reviewed-on: https://go-review.googlesource.com/c/go/+/299570 Trust: David Chase <[email protected]> Reviewed-by: Than McIntosh <[email protected]>
Change https://golang.org/cl/300749 mentions this issue: |
Change https://golang.org/cl/300150 mentions this issue: |
Change https://golang.org/cl/301270 mentions this issue: |
This is enabled with a ridiculous magic name for method, or for last input type passed, that needs to be changed to something inutterable before actual release. Ridiculous method name: MagicMethodNameForTestingRegisterABI Ridiculous last (input) type name: MagicLastTypeNameForTestingRegisterABI RLTN is tested with strings.Contains, so you can have MagicLastTypeNameForTestingRegisterABI1 and MagicLastTypeNameForTestingRegisterABI2 if that is helpful Includes test test/abi/fibish2.go Updates #44816. Change-Id: I592a6edc71ca9bebdd1d00e24edee1ceebb3e43f Reviewed-on: https://go-review.googlesource.com/c/go/+/299410 Trust: David Chase <[email protected]> Run-TryBot: David Chase <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Cherry Zhang <[email protected]>
It would fail now if it were turned on. Updsates #44816. Change-Id: I19d94f0cb2dd84271f5304c796d7c81e1e64af25 Reviewed-on: https://go-review.googlesource.com/c/go/+/301270 Trust: David Chase <[email protected]> Run-TryBot: David Chase <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Cherry Zhang <[email protected]>
ALSO: found evidence that stack maps for bodyless methods are wrong. gofmt in test/abi removed never-executed code in types/size.go Updates #44816. Change-Id: I658c33f049337fb6f1e625f0c55430d25bfa877e Reviewed-on: https://go-review.googlesource.com/c/go/+/300749 Trust: David Chase <[email protected]> Run-TryBot: David Chase <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Cherry Zhang <[email protected]>
Change https://golang.org/cl/302071 mentions this issue: |
Change https://golang.org/cl/302249 mentions this issue: |
Cleanup tasks once the rubble stops bouncing:
Somewhere in here I think we need to sync w/ the generics effort -- I am a little curious what happens to things like "Size" and "Offset" down the road. Conceivably, they will become expressions, that will be a minor party. If first effort is all templates, that won't happen immediately, but we might want to plan ahead. |
…utos Repair of CL 300749. ALSO: found evidence that stack maps for bodyless methods are wrong. gofmt in test/abi removed never-executed code in types/size.go Updates #44816. Updates #40724. Change-Id: Ifeb5fee60f60e7c7b58ee0457f58a3265d6cf3f6 Reviewed-on: https://go-review.googlesource.com/c/go/+/302071 Trust: David Chase <[email protected]> Reviewed-by: Cherry Zhang <[email protected]>
Code generation for open defers failed to account for presence of method receiver and thus was OFF BY ONE. Fixes #45062. Updates #44816. Updates #40724. Change-Id: Ia90ea8fd0f7d823e1f757c406f9127136c2ffdd2 Reviewed-on: https://go-review.googlesource.com/c/go/+/302249 Trust: David Chase <[email protected]> Reviewed-by: Cherry Zhang <[email protected]>
Change https://golang.org/cl/304233 mentions this issue: |
Corrected typo/thinko. We should keep the test for this, but it doesn't run yet because of reflection as far as I know (but I am not testing w/ GOEXPERIMENT). See #44816 (comment) Updates #40724 Updates #44816 Change-Id: Ia12d0d4db00a8ec7174e72de460173876bd17874 Reviewed-on: https://go-review.googlesource.com/c/go/+/304233 Trust: David Chase <[email protected]> Run-TryBot: David Chase <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Cherry Zhang <[email protected]>
Another test case from the fuzzer that causes a runtime error with regiabi (plus pragma). Symptom:
|
Another test case from the fuzzer that causes a runtime error with regiabi (plus pragma). This is in the regular call path, not reflect. Symptom:
I eyeballed it in the debugger. Looks like RAX is being clobbered in the prolog before it can be used, or something along those lines. |
Ugh, "works for me". |
Change https://golang.org/cl/306109 mentions this issue: |
Another day, another new fuzzer failure. This one is pretty similar to the most recent one. From the SSA dump of the test function prolog:
So basically a bunch of Arg*Reg ops, then some other code, then more Arg*Reg ops. This is problematic; since regalloc can't see the later Arg*Reg ops, it will assign live param registers to the intervening code. |
Another new failure. Zip file with contents: Here it looks as though something is going wonky with respect to params that have to be spilled to the stack (since they are address taken). Signature:
Here's what StructF1S0 looks like (expanded nested structs to improve readability):
Checking code:
In the prolog of the function when we spill p1 (since it is address taken), the code looks like
Seems ok. The checking code looks like
The UCOMISS at 00091 is pick up the wrong value. So somewhere along the line (either spilling p1 or materializing its spill address) we got something wrong. |
One last fuzzer failure for the day. Haven't analyzed it at all, but here it is. |
Currently when register assignment fails we roll back all the abiParts that were generated in the process. However, the total number of registers also increases, but does not get rolled back. The result is a very incorrect register assignment. For #40724. For #44816. Change-Id: I1934ea5f95f7608ff2067166255099dbc9135e8c Reviewed-on: https://go-review.googlesource.com/c/go/+/306109 Trust: Michael Knyszek <[email protected]> Run-TryBot: Michael Knyszek <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Austin Clements <[email protected]> Reviewed-by: Cherry Zhang <[email protected]>
Switching back to reflect testing now that the regular call path seems clean. Here is a reduced testcase that shows a reflect.Call failure: |
Change https://golang.org/cl/306929 mentions this issue: |
This change removes two short-circuits for zero-sized types (zero-sized structs and zero-sized struct fields) in the recursive cases of the ABI algorithm, because this does not match the spec's algorithm, nor the compiler's algorithm. The failing case here is a struct with a field that is an array of non-zero length but whose element type is zero-sized. This struct must be stack-assigned because of the array, according to the algorithm. The reflect package was register-assigning it. Because there were two short-circuits, this can also appear if a struct has a field that is a zero-sized struct but contains such an array, also. This change adds regression tests for both of these cases. For #44816. For #40724. Change-Id: I956804170962448197a1c9853826e3436fc8b1ea Reviewed-on: https://go-review.googlesource.com/c/go/+/306929 Trust: Michael Knyszek <[email protected]> Run-TryBot: Michael Knyszek <[email protected]> Reviewed-by: Than McIntosh <[email protected]> Reviewed-by: Cherry Zhang <[email protected]> TryBot-Result: Go Bot <[email protected]>
Another reflect test cast that the fuzzer found a failure in: To reproduce, unpack the zip file and then:
I should also add that in my repo I have this diff:
This is a method call, not a regular call. In addition there seem to be a number of other moving parts (the param in question is address taken and escapes to the heap). It is a value receiver (not pointer), and the size of the type in question is zero. I shoudl also add that it looks as though there is a method wrapper involved (from the stack trace). Here is a dump of the abi regs at the point where the regular (non-reflect) call takes place, when we've just entered the Test19 function:
and here is the dump for the reflect call
So $rbx doesn't look right. |
New fuzzer failure (compile time crash). Zip file with repro: To reproduce, do:
|
Change https://golang.org/cl/308309 mentions this issue: |
In expand_calls, OpSelectN occurs both before and after the rewriting. Attempting to rewrite a post-expansion OpSelectN is bad. (The only ones rewritten in place are the ones returning mem; others are synthesized to replace other selection chains with register references.) Updates #40724. Updates #44816#issuecomment-815258897. Change-Id: I7b6022cfb47f808d3ce6cc796c067245f36047f3 Reviewed-on: https://go-review.googlesource.com/c/go/+/308309 Trust: David Chase <[email protected]> Run-TryBot: David Chase <[email protected]> Reviewed-by: Than McIntosh <[email protected]>
Change https://golang.org/cl/308589 mentions this issue: |
Another reflect problem: This one seems to have to do with floating point values. Repro:
Looking at the element in question ("p5"), on the calling side it is set up with p5 = genChecker73.StructF5S2{F0: genChecker73.ArrayF5S0E0{}, F1: float32(-1.1470688e+37)} If I stop at the entry point of genChecker73.Test5 and look at the floating point regs after the regular direct call, I see:
For the reflect call, here's what's coming through:
So you can see that the value of $xmm2 doesn't look right. |
This removes more unused values during transformation. Leaving them in the tree can create type conflicts in OpArg* references. Updates #40724. Updates #44816. Fixes #45417. Change-Id: I07dcb7b4b2bf8d79e22e0543cb2fb52c2ececb96 Reviewed-on: https://go-review.googlesource.com/c/go/+/308589 Trust: David Chase <[email protected]> Run-TryBot: David Chase <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Than McIntosh <[email protected]>
... and one more fuzzer-generated failure, also in reflect. Zip file: This one is interesting in that the parameter in question isn't actually assigned to a register (as far as I can tell), it's passed on the stack. Haven't done any additional analysis. Repro:
|
This disables the "testing names" for method names and trailing input types passed to closure/interface/other calls. The logic using the names remains, so that editing the change to enable local testing is not too hard. Also fixes broken build tag in reflect/abi_test.go Updates #44816. Change-Id: I3d222d2473c98d04ab6f1122ede9fea70c994af1 Reviewed-on: https://go-review.googlesource.com/c/go/+/300150 Trust: David Chase <[email protected]> Run-TryBot: David Chase <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Cherry Zhang <[email protected]>
Note: this is not a regular bug, but instead tracking issue in which to collect testcases that cause failures with the new Go register ABI work.
What version of Go are you using (
go version
)?What operating system and processor architecture are you using (
go env
)?linux/amd64
What did you do?
First instance:
What did you expect to see?
clean build
What did you see instead?
Reduced testcase attached, repro with "go tool compile -p x testcase.go".
testcase.go.txt
The text was updated successfully, but these errors were encountered: