Skip to content

Commit 7e9031c

Browse files
committed
remove duplicated check for unused frame from special call nodes
1 parent c3ae1d7 commit 7e9031c

File tree

6 files changed

+60
-114
lines changed

6 files changed

+60
-114
lines changed

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,6 @@ private <T extends PythonBuiltinBaseNode> boolean callerExceedsMaxSize(T builtin
197197
return true;
198198
}
199199

200-
protected static boolean frameIsUnused(PythonBuiltinBaseNode builtinNode) {
201-
return builtinNode == null || !builtinNode.getClass().getAnnotation(GeneratedBy.class).value().getAnnotationsByType(Builtin.class)[0].needsFrame();
202-
}
203-
204200
PythonVarargsBuiltinNode getVarargs(VirtualFrame frame, Object func) {
205201
CompilerAsserts.neverPartOfCompilation();
206202
if (func instanceof PBuiltinFunction builtinFunc) {

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

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -133,73 +133,62 @@ Object callSpecialMethodSlotCallTarget(VirtualFrame frame, BuiltinMethodDescript
133133
return invokeNode.execute(frame, callTarget, arguments);
134134
}
135135

136-
@Specialization(guards = {"isSingleContext()", "func == cachedFunc", "builtinNode != null",
137-
"frame != null || unusedFrame"}, limit = "getCallSiteInlineCacheMaxDepth()")
136+
@Specialization(guards = {"isSingleContext()", "func == cachedFunc", "builtinNode != null"}, limit = "getCallSiteInlineCacheMaxDepth()")
138137
static Object callObjectSingleContext(VirtualFrame frame, @SuppressWarnings("unused") PBuiltinFunction func, Object arg1, Object arg2,
139138
@SuppressWarnings("unused") @Cached("func") PBuiltinFunction cachedFunc,
140139
@SuppressWarnings("unused") @Cached("isForReverseBinaryOperation(func.getCallTarget())") boolean isReverse,
141-
@Cached("getBuiltin(frame, func, 2)") PythonBuiltinBaseNode builtinNode,
142-
@SuppressWarnings("unused") @Cached("frameIsUnused(builtinNode)") boolean unusedFrame) {
140+
@Cached("getBuiltin(frame, func, 2)") PythonBuiltinBaseNode builtinNode) {
143141
if (isReverse) {
144142
return callBinaryBuiltin(frame, builtinNode, arg2, arg1);
145143
} else {
146144
return callBinaryBuiltin(frame, builtinNode, arg1, arg2);
147145
}
148146
}
149147

150-
@Specialization(guards = {"func.getCallTarget() == ct", "builtinNode != null", "frame != null || unusedFrame"}, //
148+
@Specialization(guards = {"func.getCallTarget() == ct", "builtinNode != null"}, //
151149
limit = "getCallSiteInlineCacheMaxDepth()")
152150
static Object callObject(VirtualFrame frame, @SuppressWarnings("unused") PBuiltinFunction func, Object arg1, Object arg2,
153151
@SuppressWarnings("unused") @Cached("func.getCallTarget()") RootCallTarget ct,
154152
@SuppressWarnings("unused") @Cached("isForReverseBinaryOperation(func.getCallTarget())") boolean isReverse,
155-
@Cached("getBuiltin(frame, func, 2)") PythonBuiltinBaseNode builtinNode,
156-
@SuppressWarnings("unused") @Cached("frameIsUnused(builtinNode)") boolean unusedFrame) {
153+
@Cached("getBuiltin(frame, func, 2)") PythonBuiltinBaseNode builtinNode) {
157154
if (isReverse) {
158155
return callBinaryBuiltin(frame, builtinNode, arg2, arg1);
159156
} else {
160157
return callBinaryBuiltin(frame, builtinNode, arg1, arg2);
161158
}
162159
}
163160

164-
@Specialization(guards = {"isSingleContext()", "func == cachedFunc", "builtinNode != null", "!takesSelfArg",
165-
"frame != null || unusedFrame"}, limit = "getCallSiteInlineCacheMaxDepth()")
161+
@Specialization(guards = {"isSingleContext()", "func == cachedFunc", "builtinNode != null", "!takesSelfArg"}, limit = "getCallSiteInlineCacheMaxDepth()")
166162
static Object callMethodSingleContext(VirtualFrame frame, @SuppressWarnings("unused") PBuiltinMethod func, Object arg1, Object arg2,
167163
@SuppressWarnings("unused") @Cached("func") PBuiltinMethod cachedFunc,
168164
@SuppressWarnings("unused") @Cached("takesSelfArg(func)") boolean takesSelfArg,
169-
@Cached("getBuiltin(frame, func.getFunction(), 2)") PythonBuiltinBaseNode builtinNode,
170-
@SuppressWarnings("unused") @Cached("frameIsUnused(builtinNode)") boolean unusedFrame) {
165+
@Cached("getBuiltin(frame, func.getFunction(), 2)") PythonBuiltinBaseNode builtinNode) {
171166
return callBinaryBuiltin(frame, builtinNode, arg1, arg2);
172167
}
173168

174-
@Specialization(guards = {"builtinNode != null", "getCallTarget(func, getCt) == ct", "!takesSelfArg",
175-
"frame != null || unusedFrame"}, limit = "getCallSiteInlineCacheMaxDepth()")
169+
@Specialization(guards = {"builtinNode != null", "getCallTarget(func, getCt) == ct", "!takesSelfArg"}, limit = "getCallSiteInlineCacheMaxDepth()")
176170
static Object callMethod(VirtualFrame frame, @SuppressWarnings("unused") PBuiltinMethod func, Object arg1, Object arg2,
177171
@SuppressWarnings("unused") @Cached GetCallTargetNode getCt,
178172
@SuppressWarnings("unused") @Cached("getCallTarget(func, getCt)") RootCallTarget ct,
179173
@SuppressWarnings("unused") @Cached("takesSelfArg(func)") boolean takesSelfArg,
180-
@Cached("getBuiltin(frame, func.getFunction(), 2)") PythonBuiltinBaseNode builtinNode,
181-
@SuppressWarnings("unused") @Cached("frameIsUnused(builtinNode)") boolean unusedFrame) {
174+
@Cached("getBuiltin(frame, func.getFunction(), 2)") PythonBuiltinBaseNode builtinNode) {
182175
return callBinaryBuiltin(frame, builtinNode, arg1, arg2);
183176
}
184177

185-
@Specialization(guards = {"isSingleContext()", "func == cachedFunc", "builtinNode != null", "takesSelfArg",
186-
"frame != null || unusedFrame"}, limit = "getCallSiteInlineCacheMaxDepth()")
178+
@Specialization(guards = {"isSingleContext()", "func == cachedFunc", "builtinNode != null", "takesSelfArg"}, limit = "getCallSiteInlineCacheMaxDepth()")
187179
static Object callMethodSingleContextSelf(VirtualFrame frame, @SuppressWarnings("unused") PBuiltinMethod func, Object arg1, Object arg2,
188180
@SuppressWarnings("unused") @Cached(value = "func", weak = true) PBuiltinMethod cachedFunc,
189181
@SuppressWarnings("unused") @Cached("takesSelfArg(func)") boolean takesSelfArg,
190-
@Cached("getBuiltin(frame, func.getFunction(), 3)") PythonBuiltinBaseNode builtinNode,
191-
@SuppressWarnings("unused") @Cached("frameIsUnused(builtinNode)") boolean unusedFrame) {
182+
@Cached("getBuiltin(frame, func.getFunction(), 3)") PythonBuiltinBaseNode builtinNode) {
192183
return callTernaryBuiltin(frame, builtinNode, cachedFunc.getSelf(), arg1, arg2);
193184
}
194185

195-
@Specialization(guards = {"builtinNode != null", "getCallTarget(func, getCt) == ct", "takesSelfArg",
196-
"frame != null || unusedFrame"}, limit = "getCallSiteInlineCacheMaxDepth()")
186+
@Specialization(guards = {"builtinNode != null", "getCallTarget(func, getCt) == ct", "takesSelfArg"}, limit = "getCallSiteInlineCacheMaxDepth()")
197187
static Object callMethodSelf(VirtualFrame frame, @SuppressWarnings("unused") PBuiltinMethod func, Object arg1, Object arg2,
198188
@SuppressWarnings("unused") @Cached GetCallTargetNode getCt,
199189
@SuppressWarnings("unused") @Cached("getCallTarget(func, getCt)") RootCallTarget ct,
200190
@SuppressWarnings("unused") @Cached("takesSelfArg(func)") boolean takesSelfArg,
201-
@Cached("getBuiltin(frame, func.getFunction(), 3)") PythonBuiltinBaseNode builtinNode,
202-
@SuppressWarnings("unused") @Cached("frameIsUnused(builtinNode)") boolean unusedFrame) {
191+
@Cached("getBuiltin(frame, func.getFunction(), 3)") PythonBuiltinBaseNode builtinNode) {
203192
return callTernaryBuiltin(frame, builtinNode, func.getSelf(), arg1, arg2);
204193
}
205194

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

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -69,42 +69,36 @@ public static CallQuaternaryMethodNode getUncached() {
6969

7070
public abstract Object execute(Frame frame, Object callable, Object arg1, Object arg2, Object arg3, Object arg4);
7171

72-
@Specialization(guards = {"isSingleContext()", "func == cachedFunc", "builtinNode != null", "frame != null || unusedFrame"}, //
72+
@Specialization(guards = {"isSingleContext()", "func == cachedFunc", "builtinNode != null"}, //
7373
limit = "getCallSiteInlineCacheMaxDepth()")
7474
Object callSingle(VirtualFrame frame, @SuppressWarnings("unused") PBuiltinFunction func, Object arg1, Object arg2, Object arg3, Object arg4,
7575
@SuppressWarnings("unused") @Cached("func") PBuiltinFunction cachedFunc,
76-
@Cached("getBuiltin(frame, func, 4)") PythonBuiltinBaseNode builtinNode,
77-
@SuppressWarnings("unused") @Cached("frameIsUnused(builtinNode)") boolean unusedFrame) {
76+
@Cached("getBuiltin(frame, func, 4)") PythonBuiltinBaseNode builtinNode) {
7877
return callQuaternaryBuiltin(frame, builtinNode, arg1, arg2, arg3, arg4);
7978
}
8079

81-
@Specialization(guards = {"func.getCallTarget() == ct", "builtinNode != null", "frame != null || unusedFrame"}, //
80+
@Specialization(guards = {"func.getCallTarget() == ct", "builtinNode != null"}, //
8281
limit = "getCallSiteInlineCacheMaxDepth()")
8382
Object call(VirtualFrame frame, @SuppressWarnings("unused") PBuiltinFunction func, Object arg1, Object arg2, Object arg3, Object arg4,
8483
@SuppressWarnings("unused") @Cached("func.getCallTarget()") RootCallTarget ct,
85-
@Cached("getBuiltin(frame, func, 4)") PythonBuiltinBaseNode builtinNode,
86-
@SuppressWarnings("unused") @Cached("frameIsUnused(builtinNode)") boolean unusedFrame) {
84+
@Cached("getBuiltin(frame, func, 4)") PythonBuiltinBaseNode builtinNode) {
8785
return callQuaternaryBuiltin(frame, builtinNode, arg1, arg2, arg3, arg4);
8886
}
8987

90-
@Specialization(guards = {"isSingleContext()", "func == cachedFunc", "builtinNode != null", "!takesSelfArg",
91-
"frame != null || unusedFrame"}, limit = "getCallSiteInlineCacheMaxDepth()")
88+
@Specialization(guards = {"isSingleContext()", "func == cachedFunc", "builtinNode != null", "!takesSelfArg"}, limit = "getCallSiteInlineCacheMaxDepth()")
9289
Object callMethodSingle(VirtualFrame frame, @SuppressWarnings("unused") PBuiltinMethod func, Object arg1, Object arg2, Object arg3, Object arg4,
9390
@SuppressWarnings("unused") @Cached("func") PBuiltinMethod cachedFunc,
9491
@SuppressWarnings("unused") @Cached("takesSelfArg(func)") boolean takesSelfArg,
95-
@Cached("getBuiltin(frame, func.getFunction(), 4)") PythonBuiltinBaseNode builtinNode,
96-
@SuppressWarnings("unused") @Cached("frameIsUnused(builtinNode)") boolean unusedFrame) {
92+
@Cached("getBuiltin(frame, func.getFunction(), 4)") PythonBuiltinBaseNode builtinNode) {
9793
return callQuaternaryBuiltin(frame, builtinNode, arg1, arg2, arg3, arg4);
9894
}
9995

100-
@Specialization(guards = {"builtinNode != null", "getCallTarget(func, getCt) == ct", "!takesSelfArg",
101-
"frame != null || unusedFrame"}, limit = "getCallSiteInlineCacheMaxDepth()")
96+
@Specialization(guards = {"builtinNode != null", "getCallTarget(func, getCt) == ct", "!takesSelfArg"}, limit = "getCallSiteInlineCacheMaxDepth()")
10297
Object callMethod(VirtualFrame frame, @SuppressWarnings("unused") PBuiltinMethod func, Object arg1, Object arg2, Object arg3, Object arg4,
10398
@SuppressWarnings("unused") @Cached GetCallTargetNode getCt,
10499
@SuppressWarnings("unused") @Cached("getCallTarget(func, getCt)") RootCallTarget ct,
105100
@SuppressWarnings("unused") @Cached("takesSelfArg(func)") boolean takesSelfArg,
106-
@Cached("getBuiltin(frame, func.getFunction(), 4)") PythonBuiltinBaseNode builtinNode,
107-
@SuppressWarnings("unused") @Cached("frameIsUnused(builtinNode)") boolean unusedFrame) {
101+
@Cached("getBuiltin(frame, func.getFunction(), 4)") PythonBuiltinBaseNode builtinNode) {
108102
return callQuaternaryBuiltin(frame, builtinNode, arg1, arg2, arg3, arg4);
109103
}
110104

0 commit comments

Comments
 (0)