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:
void gc_visit(GCVisitor* visitor) {
// 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()]);
if (attrwrapper_child)
visitor->visit(attrwrapper_child);
for (auto p : children)
visitor->visit(p.first);
for (auto p : attr_offsets)
visitor->visit(p.first);
visitor->visit(attrwrapper_child);
// We don't need to visit the keys of the 'children' map, since the children should have those as entries
// in the attr_offssets map.
// Also, if we have any children, we can skip scanning our attr_offsets map, since it will be a subset
// 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
......
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