Skip to content

Commit 5b7bd53

Browse files
committed
cleanup docs and obsolete fields
1 parent cfacc4a commit 5b7bd53

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public void initialize(PythonCore core) {
8080
Object builtinDoc = builtin.doc().isEmpty() ? PNone.NONE : builtin.doc();
8181
if (constructsClass != PythonBuiltinClassType.nil) {
8282
assert !builtin.isGetter() && !builtin.isSetter() && !builtin.isClassmethod() && !builtin.isStaticmethod();
83-
// we explicitly do not make these "classmethods" here, since CPython also doesn't
83+
// we explicitly do not make these "staticmethods" here, since CPython also doesn't
8484
// for builtin types
8585
PBuiltinFunction newFunc = core.factory().createBuiltinFunction(__NEW__, constructsClass, numDefaults(builtin), callTarget);
8686
PythonBuiltinClass builtinClass = core.lookupType(constructsClass);
@@ -129,7 +129,7 @@ private void initializeEachFactoryWith(BiConsumer<NodeFactory<? extends PythonBu
129129
if (!constructsClass) {
130130
constructsClass = builtin.constructsClass() != PythonBuiltinClassType.nil;
131131
} else {
132-
// we rely on this in PythonTpNewBuiltinNode#getOwner
132+
// we rely on this in WrapTpNew#getOwner
133133
throw new IllegalStateException(String.format("Implementation error in %s: only one @Builtin annotation can declare a class constructor.", factory.getNodeClass().getName()));
134134
}
135135
func.accept(factory, builtin);

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/function/builtins/WrapTpNew.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ public final class WrapTpNew extends SlotWrapper {
7272
private static final short NOT_SUBTP_STATE = 0b10000000;
7373
private static final short NOT_CLASS_STATE = 0b01000000;
7474
private static final short IS_UNSAFE_STATE = 0b00100000;
75-
private static final short NONCONSTANT_MRO = 0b00010000;
76-
private static final short MRO_LENGTH_MASK = 0b00001111;
7775

7876
public WrapTpNew(BuiltinCallNode func) {
7977
super(func);
@@ -188,13 +186,11 @@ private PythonBuiltinClassType getOwner() {
188186

189187
@Override
190188
public NodeCost getCost() {
191-
if (state == 0) {
192-
return NodeCost.UNINITIALIZED;
193-
} else if ((state & ~MRO_LENGTH_MASK) == 0) {
194-
// no error states, single mro
189+
if (isType == null) {
190+
// only run with owner
195191
return NodeCost.MONOMORPHIC;
196-
} else if (((state & ~MRO_LENGTH_MASK) & NONCONSTANT_MRO) == NONCONSTANT_MRO) {
197-
// no error states, multiple mros
192+
} else if (state == 0) {
193+
// no error states, but we did see a subtype
198194
return NodeCost.POLYMORPHIC;
199195
} else {
200196
// error states

0 commit comments

Comments
 (0)