Skip to content

Commit dad0d7b

Browse files
committed
Remove PBCT.redefinesSlot
1 parent 2fc314f commit dad0d7b

File tree

2 files changed

+1
-51
lines changed

2 files changed

+1
-51
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/PythonBuiltinClassType.java

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -680,11 +680,6 @@ private static class Flags {
680680
@CompilationFinal private PythonBuiltinClassType base;
681681
@CompilationFinal private int weaklistoffset;
682682

683-
/**
684-
* @see #redefinesSlot(SpecialMethodSlot)
685-
*/
686-
private SpecialMethodSlot[] redefinedSlots;
687-
688683
/**
689684
* Lookup cache for special slots defined in {@link SpecialMethodSlot}. Use
690685
* {@link SpecialMethodSlot} to access the values. Unlike the cache in
@@ -857,25 +852,6 @@ public int getWeaklistoffset() {
857852
return weaklistoffset;
858853
}
859854

860-
/**
861-
* Returns {@code true} if this method slot is redefined in Python code during initialization.
862-
* Values of such slots cannot be cached in {@link #specialMethodSlots}, because they are not
863-
* context independent.
864-
*/
865-
public boolean redefinesSlot(SpecialMethodSlot slot) {
866-
if (redefinedSlots != null) {
867-
for (SpecialMethodSlot redefSlot : redefinedSlots) {
868-
if (redefSlot == slot) {
869-
return true;
870-
}
871-
}
872-
}
873-
if (base != null) {
874-
return base.redefinesSlot(slot);
875-
}
876-
return false;
877-
}
878-
879855
@Override
880856
public String toString() {
881857
CompilerAsserts.neverPartOfCompilation();
@@ -889,29 +865,7 @@ public final Shape getInstanceShape(PythonLanguage lang) {
889865
@CompilationFinal(dimensions = 1) public static final PythonBuiltinClassType[] VALUES = Arrays.copyOf(values(), values().length - 1);
890866

891867
static {
892-
// fill the overridden slots
893-
SpecialMethodSlot[] newSlot = new SpecialMethodSlot[]{SpecialMethodSlot.New};
894-
895-
PStructUnpackIterator.redefinedSlots = new SpecialMethodSlot[]{SpecialMethodSlot.LengthHint};
896-
897-
// These slots actually contain context independent values, but they are initialized in
898-
// StructSequence to artificial PBuiltinFunctions with artificial builtin node factories,
899-
// which are different for each context. We'd have to turn those factories into singletons
900-
// to guarantee their identity across contexts. For the sake of simplicity, we just ignore
901-
// those slots for now.
902868
PStruct.type = PythonClass;
903-
PStructRusage.redefinedSlots = newSlot;
904-
PStructPasswd.redefinedSlots = newSlot;
905-
PUnameResult.redefinedSlots = newSlot;
906-
PUnraisableHookArgs.redefinedSlots = newSlot;
907-
PIntInfo.redefinedSlots = newSlot;
908-
PHashInfo.redefinedSlots = newSlot;
909-
PStructTime.redefinedSlots = newSlot;
910-
PProfilerEntry.redefinedSlots = newSlot;
911-
PProfilerSubentry.redefinedSlots = newSlot;
912-
PThreadInfo.redefinedSlots = newSlot;
913-
PFloatInfo.redefinedSlots = newSlot;
914-
PTerminalSize.redefinedSlots = newSlot;
915869

916870
PythonObject.type = PythonClass;
917871
PythonObject.base = null;

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/type/SpecialMethodSlot.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -340,9 +340,6 @@ private static void initializeBuiltinTypeSlotsImpl(Python3Core core) {
340340
Object[] typeSlots = new Object[VALUES.length];
341341
PythonBuiltinClass klass = core.lookupType(type);
342342
for (SpecialMethodSlot slot : VALUES) {
343-
if (type.redefinesSlot(slot)) {
344-
continue;
345-
}
346343
Object value = slot.getValue(klass);
347344
if (value instanceof PBuiltinFunction && slot.allowsBuiltinDescriptors) {
348345
BuiltinMethodDescriptor info = BuiltinMethodDescriptor.get((PBuiltinFunction) value);
@@ -900,8 +897,7 @@ private static boolean checkFind() {
900897
// debugging
901898

902899
/**
903-
* Checks that there were no builtins' slots overridden except those explicitly marked so by
904-
* {@link PythonBuiltinClassType#redefinesSlot}.
900+
* Checks that there were no builtins' slots overridden.
905901
*/
906902
public static boolean checkSlotOverrides(Python3Core core) {
907903
assert builtinSlotsInitialized;

0 commit comments

Comments
 (0)