Skip to content

Commit c27d92a

Browse files
committed
remove indirection through PythonQuaternaryBuiltinNode.call
1 parent d9117cb commit c27d92a

File tree

9 files changed

+29
-30
lines changed

9 files changed

+29
-30
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/CodecsModuleBuiltins.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,7 +1089,7 @@ abstract static class UTF8DecodeNode extends PythonTernaryBuiltinNode {
10891089
@Specialization
10901090
Object encode(VirtualFrame frame, Object obj, Object errors, Object ffinal,
10911091
@Cached CodecsDecodeNode decode) {
1092-
return decode.call(frame, obj, "utf-8", errors, ffinal);
1092+
return decode.execute(frame, obj, "utf-8", errors, ffinal);
10931093
}
10941094
}
10951095

@@ -1109,7 +1109,7 @@ abstract static class UTF7DecodeNode extends PythonTernaryBuiltinNode {
11091109
@Specialization
11101110
Object encode(VirtualFrame frame, Object obj, Object errors, Object ffinal,
11111111
@Cached CodecsDecodeNode decode) {
1112-
return decode.call(frame, obj, "utf-7", errors, ffinal);
1112+
return decode.execute(frame, obj, "utf-7", errors, ffinal);
11131113
}
11141114
}
11151115

@@ -1129,7 +1129,7 @@ abstract static class UTF16DecodeNode extends PythonTernaryBuiltinNode {
11291129
@Specialization
11301130
Object encode(VirtualFrame frame, Object obj, Object errors, Object ffinal,
11311131
@Cached CodecsDecodeNode decode) {
1132-
return decode.call(frame, obj, "utf-16", errors, ffinal);
1132+
return decode.execute(frame, obj, "utf-16", errors, ffinal);
11331133
}
11341134
}
11351135

@@ -1149,7 +1149,7 @@ abstract static class UTF16LEDecodeNode extends PythonTernaryBuiltinNode {
11491149
@Specialization
11501150
Object encode(VirtualFrame frame, Object obj, Object errors, Object ffinal,
11511151
@Cached CodecsDecodeNode decode) {
1152-
return decode.call(frame, obj, "utf-16-le", errors, ffinal);
1152+
return decode.execute(frame, obj, "utf-16-le", errors, ffinal);
11531153
}
11541154
}
11551155

@@ -1169,7 +1169,7 @@ abstract static class UTF16BEDecodeNode extends PythonTernaryBuiltinNode {
11691169
@Specialization
11701170
Object encode(VirtualFrame frame, Object obj, Object errors, Object ffinal,
11711171
@Cached CodecsDecodeNode decode) {
1172-
return decode.call(frame, obj, "utf-16-be", errors, ffinal);
1172+
return decode.execute(frame, obj, "utf-16-be", errors, ffinal);
11731173
}
11741174
}
11751175

@@ -1199,7 +1199,7 @@ abstract static class UTF32DecodeNode extends PythonTernaryBuiltinNode {
11991199
@Specialization
12001200
Object encode(VirtualFrame frame, Object obj, Object errors, Object ffinal,
12011201
@Cached CodecsDecodeNode decode) {
1202-
return decode.call(frame, obj, "utf-32", errors, ffinal);
1202+
return decode.execute(frame, obj, "utf-32", errors, ffinal);
12031203
}
12041204
}
12051205

@@ -1219,7 +1219,7 @@ abstract static class UTF32LEDecodeNode extends PythonTernaryBuiltinNode {
12191219
@Specialization
12201220
Object encode(VirtualFrame frame, Object obj, Object errors, Object ffinal,
12211221
@Cached CodecsDecodeNode decode) {
1222-
return decode.call(frame, obj, "utf-32-le", errors, ffinal);
1222+
return decode.execute(frame, obj, "utf-32-le", errors, ffinal);
12231223
}
12241224
}
12251225

@@ -1239,7 +1239,7 @@ abstract static class UTF32BEDecodeNode extends PythonTernaryBuiltinNode {
12391239
@Specialization
12401240
Object encode(VirtualFrame frame, Object obj, Object errors, Object ffinal,
12411241
@Cached CodecsDecodeNode decode) {
1242-
return decode.call(frame, obj, "utf-32-be", errors, ffinal);
1242+
return decode.execute(frame, obj, "utf-32-be", errors, ffinal);
12431243
}
12441244
}
12451245

@@ -1289,7 +1289,7 @@ abstract static class RawUnicodeEscapeDecodeNode extends PythonBinaryBuiltinNode
12891289
@Specialization
12901290
Object encode(VirtualFrame frame, Object obj, Object errors,
12911291
@Cached CodecsDecodeNode decode) {
1292-
return decode.call(frame, obj, "raw_unicode_escape", errors, true);
1292+
return decode.execute(frame, obj, "raw_unicode_escape", errors, true);
12931293
}
12941294
}
12951295

@@ -1309,7 +1309,7 @@ abstract static class UnicodeEscapeDecodeNode extends PythonBinaryBuiltinNode {
13091309
@Specialization
13101310
Object encode(VirtualFrame frame, Object obj, Object errors,
13111311
@Cached CodecsDecodeNode decode) {
1312-
return decode.call(frame, obj, "unicode_escape", errors, true);
1312+
return decode.execute(frame, obj, "unicode_escape", errors, true);
13131313
}
13141314
}
13151315

@@ -1329,7 +1329,7 @@ abstract static class Latin1EscapeDecodeNode extends PythonBinaryBuiltinNode {
13291329
@Specialization
13301330
Object encode(VirtualFrame frame, Object obj, Object errors,
13311331
@Cached CodecsDecodeNode decode) {
1332-
return decode.call(frame, obj, "latin_1", errors, true);
1332+
return decode.execute(frame, obj, "latin_1", errors, true);
13331333
}
13341334
}
13351335

@@ -1349,7 +1349,7 @@ abstract static class AsciiDecodeNode extends PythonBinaryBuiltinNode {
13491349
@Specialization
13501350
Object decode(VirtualFrame frame, Object obj, Object errors,
13511351
@Cached CodecsDecodeNode decode) {
1352-
return decode.call(frame, obj, "ascii", errors, true);
1352+
return decode.execute(frame, obj, "ascii", errors, true);
13531353
}
13541354
}
13551355

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/CodecsTruffleModuleBuiltins.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ protected abstract static class CodecDecodeNode extends PythonTernaryBuiltinNode
369369
Object decode(VirtualFrame frame, PythonObject self, Object input, Object errors,
370370
@Cached PyObjectGetAttr getAttrNode,
371371
@Cached CodecsDecodeNode decode) {
372-
return decode.call(frame, input, getAttrNode.execute(frame, self, ATTR_ENCODING), errors, true);
372+
return decode.execute(frame, input, getAttrNode.execute(frame, self, ATTR_ENCODING), errors, true);
373373
}
374374
}
375375

@@ -393,7 +393,7 @@ protected abstract static class IncrementalDecodeNode extends PythonQuaternaryBu
393393
Object decode(VirtualFrame frame, PythonObject self, Object input, Object errors, Object ffinal,
394394
@Cached PyObjectGetAttr getAttrNode,
395395
@Cached CodecsDecodeNode decode) {
396-
return decode.call(frame, input, getAttrNode.execute(frame, self, ATTR_ENCODING), errors, ffinal);
396+
return decode.execute(frame, input, getAttrNode.execute(frame, self, ATTR_ENCODING), errors, ffinal);
397397
}
398398
}
399399

