-
-
Notifications
You must be signed in to change notification settings - Fork 925
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
ObjectSpace specs #3299
ObjectSpace specs #3299
Conversation
…cals and at_exit handlers.
@@ -115,9 +129,23 @@ private void visitObject(DynamicObject object, ObjectGraphVisitor visitor) throw | |||
|
|||
// Visit all properties | |||
|
|||
for (Property property : object.getShape().getProperties()) { | |||
for (Property property : object.getShape().getPropertyListInternal(false)) { |
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.
Do we still need this change with the one below?
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.
Yes - getProperties()
doesn't return HiddenKeys
- took me ages to figure this out.
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.
Which HiddenKey do we want to traverse? Before they were fields and only traversed if they were explicitly in visitObjectGraphChildren, right?
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.
We want to visit all fields, whether they're instance variables or they're internal fields (like store
in Array
) to find all objects. Things like store
are currently HiddenKey
so that they aren't mistaken for instance variables.
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.
Right, sounds good and less error-prone
Nice specs! Please address my comments. |
visitObject(context.getCoreLibrary().getGlobalVariablesObject(), visitor); | ||
// We only visit the global variables and other global state from the root thread | ||
|
||
if (thread == context.getThreadManager().getRootThread()) { |
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.
This will run for all fibers of the main thread. One way to only run for the initial Fiber is to compare with the root fiber of the main thread.
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.
Or more simply since any of the thread could do this, the caller of visitRoots could be chosen to lookup these ones.
@eregon please review