-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[Local GC] Handle table and the DAC #8322
Comments
I had an idea about this today - as long as we link in a GC to the CoreCLR DLL, we do not have to eliminate our dependency on If we do this, we would include these two functions in the DAC API surface area of a standalone GC and would need to increment a major version number if we changed their behavior. That seems to me like it would be a rare occurrence, though. |
I think you want to make this explicit, like refactor the function into gcinterface.inl. I do think you want to link in a whole GC with a fingers crossed that it will work out. |
Ok! (cc @sergiy-k, who I talked about this with) To that end, here's the call graph of the two offending functions: They refer to no globals, which is very fortunate. I feared that this would become very ugly but the size of this call graph and the fact that they don't refer to global state makes me feel much better. |
Compiling with dotnet/coreclr#12389 has revealed two additional violations: I will update the above call graph with these functions to estimate the damage. In the meantime, I have been prototyping the cc @Maoni0 @sergiy-k @adityamandaleeka if they haven't been pinged already by this thread |
Thanks everyone for the offline feedback so far - unfortunately this is a thorny issue that does not appear to have an appealing solution. To summarize the feedback I've received (and to make sure we're all on the same page, since I've written a lot on this issue): In the future, a build of the GC (possibly from another repo) may produce two build artifacts: first, a standalone GC linked as shared library that can be loaded by a runtime dynamically, and second a static archive of GC object files so that a runtime can choose to link the GC statically. Some number of source files will also be shipped alongside these two artifacts:
These three source files represent the contract between the runtime and the GC and must be versioned accordingly. It is desirable to keep the amount of code that we share like this to the absolute minimum, due to the harsh versioning constraints. The rest of this post makes the assumption that it is desirable to have a solution that that enables the GC source to be stored in a separate repro from the runtime, so that these three source files are the only source files required by a runtime to build and link against the GC. The problem (this issue) is that the DAC uses six functions that are considered to be private to the GC (linked are examples of their usage):
The DAC requires definitions of these functions to link. Today, it gets these definitions from the object files produced by compiling the handle table source files as part of the runtime DAC Based on the feedback I've received, there are several possible solutions:
3 is not an acceptable solution, especially if we intend to ship runtimes without linked-in GCs. Both 1 and 2 have major cons. Cons of 1:
Cons of 2:
Another major con shared by both approaches is that this is potentially a lot of effort expended on a small portion of code. |
Another note is that |
Fixed by dotnet/coreclr#12458. |
This is an issue that @adityamandaleeka ran into a little while ago. The DAC has deep knowledge of the GC's handle table:
g_HandleTableMap
GetDependentHandleSecondary
on handles in the target processHndGetHandleExtraInfo
on handles in the target processToday, this is not a problem; the GC DAC build compiles the above two functions into the DAC and the DAC is free to call them. For a standalone GC, this is more problematic; as it stands today the DAC is not permitted to dispatch virtually on the target's
IGCHeap
instance, which it would need to do for these two functions. Even if it could, it would not be calling theDACCESS_COMPILE
versions of these functions, which could result in strange behavior.This commit (swgillespie/coreclr@1eef14c) is a start - it fixes the first bullet point and ifdef's out the bottom two bullet points. We'll need to come up with some sort of strategy
GetDependentHandleSecondary
andHndGetHandleExtraInfo
- we can allow the debugger to dispatch virtually on the debugee'sIGCHeap
instance, duplicate the code, or do some other solution.This issue is the last remaining use of the GC DAC build and, once it is complete, the GC DAC build can be removed completely which should be a nice DAC binary size win and compile time improvement.
The text was updated successfully, but these errors were encountered: