Skip to content

Commit b11b6f0

Browse files
committed
CallDispatchNode uses PythonLanguage#isSingleContext
1 parent c3d87ad commit b11b6f0

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/call/CallDispatchNode.java

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,14 @@
2525
*/
2626
package com.oracle.graal.python.nodes.call;
2727

28-
import com.oracle.graal.python.PythonLanguage;
29-
import com.oracle.graal.python.builtins.objects.code.PCode;
3028
import com.oracle.graal.python.builtins.objects.code.CodeNodes.GetCodeCallTargetNode;
29+
import com.oracle.graal.python.builtins.objects.code.PCode;
3130
import com.oracle.graal.python.builtins.objects.function.PBuiltinFunction;
3231
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;
3433
import com.oracle.graal.python.nodes.builtins.FunctionNodes.GetCallTargetNode;
34+
import com.oracle.graal.python.nodes.builtins.FunctionNodes.GetFunctionCodeNode;
3535
import com.oracle.graal.python.runtime.PythonOptions;
36-
import com.oracle.truffle.api.Assumption;
3736
import com.oracle.truffle.api.CompilerAsserts;
3837
import com.oracle.truffle.api.RootCallTarget;
3938
import com.oracle.truffle.api.dsl.Cached;
@@ -43,11 +42,10 @@
4342
import com.oracle.truffle.api.dsl.Specialization;
4443
import com.oracle.truffle.api.frame.Frame;
4544
import com.oracle.truffle.api.frame.VirtualFrame;
46-
import com.oracle.truffle.api.nodes.Node;
4745

4846
@ImportStatic(PythonOptions.class)
4947
@GenerateUncached
50-
public abstract class CallDispatchNode extends Node {
48+
public abstract class CallDispatchNode extends PNodeWithContext {
5149

5250
protected static FunctionInvokeNode createInvokeNode(PFunction callee) {
5351
return FunctionInvokeNode.create(callee);
@@ -73,10 +71,6 @@ public static CallDispatchNode getUncached() {
7371
return CallDispatchNodeGen.getUncached();
7472
}
7573

76-
protected Assumption singleContextAssumption() {
77-
return PythonLanguage.get(this).singleContextAssumption;
78-
}
79-
8074
public final Object executeCall(VirtualFrame frame, PFunction callee, Object[] arguments) {
8175
return executeInternal(frame, callee, arguments);
8276
}
@@ -90,7 +84,7 @@ public final Object executeCall(VirtualFrame frame, PBuiltinFunction callee, Obj
9084
protected abstract Object executeInternal(Frame frame, PBuiltinFunction callee, Object[] arguments);
9185

9286
// 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()")
9488
protected Object callFunctionCached(VirtualFrame frame, @SuppressWarnings("unused") PFunction callee, Object[] arguments,
9589
@SuppressWarnings("unused") @Cached("callee") PFunction cachedCallee,
9690
@Cached("createInvokeNode(cachedCallee)") FunctionInvokeNode invoke) {
@@ -103,7 +97,7 @@ protected PCode getCode(GetFunctionCodeNode getFunctionCodeNode, PFunction funct
10397
return getFunctionCodeNode.execute(function);
10498
}
10599

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()")
107101
protected Object callFunctionCachedCode(VirtualFrame frame, @SuppressWarnings("unused") PFunction callee, Object[] arguments,
108102
@SuppressWarnings("unused") @Cached("callee") PFunction cachedCallee,
109103
@SuppressWarnings("unused") @Cached GetFunctionCodeNode getFunctionCodeNode,
@@ -126,7 +120,7 @@ protected Object callFunctionCachedCt(VirtualFrame frame, PFunction callee, Obje
126120
return invoke.execute(frame, callee, callee.getGlobals(), callee.getClosure(), arguments);
127121
}
128122

129-
@Specialization(guards = {"callee == cachedCallee"}, limit = "getCallSiteInlineCacheMaxDepth()", assumptions = "singleContextAssumption()")
123+
@Specialization(guards = {"isSingleContext()", "callee == cachedCallee"}, limit = "getCallSiteInlineCacheMaxDepth()")
130124
protected Object callBuiltinFunctionCached(VirtualFrame frame, @SuppressWarnings("unused") PBuiltinFunction callee, Object[] arguments,
131125
@SuppressWarnings("unused") @Cached("callee") PBuiltinFunction cachedCallee,
132126
@Cached("createInvokeNode(cachedCallee)") FunctionInvokeNode invoke) {

0 commit comments

Comments
 (0)