Add trace_object_immediately to EdgeVisitor #865
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds
trace_object_immediately
toEdgeVisitor
. This allows the binding to deal with some fields specially during object scanning. This allows flexibility during object scanning for the bindings, and they can choose how to deal with each edge.The motivation is that Julia objects may have some fields that are internal references. When scanning the object, we can compute the offset from the internal reference to the actual object reference. Currently we are using
enum JuliaEdge { Simple(SimpleEdge), Offset(OffsetEdge) }
andstruct OffsetEdge { slot, offset }
to deal with this: theOffsetEdge
knows the slot to load from and store to, and knows how to compute the actual object reference from the internal reference in the slot and the offset. However, this approach has drawbacks: 1. makesenum JuliaEdge
large (2 words + enum tag). As we store a lot of edges, and we pass edges around in MMTk core. Using a large struct for edges has overhead. ConsideringOffsetEdge
is just an infrequent case (maybe 10% in the workload I am looking at), paying cost penalty for it seems unnecessary. 2. we need to check which edge type it is all the time. This also imposes overhead. So I am trying to just useSimpleEdge(Address)
for Julia. To achieve this, I need a different method fromEdgeVisitor
that I can use to deal with internal references.trace_object_immediately
works for this case.