Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@alexrp
Copy link
Contributor

@alexrp alexrp commented Dec 1, 2017

This is rebased on master and with a few changes compared to #5710:

  • [Obsolete] has been applied to the old roots-related stuff in Mono.Profiler.Log.
  • Root descriptions have been cleaned up and now use Title Case.
  • Roots in handle stacks are now reported (handle stacks are treated as pseudo-roots similar to the finalizer queues).
  • Added MONO_PROFILER_EVENT_5 definition to profiler-events.h to avoid breaking existing users.
  • The TYPE_HEAP_ROOT event is now written as address followed by object, as opposed to the other way around.
  • Fixed the decoding logic for TYPE_HEAP_ROOT in mprof-report (it handled v14 incorrectly).
  • Root register/unregister events are always emitted in the log file (this is necessary to make dynamic toggling of root events work).
  • The key for static variable roots is now the MonoVTable pointer.
  • Added VTable load callbacks to the profiler API.
  • Added VTable metadata events to the log format.
  • Normalize some root key values before writing to the log file (e.g. we should write the domain ID, not the MonoDomain pointer).
  • Use VTable pointers instead of class pointers in TYPE_HEAP_OBJECT and TYPE_ALLOC.
  • Fixed emit_ptr in the profiler, which could write nonsense to a buffer if the first pointer written in a buffer was NULL.
  • Added support for the gc_resize profiler event in SGen.

@alexrp
Copy link
Contributor Author

alexrp commented Dec 2, 2017

@luhenry @kumpera I think this is ready for review. It's good to go as far as I'm concerned, but you might want to have a look over the changes I listed in the PR description.

@alexrp alexrp changed the title [profiler] Rework GC roots reporting. [wip] [profiler] Rework GC roots reporting. Dec 2, 2017
@mono mono deleted a comment from DavidKarlas Dec 2, 2017
@mono mono deleted a comment from DavidKarlas Dec 2, 2017
Copy link
Contributor

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

@mono mono deleted a comment from DavidKarlas Dec 3, 2017
@kumpera
Copy link
Contributor

kumpera commented Dec 3, 2017

LGTM
Kinda unfair that you're greatly improving on top of my changes and yet this PR still a single commit without any from you. :)

@alexrp
Copy link
Contributor Author

alexrp commented Dec 6, 2017

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.
@kumpera
Copy link
Contributor

kumpera commented Dec 7, 2017

the weak fields test was disabled for the interp by a recent comimt by @lewurm

@luhenry luhenry merged commit d7ac79c into mono:master Dec 7, 2017
@DavidKarlas
Copy link
Contributor

<3

@alexrp alexrp deleted the profiler-gc-roots branch December 12, 2017 03:27
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants