Skip to content

Commit 5876e5a

Browse files
qunaibitsteve-s
authored andcommitted
clean up
1 parent 43223bd commit 5876e5a

File tree

1 file changed

+1
-49
lines changed

1 file changed

+1
-49
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/cext/PythonCextSlotBuiltins.java

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@
9494

9595
import java.nio.charset.CharsetEncoder;
9696
import java.nio.charset.StandardCharsets;
97-
import java.util.Set;
9897

9998
import com.oracle.graal.python.builtins.PythonBuiltinClassType;
10099
import com.oracle.graal.python.builtins.modules.cext.PythonCextBuiltins.CApiBinaryBuiltinNode;
@@ -118,13 +117,9 @@
118117
import com.oracle.graal.python.builtins.objects.cext.structs.CStructs;
119118
import com.oracle.graal.python.builtins.objects.common.DynamicObjectStorage;
120119
import com.oracle.graal.python.builtins.objects.common.HashingStorage;
121-
import com.oracle.graal.python.builtins.objects.common.HashingStorageNodes.HashingStorageForEach;
122-
import com.oracle.graal.python.builtins.objects.common.HashingStorageNodes.HashingStorageForEachCallback;
123-
import com.oracle.graal.python.builtins.objects.common.HashingStorageNodes.HashingStorageGetItemWithHash;
124120
import com.oracle.graal.python.builtins.objects.common.HashingStorageNodes.HashingStorageGetIterator;
125121
import com.oracle.graal.python.builtins.objects.common.HashingStorageNodes.HashingStorageIterator;
126122
import com.oracle.graal.python.builtins.objects.common.HashingStorageNodes.HashingStorageIteratorKey;
127-
import com.oracle.graal.python.builtins.objects.common.HashingStorageNodes.HashingStorageIteratorKeyHash;
128123
import com.oracle.graal.python.builtins.objects.common.HashingStorageNodes.HashingStorageIteratorNext;
129124
import com.oracle.graal.python.builtins.objects.common.HashingStorageNodes.HashingStorageIteratorValue;
130125
import com.oracle.graal.python.builtins.objects.common.HashingStorageNodes.HashingStorageLen;
@@ -143,12 +138,9 @@
143138
import com.oracle.graal.python.builtins.objects.str.PString;
144139
import com.oracle.graal.python.builtins.objects.str.StringNodes.StringLenNode;
145140
import com.oracle.graal.python.builtins.objects.str.StringNodes.StringMaterializeNode;
146-
import com.oracle.graal.python.builtins.objects.type.PythonAbstractClass;
147-
import com.oracle.graal.python.builtins.objects.type.PythonClass;
148141
import com.oracle.graal.python.builtins.objects.type.PythonManagedClass;
149142
import com.oracle.graal.python.builtins.objects.type.TypeBuiltins;
150143
import com.oracle.graal.python.builtins.objects.type.TypeNodes;
151-
import com.oracle.graal.python.builtins.objects.type.TypeNodes.GetSubclassesNode;
152144
import com.oracle.graal.python.lib.PyObjectLookupAttr;
153145
import com.oracle.graal.python.nodes.PGuards;
154146
import com.oracle.graal.python.nodes.SpecialAttributeNames;
@@ -170,9 +162,7 @@
170162
import com.oracle.truffle.api.dsl.Cached;
171163
import com.oracle.truffle.api.dsl.Cached.Exclusive;
172164
import com.oracle.truffle.api.dsl.Fallback;
173-
import com.oracle.truffle.api.dsl.GenerateUncached;
174165
import com.oracle.truffle.api.dsl.Specialization;
175-
import com.oracle.truffle.api.frame.Frame;
176166
import com.oracle.truffle.api.library.CachedLibrary;
177167
import com.oracle.truffle.api.nodes.Node;
178168
import com.oracle.truffle.api.object.DynamicObjectLibrary;
@@ -856,45 +846,6 @@ static Object doTpDictoffset(PythonManagedClass object, long value,
856846

857847
}
858848

859-
@CApiBuiltin(ret = Void, args = {PyTypeObject, PyObject}, call = Ignored)
860-
abstract static class Py_set_PyTypeObject_tp_subclasses extends CApiBinaryBuiltinNode {
861-
862-
@GenerateUncached
863-
abstract static class EachSubclassAdd extends HashingStorageForEachCallback<Set<PythonAbstractClass>> {
864-
865-
@Override
866-
public abstract Set<PythonAbstractClass> execute(Frame frame, Node inliningTarget, HashingStorage storage, HashingStorageIterator it, Set<PythonAbstractClass> subclasses);
867-
868-
@Specialization
869-
public Set<PythonAbstractClass> doIt(Frame frame, @SuppressWarnings("unused") Node inliningTarget, HashingStorage storage, HashingStorageIterator it, Set<PythonAbstractClass> subclasses,
870-
@Cached HashingStorageIteratorKey itKey,
871-
@Cached HashingStorageIteratorKeyHash itKeyHash,
872-
@Cached HashingStorageGetItemWithHash getItemNode) {
873-
long hash = itKeyHash.execute(inliningTarget, storage, it);
874-
Object key = itKey.execute(inliningTarget, storage, it);
875-
setAdd(subclasses, (PythonClass) getItemNode.execute(frame, inliningTarget, storage, key, hash));
876-
return subclasses;
877-
}
878-
879-
@TruffleBoundary
880-
protected static void setAdd(Set<PythonAbstractClass> set, PythonClass cls) {
881-
set.add(cls);
882-
}
883-
}
884-
885-
@Specialization
886-
static Object doTpSubclasses(PythonClass object, PDict dict,
887-
@Bind("this") Node inliningTarget,
888-
@Cached GetSubclassesNode getSubclassesNode,
889-
@Cached EachSubclassAdd eachNode,
890-
@Cached HashingStorageForEach forEachNode) {
891-
HashingStorage storage = dict.getDictStorage();
892-
Set<PythonAbstractClass> subclasses = getSubclassesNode.execute(inliningTarget, object);
893-
forEachNode.execute(null, inliningTarget, storage, eachNode, subclasses);
894-
return PNone.NO_VALUE;
895-
}
896-
}
897-
898849
@CApiBuiltin(name = "Py_get_dummy", ret = Pointer, args = {Pointer}, call = Ignored)
899850
abstract static class PyGetSlotDummyPtr extends CApiUnaryBuiltinNode {
900851

@@ -909,6 +860,7 @@ Object get(@SuppressWarnings("unused") Object object) {
909860
@CApiBuiltin(name = "Py_set_PyTypeObject_tp_getattro", ret = Void, args = {PyTypeObject, getattrofunc}, call = Ignored)
910861
@CApiBuiltin(name = "Py_set_PyTypeObject_tp_setattr", ret = Void, args = {PyTypeObject, setattrfunc}, call = Ignored)
911862
@CApiBuiltin(name = "Py_set_PyTypeObject_tp_setattro", ret = Void, args = {PyTypeObject, setattrofunc}, call = Ignored)
863+
@CApiBuiltin(name = "Py_set_PyTypeObject_tp_subclasses", ret = Void, args = {PyTypeObject, PyObject}, call = Ignored)
912864
@CApiBuiltin(name = "Py_set_PyTypeObject_tp_finalize", ret = Void, args = {PyTypeObject, destructor}, call = Ignored)
913865
@CApiBuiltin(name = "Py_set_PyTypeObject_tp_iter", ret = Void, args = {PyTypeObject, getiterfunc}, call = Ignored)
914866
@CApiBuiltin(name = "Py_set_PyTypeObject_tp_iternext", ret = Void, args = {PyTypeObject, iternextfunc}, call = Ignored)

0 commit comments

Comments
 (0)