Commit 61830a3b authored by Kevin Modzelewski's avatar Kevin Modzelewski

Optimize hidden class scanning

One of the downsides of the BoxedString-as-attributes change
is that hidden classes become more complicated to gc-scan;
try to claw some of that back.
parent c5b1d41e
...@@ -368,12 +368,15 @@ public: ...@@ -368,12 +368,15 @@ public:
void gc_visit(GCVisitor* visitor) { void gc_visit(GCVisitor* visitor) {
// Visit children even for the dict-backed case, since children will just be empty // Visit children even for the dict-backed case, since children will just be empty
visitor->visitRange((void* const*)&children.vector()[0], (void* const*)&children.vector()[children.size()]); visitor->visitRange((void* const*)&children.vector()[0], (void* const*)&children.vector()[children.size()]);
if (attrwrapper_child) visitor->visit(attrwrapper_child);
visitor->visit(attrwrapper_child);
for (auto p : children) // We don't need to visit the keys of the 'children' map, since the children should have those as entries
visitor->visit(p.first); // in the attr_offssets map.
for (auto p : attr_offsets) // Also, if we have any children, we can skip scanning our attr_offsets map, since it will be a subset
visitor->visit(p.first); // of our child's map.
if (!children.size())
for (auto p : attr_offsets)
visitor->visit(p.first);
} }
// The total size of the attribute array. The slots in the attribute array may not correspond 1:1 to Python // The total size of the attribute array. The slots in the attribute array may not correspond 1:1 to Python
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment