Skip to content

Commit aeb9c4b

Browse files
committed
Small refactoring
1 parent 25e460a commit aeb9c4b

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -260,14 +260,9 @@ Object run(Object o) {
260260
@GenerateNodeFactory
261261
abstract static class TRegexCallSafe extends PythonBuiltinNode {
262262

263-
private Node invokeNode;
264-
265263
private Object doIt(TruffleObject callable, String arg1, Object arg2,
266-
@Cached("create()") BranchProfile runtimeError,
267-
@Cached("create()") BranchProfile typeError) {
268-
if (invokeNode == null) {
269-
invokeNode = Message.createExecute(0).createNode();
270-
}
264+
BranchProfile runtimeError,
265+
BranchProfile typeError, Node invokeNode) {
271266
try {
272267
return ForeignAccess.sendExecute(invokeNode, callable, new Object[]{arg1, arg2});
273268
} catch (ArityException | UnsupportedTypeException | UnsupportedMessageException e) {
@@ -282,16 +277,21 @@ private Object doIt(TruffleObject callable, String arg1, Object arg2,
282277
@Specialization(guards = "isForeignObject(callable)")
283278
Object call(TruffleObject callable, String arg1, String arg2,
284279
@Cached("create()") BranchProfile runtimeError,
285-
@Cached("create()") BranchProfile typeError) {
286-
return doIt(callable, arg1, arg2, runtimeError, typeError);
280+
@Cached("create()") BranchProfile typeError,
281+
@Cached("createExecute()") Node invokeNode) {
282+
return doIt(callable, arg1, arg2, runtimeError, typeError, invokeNode);
287283
}
288284

289285
@Specialization(guards = "isForeignObject(callable)")
290286
Object call(TruffleObject callable, String arg1, int arg2,
291287
@Cached("create()") BranchProfile runtimeError,
292-
@Cached("create()") BranchProfile typeError) {
293-
return doIt(callable, arg1, arg2, runtimeError, typeError);
288+
@Cached("create()") BranchProfile typeError,
289+
@Cached("createExecute()") Node invokeNode) {
290+
return doIt(callable, arg1, arg2, runtimeError, typeError, invokeNode);
291+
}
292+
293+
protected static Node createExecute() {
294+
return Message.createExecute(0).createNode();
294295
}
295-
296296
}
297297
}

0 commit comments

Comments
 (0)