Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

[Local GC] Move knowledge of the free object method table outside of the GC#10755

Merged
swgillespie merged 4 commits intodotnet:masterfrom
swgillespie:free-objects
Apr 9, 2017
Merged

[Local GC] Move knowledge of the free object method table outside of the GC#10755
swgillespie merged 4 commits intodotnet:masterfrom
swgillespie:free-objects

Conversation

@swgillespie
Copy link

The EE provides a method table for a specific type of object, the "free object", which is used by the GC to keep the heap crawlable. A free object is conceptually similar to a managed array in that it consists of an object header and a field indicating how many array elements the object has (i.e. how large the free region is), followed by a region of space known to be free to the GC.

This PR ensures that the GC's knowledge of the free method table is acquired through GCToEEInterface upon startup. This PR also has the GC acquire two additional details on startup: 1) the size of ArrayBase, and the 2) offset of the NumComponents field of ArrayBase. These are used to locate the offset of the field into which the size of the free object is stored and to locate the first byte of the free object's free region.

static void HandleFatalError(unsigned int exitCode);
static bool ShouldFinalizeObjectForUnload(AppDomain* pDomain, Object* obj);
static MethodTable* GetFreeObjectMethodTable();
static size_t GetSizeOfArrayBase();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These constants are used on very perf sensitive paths. I do not think it is ok to virtualize them. They have to be part of the fixed binary contract between VM and GC.

Copy link
Author

@swgillespie swgillespie Apr 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These methods are called once on GC startup and cached on the GC side - is that still a problem?

Copy link
Member

@jkotas jkotas Apr 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that is still a problem.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, will fix!

@swgillespie
Copy link
Author

@jkotas
Copy link
Member

jkotas commented Apr 6, 2017

Need to resolve conflicts ... LGTM otherwise.

@swgillespie swgillespie merged commit 2dfc74d into dotnet:master Apr 9, 2017
@swgillespie
Copy link
Author

thanks!

@karelz karelz modified the milestone: 2.0.0 Aug 28, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants