|
48 | 48 | import static com.oracle.graal.python.builtins.objects.cext.structs.CFields.PyTypeObject__tp_del;
|
49 | 49 | import static com.oracle.graal.python.builtins.objects.cext.structs.CFields.PyTypeObject__tp_free;
|
50 | 50 | import static com.oracle.graal.python.builtins.objects.cext.structs.CFields.PyTypeObject__tp_vectorcall_offset;
|
51 |
| -import static com.oracle.graal.python.builtins.objects.cext.structs.CFields.PyTypeObject__tp_weaklistoffset; |
52 | 51 | import static com.oracle.graal.python.builtins.objects.type.TypeBuiltins.TYPE_ALLOC;
|
53 |
| -import static com.oracle.graal.python.nodes.SpecialAttributeNames.T___WEAKLISTOFFSET__; |
54 |
| -import static com.oracle.graal.python.nodes.SpecialMethodNames.T___NEW__; |
55 | 52 |
|
56 | 53 | import com.oracle.graal.python.builtins.PythonBuiltinClassType;
|
57 | 54 | import com.oracle.graal.python.builtins.modules.ctypes.StgDictObject;
|
58 | 55 | import com.oracle.graal.python.builtins.objects.PNone;
|
59 |
| -import com.oracle.graal.python.builtins.objects.PythonAbstractObject.PInteropGetAttributeNode; |
60 |
| -import com.oracle.graal.python.builtins.objects.PythonAbstractObjectFactory.PInteropGetAttributeNodeGen; |
61 | 56 | import com.oracle.graal.python.builtins.objects.cext.capi.CExtNodesFactory.LookupNativeI64MemberInMRONodeGen;
|
62 | 57 | import com.oracle.graal.python.builtins.objects.cext.capi.CExtNodesFactory.LookupNativeMemberInMRONodeGen;
|
63 | 58 | import com.oracle.graal.python.builtins.objects.cext.capi.transitions.CApiTransitions.PythonToNativeNewRefNode;
|
|
75 | 70 | import com.oracle.graal.python.builtins.objects.dict.PDict;
|
76 | 71 | import com.oracle.graal.python.builtins.objects.method.PDecoratedMethod;
|
77 | 72 | import com.oracle.graal.python.builtins.objects.str.PString;
|
78 |
| -import com.oracle.graal.python.builtins.objects.type.PythonBuiltinClass; |
79 | 73 | import com.oracle.graal.python.builtins.objects.type.PythonManagedClass;
|
| 74 | +import com.oracle.graal.python.builtins.objects.type.SpecialMethodSlot; |
80 | 75 | import com.oracle.graal.python.builtins.objects.type.TypeBuiltins;
|
81 | 76 | import com.oracle.graal.python.builtins.objects.type.TypeNodes.GetBaseClassNode;
|
82 | 77 | import com.oracle.graal.python.builtins.objects.type.TypeNodes.GetBaseClassesNode;
|
| 78 | +import com.oracle.graal.python.builtins.objects.type.TypeNodes.GetBasicSizeNode; |
| 79 | +import com.oracle.graal.python.builtins.objects.type.TypeNodes.GetItemSizeNode; |
83 | 80 | import com.oracle.graal.python.builtins.objects.type.TypeNodes.GetMroStorageNode;
|
84 | 81 | import com.oracle.graal.python.builtins.objects.type.TypeNodes.GetTypeFlagsNode;
|
85 |
| -import com.oracle.graal.python.builtins.objects.type.TypeNodesFactory.GetBasicSizeNodeGen; |
| 82 | +import com.oracle.graal.python.builtins.objects.type.TypeNodes.GetWeakListOffsetNode; |
86 | 83 | import com.oracle.graal.python.builtins.objects.type.TypeNodesFactory.GetDictOffsetNodeGen;
|
87 |
| -import com.oracle.graal.python.builtins.objects.type.TypeNodesFactory.GetItemSizeNodeGen; |
88 | 84 | import com.oracle.graal.python.builtins.objects.type.TypeNodesFactory.GetTypeFlagsNodeGen;
|
89 |
| -import com.oracle.graal.python.lib.PyNumberAsSizeNode; |
90 |
| -import com.oracle.graal.python.lib.PyNumberAsSizeNodeGen; |
91 | 85 | import com.oracle.graal.python.nodes.PNodeWithContext;
|
92 | 86 | import com.oracle.graal.python.nodes.SpecialAttributeNames;
|
93 |
| -import com.oracle.graal.python.nodes.attributes.LookupAttributeInMRONode; |
94 |
| -import com.oracle.graal.python.nodes.attributes.LookupAttributeInMRONodeGen; |
| 87 | +import com.oracle.graal.python.nodes.attributes.LookupCallableSlotInMRONode; |
95 | 88 | import com.oracle.graal.python.nodes.attributes.LookupNativeSlotNode;
|
96 | 89 | import com.oracle.graal.python.nodes.attributes.LookupNativeSlotNodeGen.LookupNativeGetattroSlotNodeGen;
|
97 | 90 | import com.oracle.graal.python.nodes.object.BuiltinClassProfiles.InlineIsBuiltinClassProfile;
|
@@ -268,9 +261,6 @@ static void initializeType(PythonClassNativeWrapper obj, Object mem,
|
268 | 261 |
|
269 | 262 | PythonToNativeNode toNative = PythonToNativeNodeGen.getUncached();
|
270 | 263 | PythonToNativeNewRefNode toNativeNewRef = PythonToNativeNewRefNodeGen.getUncached();
|
271 |
| - LookupAttributeInMRONode.Dynamic lookupAttrNode = LookupAttributeInMRONodeGen.DynamicNodeGen.getUncached(); |
272 |
| - PyNumberAsSizeNode asSizeNode = PyNumberAsSizeNodeGen.getUncached(); |
273 |
| - PInteropGetAttributeNode getAttrNode = PInteropGetAttributeNodeGen.getUncached(); |
274 | 264 | CastToTruffleStringNode castToStringNode = CastToTruffleStringNode.getUncached();
|
275 | 265 | CStructAccess.WritePointerNode writePtrNode = CStructAccessFactory.WritePointerNodeGen.getUncached();
|
276 | 266 | CStructAccess.WriteLongNode writeI64Node = CStructAccessFactory.WriteLongNodeGen.getUncached();
|
@@ -299,8 +289,9 @@ static void initializeType(PythonClassNativeWrapper obj, Object mem,
|
299 | 289 | writeI64Node.write(mem, CFields.PyVarObject__ob_size, 0L);
|
300 | 290 |
|
301 | 291 | writePtrNode.write(mem, CFields.PyTypeObject__tp_name, clazz.getClassNativeWrapper().getNameWrapper());
|
302 |
| - writeI64Node.write(mem, CFields.PyTypeObject__tp_basicsize, GetBasicSizeNodeGen.getUncached().execute(null, clazz)); |
303 |
| - writeI64Node.write(mem, CFields.PyTypeObject__tp_itemsize, GetItemSizeNodeGen.getUncached().execute(null, clazz)); |
| 292 | + writeI64Node.write(mem, CFields.PyTypeObject__tp_basicsize, GetBasicSizeNode.executeUncached(clazz)); |
| 293 | + writeI64Node.write(mem, CFields.PyTypeObject__tp_itemsize, GetItemSizeNode.executeUncached(clazz)); |
| 294 | + writeI64Node.write(mem, CFields.PyTypeObject__tp_weaklistoffset, GetWeakListOffsetNode.executeUncached(clazz)); |
304 | 295 | writePtrNode.write(mem, CFields.PyTypeObject__tp_dealloc, lookup(clazz, PyTypeObject__tp_dealloc, TypeBuiltins.TYPE_DEALLOC));
|
305 | 296 | writeI64Node.write(mem, CFields.PyTypeObject__tp_vectorcall_offset, lookupSize(clazz, PyTypeObject__tp_vectorcall_offset, TypeBuiltins.TYPE_VECTORCALL_OFFSET));
|
306 | 297 | writePtrNode.write(mem, CFields.PyTypeObject__tp_getattr, nullValue);
|
@@ -333,13 +324,6 @@ static void initializeType(PythonClassNativeWrapper obj, Object mem,
|
333 | 324 | writePtrNode.write(mem, CFields.PyTypeObject__tp_traverse, nullValue);
|
334 | 325 | writePtrNode.write(mem, CFields.PyTypeObject__tp_clear, nullValue);
|
335 | 326 | writePtrNode.write(mem, CFields.PyTypeObject__tp_richcompare, lookup(clazz, SlotMethodDef.TP_RICHCOMPARE));
|
336 |
| - long weaklistoffset; |
337 |
| - if (clazz instanceof PythonBuiltinClass builtin) { |
338 |
| - weaklistoffset = builtin.getType().getWeaklistoffset(); |
339 |
| - } else { |
340 |
| - weaklistoffset = LookupNativeI64MemberInMRONodeGen.getUncached().execute(clazz, PyTypeObject__tp_weaklistoffset, T___WEAKLISTOFFSET__); |
341 |
| - } |
342 |
| - writeI64Node.write(mem, CFields.PyTypeObject__tp_weaklistoffset, weaklistoffset); |
343 | 327 | writePtrNode.write(mem, CFields.PyTypeObject__tp_iter, lookup(clazz, SlotMethodDef.TP_ITER));
|
344 | 328 | writePtrNode.write(mem, CFields.PyTypeObject__tp_iternext, lookup(clazz, SlotMethodDef.TP_ITERNEXT));
|
345 | 329 | writePtrNode.write(mem, CFields.PyTypeObject__tp_methods, nullValue);
|
@@ -373,7 +357,7 @@ static void initializeType(PythonClassNativeWrapper obj, Object mem,
|
373 | 357 | writePtrNode.write(mem, CFields.PyTypeObject__tp_alloc, lookup(clazz, PyTypeObject__tp_alloc, TYPE_ALLOC));
|
374 | 358 | // T___new__ is magically a staticmethod for Python types. The tp_new slot lookup
|
375 | 359 | // expects to get the function
|
376 |
| - Object newFunction = lookupAttrNode.execute(clazz, T___NEW__); |
| 360 | + Object newFunction = LookupCallableSlotInMRONode.getUncached(SpecialMethodSlot.New).execute(clazz); |
377 | 361 | if (newFunction instanceof PDecoratedMethod) {
|
378 | 362 | newFunction = ((PDecoratedMethod) newFunction).getCallable();
|
379 | 363 | }
|
|
0 commit comments