-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[profiler] Rework GC roots reporting. #6144
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe rename this also to RootPointer to match new HeapRootRegisterEvent naming
|
LGTM |
|
Rebased again as there were some conflicts from the merging of #5972. |
This change re-implement GC roots reporting in a way that allows users to correctly track the source of a GC root. The new design is based on emitting GC root information upfront and only report addresses during heap dumps. When a GC root is registered we emit an event that is an address range, the root kind, a key and a text description. A decoder can use this information to match a reported root address with all registration addresses to figure out what they mean. A GC Root key is used to further its meaning. For example, if kind is thread, key is a tid, if kind is static variables, key is the vtable pointer and so on. The build of the change is introducing this key argument across all root registration code and rework our root reporting code to encode their addresses. Some roots use pseudo-addresses when they are not registrable. This is the case of thread stacks/registers and the finalizer queue. Finally, root reporting was changed to happen only once per collection and at the end, leading to correct and useful data being produced.
|
the weak fields test was disabled for the interp by a recent comimt by @lewurm |
|
<3 |
This change re-implement GC roots reporting in a way that allows users to correctly track the source of a GC root. The new design is based on emitting GC root information upfront and only report addresses during heap dumps. When a GC root is registered we emit an event that is an address range, the root kind, a key and a text description. A decoder can use this information to match a reported root address with all registration addresses to figure out what they mean. A GC Root key is used to further its meaning. For example, if kind is thread, key is a tid, if kind is static variables, key is the vtable pointer and so on. The build of the change is introducing this key argument across all root registration code and rework our root reporting code to encode their addresses. Some roots use pseudo-addresses when they are not registrable. This is the case of thread stacks/registers and the finalizer queue. Finally, root reporting was changed to happen only once per collection and at the end, leading to correct and useful data being produced. Commit migrated from mono/mono@d7ac79c
This is rebased on master and with a few changes compared to #5710:
[Obsolete]has been applied to the old roots-related stuff inMono.Profiler.Log.MONO_PROFILER_EVENT_5definition toprofiler-events.hto avoid breaking existing users.TYPE_HEAP_ROOTevent is now written asaddressfollowed byobject, as opposed to the other way around.TYPE_HEAP_ROOTinmprof-report(it handled v14 incorrectly).staticvariable roots is now theMonoVTablepointer.MonoDomainpointer).TYPE_HEAP_OBJECTandTYPE_ALLOC.emit_ptrin the profiler, which could write nonsense to a buffer if the first pointer written in a buffer wasNULL.gc_resizeprofiler event in SGen.