-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/compile: no instruction marked with is_stmt in debug_line for statement calling generic function, inside a generic function #49628
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
@dr2chase Thanks for taking a look. I don't know much about the is_stmt markers, and it looks likes WithIsStmt() is mostly used in SSA and inlining, so I'm unsure what I might need to fix with the stenciling/instantiation code. Let me know if you want to talk about this - maybe I can take over once if you figure out there is something I should be doing in the instantiation code or the code that initially creates the nodes for generic functions (but that is the same code that creates nodes for non-generic functions). |
I used
|
Thanks, David. Note that the output @dr2chase is showing is from the Here's same output, but for aa2.go in which we convert the generic functions to non-generic functions where T is int:
The output is now:
Both have the same assembly statements marked with '+' (though aa.go has an extra assembly statement 'TESTB AX, (AX)' that is marked +10). The main difference I see is that the 'MOVQ os.Stdout(SB), BX' statement is marked (+10) rather than (+213). @aarzilli Can you point out more of what the problem is that you are seeing? Is it something related to the difference for the 'MOVQ os.Stdout(SB), BX' statement (even though in both cases it is marked as IsStmt)? |
Interesting. It looks like it only happens with optimizations disabled.
(the step before the last one does have an instruction marked with +) |
OK, so I think that you are pointing out that line 10 does not have any associated assembly instruction that is marked with "+10". If I compare the dump output for test.go and the aa2.go about that I showed above where we substitute in 'int' for T everywhere, I see that up to the last SSA pass, both test.go and aa2.go have values that are marked with "+10". But in the test.go (generic case), the value that has the +10 is the conversion to unsafe pointer:
This is the conversion of the dictionary argument to unsafe pointer before then converting to a *[3]uintptr that we can then index into. When we convert to assembly, this unsafe pointer conversion is just dropped, and the +10 is not transferred to any other statement (it appears). I'm not sure what the most consistent fix is. The most obvious fix is to find where the unsafe pointer conversion is essentially dropped (as a no-op), and make sure the isStmt attributed is passed to the next assembly statement. On the other hand, not sure if we should somehow be attributing all the dictionary loading to the previous statement (line 9) so that the beginning of line 10 is more directly already focused on the call. This seems less likely to me, but the load of the other argument is already attributed to line 9 (the load of n into the BX register). |
Pretty sure there's a bad interaction with the LoweredNilCheck -- we don't like to float statement markers past those, because setting breakpoints AFTER the nil check gives bad user experience in the case that user is trying to debug a nil panic. |
I have what looks like a fix, curious what it does to other line number placement. |
Change https://golang.org/cl/366694 mentions this issue: |
The instantiation of main.G has no instruction marked is_stmt for the call to main.F.
The text was updated successfully, but these errors were encountered: