Skip to content

Commit c3ae1d7

Browse files
committed
inline otherwise unused function
1 parent 95526bf commit c3ae1d7

File tree

1 file changed

+16
-25
lines changed

1 file changed

+16
-25
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/call/special/AbstractCallMethodNode.java

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -94,29 +94,6 @@ abstract class AbstractCallMethodNode extends PNodeWithContext {
9494

9595
protected abstract void setMaxSizeExceeded(boolean value);
9696

97-
/**
98-
* Returns a new instanceof the builtin if it's a subclass of the given class, and null
99-
* otherwise.
100-
*/
101-
private <T extends PythonBuiltinBaseNode> T getBuiltin(VirtualFrame frame, PBuiltinFunction func, Class<T> clazz) {
102-
CompilerAsserts.neverPartOfCompilation();
103-
NodeFactory<? extends PythonBuiltinBaseNode> builtinNodeFactory = func.getBuiltinNodeFactory();
104-
if (builtinNodeFactory == null) {
105-
return null; // see for example MethodDescriptorRoot and subclasses
106-
}
107-
assert builtinNodeFactory.getNodeClass().getAnnotationsByType(Builtin.class).length > 0 : "PBuiltinFunction " + func + " is expected to have a Builtin annotated node.";
108-
if (builtinNodeFactory.getNodeClass().getAnnotationsByType(Builtin.class)[0].needsFrame() && frame == null) {
109-
return null;
110-
}
111-
if (clazz.isAssignableFrom(builtinNodeFactory.getNodeClass())) {
112-
T builtinNode = clazz.cast(func.getBuiltinNodeFactory().createNode());
113-
if (!callerExceedsMaxSize(builtinNode)) {
114-
return builtinNode;
115-
}
116-
}
117-
return null;
118-
}
119-
12097
protected PythonBuiltinBaseNode getBuiltin(VirtualFrame frame, PBuiltinFunction func, int nargs) {
12198
CompilerAsserts.neverPartOfCompilation();
12299
NodeFactory<? extends PythonBuiltinBaseNode> builtinNodeFactory = func.getBuiltinNodeFactory();
@@ -225,8 +202,22 @@ protected static boolean frameIsUnused(PythonBuiltinBaseNode builtinNode) {
225202
}
226203

227204
PythonVarargsBuiltinNode getVarargs(VirtualFrame frame, Object func) {
228-
if (func instanceof PBuiltinFunction) {
229-
return getBuiltin(frame, (PBuiltinFunction) func, PythonVarargsBuiltinNode.class);
205+
CompilerAsserts.neverPartOfCompilation();
206+
if (func instanceof PBuiltinFunction builtinFunc) {
207+
NodeFactory<? extends PythonBuiltinBaseNode> builtinNodeFactory = builtinFunc.getBuiltinNodeFactory();
208+
if (builtinNodeFactory == null) {
209+
return null; // see for example MethodDescriptorRoot and subclasses
210+
}
211+
assert builtinNodeFactory.getNodeClass().getAnnotationsByType(Builtin.class).length > 0 : "PBuiltinFunction " + builtinFunc + " is expected to have a Builtin annotated node.";
212+
if (builtinNodeFactory.getNodeClass().getAnnotationsByType(Builtin.class)[0].needsFrame() && frame == null) {
213+
return null;
214+
}
215+
if (PythonVarargsBuiltinNode.class.isAssignableFrom(builtinNodeFactory.getNodeClass())) {
216+
PythonVarargsBuiltinNode builtinNode = (PythonVarargsBuiltinNode) builtinFunc.getBuiltinNodeFactory().createNode();
217+
if (!callerExceedsMaxSize(builtinNode)) {
218+
return builtinNode;
219+
}
220+
}
230221
}
231222
return null;
232223
}

0 commit comments

Comments
 (0)