Skip to content

Commit e7bf352

Browse files
committed
avoid redundant getClass calls
1 parent 6eab85e commit e7bf352

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

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

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,13 +1268,10 @@ static Object notMapping(VirtualFrame frame, Object obj,
12681268
}
12691269

12701270
protected static boolean isSetOrDeque(Object obj, IsSameTypeNode isSameType, GetClassNode getClassNode) {
1271-
return isSameType(obj, PythonBuiltinClassType.PSet, isSameType, getClassNode) ||
1272-
isSameType(obj, PythonBuiltinClassType.PFrozenSet, isSameType, getClassNode) ||
1273-
isSameType(obj, PythonBuiltinClassType.PDeque, isSameType, getClassNode);
1274-
}
1275-
1276-
private static boolean isSameType(Object obj, PythonBuiltinClassType type, IsSameTypeNode isSameType, GetClassNode getClassNode) {
1277-
return isSameType.execute(getClassNode.execute(obj), type);
1271+
Object cls = getClassNode.execute(obj);
1272+
return isSameType.execute(cls, PythonBuiltinClassType.PSet) ||
1273+
isSameType.execute(cls, PythonBuiltinClassType.PFrozenSet) ||
1274+
isSameType.execute(cls, PythonBuiltinClassType.PDeque);
12781275
}
12791276
}
12801277

0 commit comments

Comments
 (0)