|
63 | 63 | import static com.oracle.graal.python.nodes.SpecialMethodNames.J___SUBCLASSES__;
|
64 | 64 | import static com.oracle.graal.python.nodes.SpecialMethodNames.J___SUBCLASSHOOK__;
|
65 | 65 | import static com.oracle.graal.python.nodes.SpecialMethodNames.T_MRO;
|
66 |
| -import static com.oracle.graal.python.nodes.SpecialMethodNames.T_UPDATE; |
67 | 66 | import static com.oracle.graal.python.nodes.SpecialMethodNames.T___MRO_ENTRIES__;
|
68 | 67 | import static com.oracle.graal.python.runtime.exception.PythonErrorType.AttributeError;
|
69 | 68 | import static com.oracle.graal.python.runtime.exception.PythonErrorType.NotImplementedError;
|
|
101 | 100 | import com.oracle.graal.python.builtins.objects.object.ObjectBuiltins;
|
102 | 101 | import com.oracle.graal.python.builtins.objects.object.ObjectNodes;
|
103 | 102 | import com.oracle.graal.python.builtins.objects.set.PSet;
|
| 103 | +import com.oracle.graal.python.builtins.objects.set.SetBuiltins.UpdateSingleNode; |
104 | 104 | import com.oracle.graal.python.builtins.objects.str.PString;
|
105 | 105 | import com.oracle.graal.python.builtins.objects.str.StringUtils.SimpleTruffleStringFormatNode;
|
106 | 106 | import com.oracle.graal.python.builtins.objects.tuple.PTuple;
|
|
151 | 151 | import com.oracle.graal.python.nodes.object.GetDictIfExistsNode;
|
152 | 152 | import com.oracle.graal.python.nodes.util.CannotCastException;
|
153 | 153 | import com.oracle.graal.python.nodes.util.CastToTruffleStringNode;
|
| 154 | +import com.oracle.graal.python.runtime.ExecutionContext.IndirectCallContext; |
| 155 | +import com.oracle.graal.python.runtime.IndirectCallData; |
154 | 156 | import com.oracle.graal.python.runtime.PythonContext;
|
155 | 157 | import com.oracle.graal.python.runtime.exception.PException;
|
156 | 158 | import com.oracle.graal.python.runtime.exception.PythonErrorType;
|
@@ -1205,32 +1207,33 @@ public abstract static class DirNode extends PythonUnaryBuiltinNode {
|
1205 | 1207 | @Specialization
|
1206 | 1208 | static PSet dir(VirtualFrame frame, Object klass,
|
1207 | 1209 | @Bind("this") Node inliningTarget,
|
1208 |
| - @Cached PyObjectLookupAttr lookupAttrNode, |
1209 |
| - @Cached com.oracle.graal.python.nodes.call.CallNode callNode, |
1210 |
| - @Cached ToArrayNode toArrayNode, |
1211 |
| - @Cached("createGetAttrNode()") GetFixedAttributeNode getBasesNode) { |
1212 |
| - return dir(frame, inliningTarget, klass, lookupAttrNode, callNode, getBasesNode, toArrayNode); |
| 1210 | + @Cached("createFor(this)") IndirectCallData indirectCallData) { |
| 1211 | + PSet names = PFactory.createSet(PythonLanguage.get(inliningTarget)); |
| 1212 | + Object state = IndirectCallContext.enter(frame, indirectCallData); |
| 1213 | + try { |
| 1214 | + dir(names, klass); |
| 1215 | + } finally { |
| 1216 | + IndirectCallContext.exit(frame, indirectCallData, state); |
| 1217 | + } |
| 1218 | + return names; |
1213 | 1219 | }
|
1214 | 1220 |
|
1215 |
| - private static PSet dir(VirtualFrame frame, Node inliningTarget, Object klass, PyObjectLookupAttr lookupAttrNode, com.oracle.graal.python.nodes.call.CallNode callNode, |
1216 |
| - GetFixedAttributeNode getBasesNode, ToArrayNode toArrayNode) { |
1217 |
| - PSet names = PFactory.createSet(PythonLanguage.get(inliningTarget)); |
1218 |
| - Object updateCallable = lookupAttrNode.execute(frame, inliningTarget, names, T_UPDATE); |
1219 |
| - Object ns = lookupAttrNode.execute(frame, inliningTarget, klass, T___DICT__); |
| 1221 | + @TruffleBoundary |
| 1222 | + public static void dir(PSet names, Object klass) { |
| 1223 | + Object ns = PyObjectLookupAttr.executeUncached(klass, T___DICT__); |
| 1224 | + UpdateSingleNode updateSingleNode = UpdateSingleNode.getUncached(); |
1220 | 1225 | if (ns != NO_VALUE) {
|
1221 |
| - callNode.execute(frame, updateCallable, ns); |
| 1226 | + updateSingleNode.execute(null, names, ns); |
1222 | 1227 | }
|
1223 |
| - Object basesAttr = getBasesNode.execute(frame, klass); |
| 1228 | + Object basesAttr = PyObjectLookupAttr.executeUncached(klass, T___BASES__); |
1224 | 1229 | if (basesAttr instanceof PTuple) {
|
1225 |
| - Object[] bases = toArrayNode.execute(inliningTarget, ((PTuple) basesAttr).getSequenceStorage()); |
| 1230 | + Object[] bases = ToArrayNode.executeUncached(((PTuple) basesAttr).getSequenceStorage()); |
1226 | 1231 | for (Object cls : bases) {
|
1227 | 1232 | // Note that since we are only interested in the keys, the order
|
1228 | 1233 | // we merge classes is unimportant
|
1229 |
| - Object baseNames = dir(frame, inliningTarget, cls, lookupAttrNode, callNode, getBasesNode, toArrayNode); |
1230 |
| - callNode.execute(frame, updateCallable, baseNames); |
| 1234 | + dir(names, cls); |
1231 | 1235 | }
|
1232 | 1236 | }
|
1233 |
| - return names; |
1234 | 1237 | }
|
1235 | 1238 |
|
1236 | 1239 | @NeverDefault
|
|
0 commit comments