25
25
*/
26
26
package com .oracle .graal .python .nodes .call ;
27
27
28
- import com .oracle .graal .python .PythonLanguage ;
29
- import com .oracle .graal .python .builtins .objects .code .PCode ;
30
28
import com .oracle .graal .python .builtins .objects .code .CodeNodes .GetCodeCallTargetNode ;
29
+ import com .oracle .graal .python .builtins .objects .code .PCode ;
31
30
import com .oracle .graal .python .builtins .objects .function .PBuiltinFunction ;
32
31
import com .oracle .graal .python .builtins .objects .function .PFunction ;
33
- import com .oracle .graal .python .nodes .builtins . FunctionNodes . GetFunctionCodeNode ;
32
+ import com .oracle .graal .python .nodes .PNodeWithContext ;
34
33
import com .oracle .graal .python .nodes .builtins .FunctionNodes .GetCallTargetNode ;
34
+ import com .oracle .graal .python .nodes .builtins .FunctionNodes .GetFunctionCodeNode ;
35
35
import com .oracle .graal .python .runtime .PythonOptions ;
36
- import com .oracle .truffle .api .Assumption ;
37
36
import com .oracle .truffle .api .CompilerAsserts ;
38
37
import com .oracle .truffle .api .RootCallTarget ;
39
38
import com .oracle .truffle .api .dsl .Cached ;
43
42
import com .oracle .truffle .api .dsl .Specialization ;
44
43
import com .oracle .truffle .api .frame .Frame ;
45
44
import com .oracle .truffle .api .frame .VirtualFrame ;
46
- import com .oracle .truffle .api .nodes .Node ;
47
45
48
46
@ ImportStatic (PythonOptions .class )
49
47
@ GenerateUncached
50
- public abstract class CallDispatchNode extends Node {
48
+ public abstract class CallDispatchNode extends PNodeWithContext {
51
49
52
50
protected static FunctionInvokeNode createInvokeNode (PFunction callee ) {
53
51
return FunctionInvokeNode .create (callee );
@@ -73,10 +71,6 @@ public static CallDispatchNode getUncached() {
73
71
return CallDispatchNodeGen .getUncached ();
74
72
}
75
73
76
- protected Assumption singleContextAssumption () {
77
- return PythonLanguage .get (this ).singleContextAssumption ;
78
- }
79
-
80
74
public final Object executeCall (VirtualFrame frame , PFunction callee , Object [] arguments ) {
81
75
return executeInternal (frame , callee , arguments );
82
76
}
@@ -90,7 +84,7 @@ public final Object executeCall(VirtualFrame frame, PBuiltinFunction callee, Obj
90
84
protected abstract Object executeInternal (Frame frame , PBuiltinFunction callee , Object [] arguments );
91
85
92
86
// We only have a single context and this function never changed its code
93
- @ Specialization (guards = {"callee == cachedCallee" }, limit = "getCallSiteInlineCacheMaxDepth()" , assumptions = { "singleContextAssumption()" , " cachedCallee.getCodeStableAssumption()"} )
87
+ @ Specialization (guards = {"isSingleContext()" , " callee == cachedCallee" }, limit = "getCallSiteInlineCacheMaxDepth()" , assumptions = " cachedCallee.getCodeStableAssumption()" )
94
88
protected Object callFunctionCached (VirtualFrame frame , @ SuppressWarnings ("unused" ) PFunction callee , Object [] arguments ,
95
89
@ SuppressWarnings ("unused" ) @ Cached ("callee" ) PFunction cachedCallee ,
96
90
@ Cached ("createInvokeNode(cachedCallee)" ) FunctionInvokeNode invoke ) {
@@ -103,7 +97,7 @@ protected PCode getCode(GetFunctionCodeNode getFunctionCodeNode, PFunction funct
103
97
return getFunctionCodeNode .execute (function );
104
98
}
105
99
106
- @ Specialization (guards = {"callee == cachedCallee" , "getCode(getFunctionCodeNode, callee) == cachedCode" }, limit = "getCallSiteInlineCacheMaxDepth()" , assumptions = { "singleContextAssumption()" } )
100
+ @ Specialization (guards = {"isSingleContext()" , " callee == cachedCallee" , "getCode(getFunctionCodeNode, callee) == cachedCode" }, limit = "getCallSiteInlineCacheMaxDepth()" )
107
101
protected Object callFunctionCachedCode (VirtualFrame frame , @ SuppressWarnings ("unused" ) PFunction callee , Object [] arguments ,
108
102
@ SuppressWarnings ("unused" ) @ Cached ("callee" ) PFunction cachedCallee ,
109
103
@ SuppressWarnings ("unused" ) @ Cached GetFunctionCodeNode getFunctionCodeNode ,
@@ -126,7 +120,7 @@ protected Object callFunctionCachedCt(VirtualFrame frame, PFunction callee, Obje
126
120
return invoke .execute (frame , callee , callee .getGlobals (), callee .getClosure (), arguments );
127
121
}
128
122
129
- @ Specialization (guards = {"callee == cachedCallee" }, limit = "getCallSiteInlineCacheMaxDepth()" , assumptions = "singleContextAssumption ()" )
123
+ @ Specialization (guards = {"isSingleContext()" , " callee == cachedCallee" }, limit = "getCallSiteInlineCacheMaxDepth()" )
130
124
protected Object callBuiltinFunctionCached (VirtualFrame frame , @ SuppressWarnings ("unused" ) PBuiltinFunction callee , Object [] arguments ,
131
125
@ SuppressWarnings ("unused" ) @ Cached ("callee" ) PBuiltinFunction cachedCallee ,
132
126
@ Cached ("createInvokeNode(cachedCallee)" ) FunctionInvokeNode invoke ) {
0 commit comments