Skip to content

Commit f314842

Browse files
committed
Remove PythonBuiltinClassType#type field
1 parent b093cef commit f314842

File tree

3 files changed

+3
-24
lines changed

3 files changed

+3
-24
lines changed

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

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1473,7 +1473,6 @@ public TypeBuilder doc(String doc) {
14731473
private final TruffleString doc;
14741474

14751475
// initialized in static constructor
1476-
@CompilationFinal private PythonBuiltinClassType type;
14771476
@CompilationFinal private int weaklistoffset;
14781477

14791478
/**
@@ -1539,10 +1538,6 @@ public TruffleString getPrintName() {
15391538
return printName;
15401539
}
15411540

1542-
public PythonBuiltinClassType getType() {
1543-
return type;
1544-
}
1545-
15461541
public PythonBuiltinClassType getBase() {
15471542
return base;
15481543
}
@@ -1596,31 +1591,14 @@ public final Shape getInstanceShape(PythonLanguage lang) {
15961591
@CompilationFinal(dimensions = 1) public static final PythonBuiltinClassType[] VALUES = Arrays.copyOf(values(), values().length);
15971592

15981593
static {
1599-
PythonObject.type = PythonClass;
1600-
16011594
boolean assertionsEnabled = false;
16021595
assert (assertionsEnabled = true) == true;
16031596
HashSet<String> set = assertionsEnabled ? new HashSet<>() : null;
16041597
for (PythonBuiltinClassType type : VALUES) {
16051598
// check uniqueness
16061599
assert set.add("" + type.moduleName + "." + type.name) : type.name();
1607-
1608-
/*
1609-
* Now the only way base can still be null is if type is PythonObject.
1610-
*/
1611-
if (type.type == null && type.base != null) {
1612-
type.type = type.base.type;
1613-
}
1614-
16151600
type.weaklistoffset = WeakRefModuleBuiltins.getBuiltinTypeWeaklistoffset(type);
16161601
}
1617-
1618-
// Finally, we set all remaining types to PythonClass.
1619-
for (PythonBuiltinClassType type : VALUES) {
1620-
if (type.type == null) {
1621-
type.type = PythonClass;
1622-
}
1623-
}
16241602
}
16251603

16261604
/**

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ public final class PythonBuiltinClass extends PythonManagedClass {
6767

6868
@TruffleBoundary
6969
public PythonBuiltinClass(PythonLanguage lang, PythonBuiltinClassType builtinClass, PythonAbstractClass base) {
70-
super(null, lang, builtinClass.getType(), builtinClass.getType().getInstanceShape(lang), builtinClass.getInstanceShape(lang), builtinClass.getName(), base, new PythonAbstractClass[]{base},
70+
super(null, lang, PythonBuiltinClassType.PythonClass, PythonBuiltinClassType.PythonClass.getInstanceShape(lang), builtinClass.getInstanceShape(lang), builtinClass.getName(), base,
71+
new PythonAbstractClass[]{base},
7172
builtinClass.getSlots());
7273
this.type = builtinClass;
7374
}

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/object/GetClassNode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ static Object doNativeObject(Node inliningTarget, PythonAbstractNativeObject obj
173173

174174
@Specialization
175175
static Object getPBCT(PythonBuiltinClassType object) {
176-
return object.getType();
176+
return PythonBuiltinClassType.PythonClass;
177177
}
178178

179179
@Specialization

0 commit comments

Comments
 (0)