[x86/Linux] Generate conservative epilog#9602
Conversation
|
\CC @seanshpark |
|
This PR seems to resolve #9272, too. |
|
If you run with wrong SP, the GC reporting will be wrong. Fixing up the SP in epilog may hide the problem for the situation you are seeing; but I expect that it will lead to much harder to debug crashes later. |
|
@jkotas I guessed that GC will refer each object via Could you let me know where related implementation is? I would like to analyze that issue, but GC is too large to analyze. It will be very helpful if you could provide any hint for GC issue. |
|
This is not really in the GC. It is in the handshake between the JIT and CodeManager. The JIT generates the GCInfo reporting against SP in some cases, and then the CodeManager does reporting against SP accordingly. It is done in multiple places, for example here: https://github.com/dotnet/coreclr/blob/master/src/vm/eetwain.cpp#L4488 . Anyway, running with bad ESP and then try to compensate for it is a bad idea. It will create endless problems. |
|
@dotnet-bot test this please (Jenkins was down) |
|
@dotnet-bot test Windows_NT x64 Release Priority 1 Build and Test please |
|
@jkotas Here is an simple example of this issue: The current unwinder sometimes provides the state before When we resume execution from Do you mean that unwinder should take care of such padding? |
What will happen if there is more code in the given method after the try/catch that you are resuming from? Won't you be potentially a lot of code with bad SP?
I think so. Resume after caught exception has to use correct SP. |
|
Hmm.. the code related with |
|
The GC info is careful about using BP-relative or SP-relative offset for each value. The two are not interchangeable. Pending arguments are reported SP-relative, for example. Reporting them BP-relative would not work in methods with localloc or funclets.
Have you done any stress testing on it? The subtle GC reporting issues only show up once you start running large programs; or under targeted stress... |
|
@jkotas x86/Linux is still under bring up, and GCstress test is not performed, yet (but it is definitely required). |
|
I'll take a look at how GC will work, and re-open PR when ready. |
ESP may be variable when UNIX_X86_ABI is used, and incorrect ESP (especially resuming from exception) causes various issues such as JIT.IL_Conformance.Old.Conformance_Base.conv_ovf_r8_i test failure.
This commit attempts to insert SP-restore instruction in function epilog to fix such issues.