@@ -100,14 +100,26 @@ private CallDispatchNode ensureDispatch() {
100
100
return dispatch ;
101
101
}
102
102
103
- @ Specialization
103
+ @ Specialization (guards = "isFunction(callable.getFunction())" )
104
+ protected Object methodCallDirect (VirtualFrame frame , PMethod callable , Object [] arguments , PKeyword [] keywords ) {
105
+ // functions must be called directly otherwise the call stack is incorrect
106
+ return ensureDispatch ().executeCall (frame , callable .getFunction (), ensureCreateArguments ().executeWithSelf (callable .getSelf (), arguments ), keywords );
107
+ }
108
+
109
+ @ Specialization (guards = "isFunction(callable.getFunction())" )
110
+ protected Object builtinMethodCallDirect (VirtualFrame frame , PBuiltinMethod callable , Object [] arguments , PKeyword [] keywords ) {
111
+ // functions must be called directly otherwise the call stack is incorrect
112
+ return ensureDispatch ().executeCall (frame , callable .getFunction (), ensureCreateArguments ().executeWithSelf (callable .getSelf (), arguments ), keywords );
113
+ }
114
+
115
+ @ Specialization (guards = "!isFunction(callable.getFunction())" )
104
116
protected Object methodCall (VirtualFrame frame , PMethod callable , Object [] arguments , PKeyword [] keywords ,
105
117
@ Cached ("create(__CALL__)" ) LookupInheritedAttributeNode callAttrGetterNode ,
106
118
@ Cached ("create()" ) CallVarargsMethodNode callCallNode ) {
107
119
return specialCall (frame , callable , arguments , keywords , callAttrGetterNode , callCallNode );
108
120
}
109
121
110
- @ Specialization
122
+ @ Specialization ( guards = "!isFunction(callable.getFunction())" )
111
123
protected Object builtinMethodCall (VirtualFrame frame , PBuiltinMethod callable , Object [] arguments , PKeyword [] keywords ,
112
124
@ Cached ("create(__CALL__)" ) LookupInheritedAttributeNode callAttrGetterNode ,
113
125
@ Cached ("create()" ) CallVarargsMethodNode callCallNode ) {
0 commit comments