@@ -404,7 +404,7 @@ protected abstract static class StreamDecodeNode extends PythonQuaternaryBuiltin
404404
Object decode(VirtualFrame frame, PythonObject self, Object input, Object errors, Object ffinal,
405405
@Cached PyObjectGetAttr getAttrNode,
406406
@Cached CodecsDecodeNode decode) {
407-
return decode.call(frame, input, getAttrNode.execute(frame, self, ATTR_ENCODING), errors, ffinal);
407+
return decode.execute(frame, input, getAttrNode.execute(frame, self, ATTR_ENCODING), errors, ffinal);
408408
}
409409
}
410410

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/io/StringIOBuiltins.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ PNone init(VirtualFrame frame, PStringIO self, String initialValue, Object newli
281281

282282
if (self.isReadUniversal()) {
283283
Object incDecoder = factory().createNLDecoder(PIncrementalNewlineDecoder);
284-
initNode.call(frame, incDecoder, self.getDecoder(), self.isReadTranslate(), PNone.NO_VALUE);
284+
initNode.execute(frame, incDecoder, self.getDecoder(), self.isReadTranslate(), PNone.NO_VALUE);
285285
self.setDecoder(incDecoder);
286286
}
287287

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ static Object callQuaternaryFunction(VirtualFrame frame, @SuppressWarnings("unus
220220
@SuppressWarnings("unused") @Cached("getMinArgs(func)") int minArgs,
221221
@Cached("getQuaternary(frame, func)") PythonQuaternaryBuiltinNode builtinNode,
222222
@SuppressWarnings("unused") @Cached("frameIsUnused(builtinNode)") boolean unusedFrame) {
223-
return builtinNode.call(frame, arg1, arg2, PNone.NO_VALUE, PNone.NO_VALUE);
223+
return builtinNode.execute(frame, arg1, arg2, PNone.NO_VALUE, PNone.NO_VALUE);
224224
}
225225

226226
@Specialization(guards = "!isBinaryOrTernaryBuiltinDescriptor(func)", //

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,15 @@ Object callSingle(VirtualFrame frame, @SuppressWarnings("unused") PBuiltinFuncti
6868
@SuppressWarnings("unused") @Cached("func") PBuiltinFunction cachedFunc,
6969
@Cached("getQuaternary(frame, func)") PythonQuaternaryBuiltinNode builtinNode,
7070
@SuppressWarnings("unused") @Cached("frameIsUnused(builtinNode)") boolean unusedFrame) {
71-
return builtinNode.call(frame, arg1, arg2, arg3, arg4);
71+
return builtinNode.execute(frame, arg1, arg2, arg3, arg4);
7272
}
7373

7474
@Specialization(guards = {"func.getCallTarget() == ct", "builtinNode != null", "frame != null || unusedFrame"}, limit = "getCallSiteInlineCacheMaxDepth()")
7575
Object call(VirtualFrame frame, @SuppressWarnings("unused") PBuiltinFunction func, Object arg1, Object arg2, Object arg3, Object arg4,
7676
@SuppressWarnings("unused") @Cached("func.getCallTarget()") RootCallTarget ct,
7777
@Cached("getQuaternary(frame, func)") PythonQuaternaryBuiltinNode builtinNode,
7878
@SuppressWarnings("unused") @Cached("frameIsUnused(builtinNode)") boolean unusedFrame) {
79-
return builtinNode.call(frame, arg1, arg2, arg3, arg4);
79+
return builtinNode.execute(frame, arg1, arg2, arg3, arg4);
8080
}
8181

8282
@Specialization(guards = {"func == cachedFunc", "builtinNode != null", "!takesSelfArg",
@@ -86,7 +86,7 @@ Object callMethodSingle(VirtualFrame frame, @SuppressWarnings("unused") PBuiltin
8686
@SuppressWarnings("unused") @Cached("takesSelfArg(func)") boolean takesSelfArg,
8787
@Cached("getQuaternary(frame, func.getFunction())") PythonQuaternaryBuiltinNode builtinNode,
8888
@SuppressWarnings("unused") @Cached("frameIsUnused(builtinNode)") boolean unusedFrame) {
89-
return builtinNode.call(frame, arg1, arg2, arg3, arg4);
89+
return builtinNode.execute(frame, arg1, arg2, arg3, arg4);
9090
}
9191

9292
@Specialization(guards = {"builtinNode != null", "getCallTarget(func, getCt) == ct", "!takesSelfArg", "frame != null || unusedFrame"}, limit = "getCallSiteInlineCacheMaxDepth()")
@@ -96,7 +96,7 @@ Object callMethod(VirtualFrame frame, @SuppressWarnings("unused") PBuiltinMethod
9696
@SuppressWarnings("unused") @Cached("takesSelfArg(func)") boolean takesSelfArg,
9797
@Cached("getQuaternary(frame, func.getFunction())") PythonQuaternaryBuiltinNode builtinNode,
9898
@SuppressWarnings("unused") @Cached("frameIsUnused(builtinNode)") boolean unusedFrame) {
99-
return builtinNode.call(frame, arg1, arg2, arg3, arg4);
99+
return builtinNode.execute(frame, arg1, arg2, arg3, arg4);
100100
}
101101

102102
@Specialization(replaces = {"callSingle", "call", "callMethodSingle", "callMethod"})

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ static Object callSelfMethodSingleContext(VirtualFrame frame, @SuppressWarnings(
156156
@SuppressWarnings("unused") @Cached("takesSelfArg(func)") boolean takesSelfArg,
157157
@Cached("getQuaternary(frame, func.getFunction())") PythonQuaternaryBuiltinNode builtinNode,
158158
@SuppressWarnings("unused") @Cached("frameIsUnused(builtinNode)") boolean unusedFrame) {
159-
return builtinNode.call(frame, func.getSelf(), arg1, arg2, arg3);
159+
return builtinNode.execute(frame, func.getSelf(), arg1, arg2, arg3);
160160
}
161161

162162
@Specialization(guards = {"builtinNode != null", "getCallTarget(func, getCt) == ct", "takesSelfArg", "frame != null || unusedFrame"}, limit = "getCallSiteInlineCacheMaxDepth()")
@@ -166,7 +166,7 @@ static Object callSelfMethod(VirtualFrame frame, @SuppressWarnings("unused") PBu
166166
@SuppressWarnings("unused") @Cached("takesSelfArg(func)") boolean takesSelfArg,
167167
@Cached("getQuaternary(frame, func.getFunction())") PythonQuaternaryBuiltinNode builtinNode,
168168
@SuppressWarnings("unused") @Cached("frameIsUnused(builtinNode)") boolean unusedFrame) {
169-
return builtinNode.call(frame, func.getSelf(), arg1, arg2, arg3);
169+
return builtinNode.execute(frame, func.getSelf(), arg1, arg2, arg3);
170170
}
171171

172172
@Specialization(guards = "!isTernaryBuiltinDescriptor(func)", replaces = {"doBuiltinFunctionCached", "doBuiltinFunctionCtCached", "doBuiltinFunctionCachedReverse",

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public BuiltinQuaternaryCallNode(PythonQuaternaryBuiltinNode node, ReadArgumentN
153153

154154
@Override
155155
public Object execute(VirtualFrame frame) {
156-
return node.call(frame, arg1.execute(frame), arg2.execute(frame), arg3.execute(frame), arg4.execute(frame));
156+
return node.execute(frame, arg1.execute(frame), arg2.execute(frame), arg3.execute(frame), arg4.execute(frame));
157157
}
158158

159159
@Override

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@
4444
import com.oracle.truffle.api.frame.VirtualFrame;
4545

4646
public abstract class PythonQuaternaryBuiltinNode extends PythonBuiltinBaseNode {
47-
public Object call(VirtualFrame frame, Object arg, Object arg2, Object arg3, Object arg4) {
48-
return execute(frame, arg, arg2, arg3, arg4);
49-
}
5047

51-
protected abstract Object execute(VirtualFrame frame, Object arg, Object arg2, Object arg3, Object arg4);
48+
public abstract Object execute(VirtualFrame frame, Object arg, Object arg2, Object arg3, Object arg4);
5249
}

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,15 @@ private Object cast3WithNode(ArgumentClinicProvider clinic, VirtualFrame frame,
9292
return castNode3.execute(frame, value);
9393
}
9494

95+
protected abstract Object executeWithoutClinic(VirtualFrame frame, Object val, Object val2, Object val3, Object val4);
96+
9597
@Override
96-
public final Object call(VirtualFrame frame, Object arg, Object arg2, Object arg3, Object arg4) {
98+
public final Object execute(VirtualFrame frame, Object arg, Object arg2, Object arg3, Object arg4) {
9799
ArgumentClinicProvider clinic = getArgumentClinic();
98100
Object val = clinic.hasCastNode(0) ? cast0WithNode(clinic, frame, arg) : arg;
99101
Object val2 = clinic.hasCastNode(1) ? cast1WithNode(clinic, frame, arg2) : arg2;
100102
Object val3 = clinic.hasCastNode(2) ? cast2WithNode(clinic, frame, arg3) : arg3;
101103
Object val4 = clinic.hasCastNode(3) ? cast3WithNode(clinic, frame, arg4) : arg4;
102-
return super.call(frame, val, val2, val3, val4);
104+
return executeWithoutClinic(frame, val, val2, val3, val4);
103105
}
104106
}

0 commit comments

Comments
 (0)