|
28 | 28 |
|
29 | 29 | import static com.oracle.graal.python.builtins.objects.cext.structs.CFields.PyTypeObject__tp_name;
|
30 | 30 | import static com.oracle.graal.python.builtins.objects.object.ObjectBuiltins.InitNode.overridesBuiltinMethod;
|
| 31 | +import static com.oracle.graal.python.lib.PyObjectDir.filterHiddenKeys; |
31 | 32 | import static com.oracle.graal.python.nodes.BuiltinNames.T_BUILTINS;
|
32 | 33 | import static com.oracle.graal.python.nodes.SpecialAttributeNames.J___ABSTRACTMETHODS__;
|
33 | 34 | import static com.oracle.graal.python.nodes.SpecialAttributeNames.J___ANNOTATIONS__;
|
|
97 | 98 | import com.oracle.graal.python.builtins.objects.cext.structs.CFields;
|
98 | 99 | import com.oracle.graal.python.builtins.objects.cext.structs.CStructAccess;
|
99 | 100 | import com.oracle.graal.python.builtins.objects.common.DynamicObjectStorage;
|
| 101 | +import com.oracle.graal.python.builtins.objects.common.HashingStorageNodes.HashingStorageDelItem; |
100 | 102 | import com.oracle.graal.python.builtins.objects.common.SequenceNodes.GetObjectArrayNode;
|
101 | 103 | import com.oracle.graal.python.builtins.objects.common.SequenceStorageNodes.ToArrayNode;
|
102 | 104 | import com.oracle.graal.python.builtins.objects.dict.PDict;
|
|
146 | 148 | import com.oracle.graal.python.nodes.attributes.ReadAttributeFromObjectNode;
|
147 | 149 | import com.oracle.graal.python.nodes.attributes.WriteAttributeToObjectNode;
|
148 | 150 | import com.oracle.graal.python.nodes.builtins.FunctionNodes;
|
| 151 | +import com.oracle.graal.python.nodes.builtins.ListNodes; |
149 | 152 | import com.oracle.graal.python.nodes.call.special.CallTernaryMethodNode;
|
150 | 153 | import com.oracle.graal.python.nodes.call.special.CallVarargsMethodNode;
|
151 | 154 | import com.oracle.graal.python.nodes.call.special.LookupAndCallBinaryNode;
|
@@ -1404,26 +1407,37 @@ Object dir(VirtualFrame frame, Object klass,
|
1404 | 1407 | @Cached PyObjectLookupAttr lookupAttrNode,
|
1405 | 1408 | @Cached com.oracle.graal.python.nodes.call.CallNode callNode,
|
1406 | 1409 | @Cached ToArrayNode toArrayNode,
|
1407 |
| - @Cached("createGetAttrNode()") GetFixedAttributeNode getBasesNode) { |
1408 |
| - PSet names = dir(frame, inliningTarget, klass, lookupAttrNode, callNode, getBasesNode, toArrayNode); |
| 1410 | + @Cached("createGetAttrNode()") GetFixedAttributeNode getBasesNode, |
| 1411 | + @Cached ListNodes.ConstructListNode constructListNode, |
| 1412 | + @Cached HashingStorageDelItem delItem) { |
| 1413 | + PSet names = dir(frame, klass, |
| 1414 | + inliningTarget, lookupAttrNode, callNode, getBasesNode, toArrayNode, constructListNode, delItem); |
1409 | 1415 | return names;
|
1410 | 1416 | }
|
1411 | 1417 |
|
1412 |
| - private PSet dir(VirtualFrame frame, Node inliningTarget, Object klass, PyObjectLookupAttr lookupAttrNode, com.oracle.graal.python.nodes.call.CallNode callNode, |
1413 |
| - GetFixedAttributeNode getBasesNode, ToArrayNode toArrayNode) { |
| 1418 | + private PSet dir(VirtualFrame frame, Object klass, |
| 1419 | + Node inliningTarget, |
| 1420 | + PyObjectLookupAttr lookupAttrNode, |
| 1421 | + com.oracle.graal.python.nodes.call.CallNode callNode, |
| 1422 | + GetFixedAttributeNode getBasesNode, |
| 1423 | + ToArrayNode toArrayNode, |
| 1424 | + ListNodes.ConstructListNode constructListNode, |
| 1425 | + HashingStorageDelItem delItem) { |
1414 | 1426 | PSet names = factory().createSet();
|
1415 | 1427 | Object updateCallable = lookupAttrNode.execute(frame, inliningTarget, names, T_UPDATE);
|
1416 | 1428 | Object ns = lookupAttrNode.execute(frame, inliningTarget, klass, T___DICT__);
|
1417 | 1429 | if (ns != PNone.NO_VALUE) {
|
1418 | 1430 | callNode.execute(frame, updateCallable, ns);
|
1419 | 1431 | }
|
| 1432 | + filterHiddenKeys(frame, names, inliningTarget, constructListNode, delItem); |
1420 | 1433 | Object basesAttr = getBasesNode.execute(frame, klass);
|
1421 | 1434 | if (basesAttr instanceof PTuple) {
|
1422 | 1435 | Object[] bases = toArrayNode.execute(inliningTarget, ((PTuple) basesAttr).getSequenceStorage());
|
1423 | 1436 | for (Object cls : bases) {
|
1424 | 1437 | // Note that since we are only interested in the keys, the order
|
1425 | 1438 | // we merge classes is unimportant
|
1426 |
| - Object baseNames = dir(frame, inliningTarget, cls, lookupAttrNode, callNode, getBasesNode, toArrayNode); |
| 1439 | + Object baseNames = dir(frame, cls, |
| 1440 | + inliningTarget, lookupAttrNode, callNode, getBasesNode, toArrayNode, constructListNode, delItem); |
1427 | 1441 | callNode.execute(frame, updateCallable, baseNames);
|
1428 | 1442 | }
|
1429 | 1443 | }
|
|
0 commit comments