Skip to content

Commit 192ce47

Browse files
committed
Tweak host inlining for slot call nodes
1 parent a792079 commit 192ce47

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/type/slots/TpSlotDescrGet.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,6 @@ static Object callPython(VirtualFrame frame, Node inliningTarget, TpSlotPythonSi
216216
}
217217

218218
@Specialization
219-
@InliningCutoff
220219
static Object callNative(VirtualFrame frame, Node inliningTarget, TpSlotNative slot, Object self, Object obj, Object value,
221220
@Cached GetThreadStateNode getThreadStateNode,
222221
@Cached(inline = false) PythonToNativeNode selfToNativeNode,

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/type/slots/TpSlotInquiry.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
import com.oracle.graal.python.runtime.PythonContext;
6161
import com.oracle.graal.python.runtime.PythonContext.GetThreadStateNode;
6262
import com.oracle.graal.python.runtime.PythonContext.PythonThreadState;
63-
import com.oracle.truffle.api.HostCompilerDirectives.InliningCutoff;
6463
import com.oracle.truffle.api.dsl.Bind;
6564
import com.oracle.truffle.api.dsl.Cached;
6665
import com.oracle.truffle.api.dsl.GenerateCached;
@@ -131,7 +130,6 @@ static boolean callPython(VirtualFrame frame, TpSlotPythonSingle slot, Object se
131130
}
132131

133132
@Specialization
134-
@InliningCutoff
135133
static boolean callNative(VirtualFrame frame, Node inliningTarget, TpSlotNative slot, Object self,
136134
@Cached GetThreadStateNode getThreadStateNode,
137135
@Cached(inline = false) PythonToNativeNode toNativeNode,

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/type/slots/TpSlotLen.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ static int callPython(VirtualFrame frame, TpSlotPythonSingle slot, Object self,
167167
}
168168

169169
@Specialization// (guards = "!slot.isHPySlot()")
170-
@InliningCutoff
171170
static int callNative(VirtualFrame frame, Node inliningTarget, TpSlotNative slot, Object self,
172171
@Cached GetThreadStateNode getThreadStateNode,
173172
@Cached(inline = false) PythonToNativeNode toNativeNode,
@@ -178,12 +177,17 @@ static int callNative(VirtualFrame frame, Node inliningTarget, TpSlotNative slot
178177
PythonThreadState state = getThreadStateNode.execute(inliningTarget, ctx);
179178
Object result = externalInvokeNode.call(frame, inliningTarget, state, C_API_TIMING, T___LEN__, slot.callable, toNativeNode.execute(self));
180179
long l = checkResultNode.executeLong(state, T___LEN__, result);
181-
if (l != (int) l) {
182-
throw raiseNode.get(inliningTarget).raise(OverflowError, ErrorMessages.CANNOT_FIT_P_INTO_INDEXSIZED_INT, l);
180+
if (!PInt.isIntRange(l)) {
181+
raiseOverflow(inliningTarget, raiseNode, l);
183182
}
184183
return (int) l;
185184
}
186185

186+
@InliningCutoff
187+
private static void raiseOverflow(Node inliningTarget, Lazy raiseNode, long l) {
188+
throw raiseNode.get(inliningTarget).raise(OverflowError, ErrorMessages.CANNOT_FIT_P_INTO_INDEXSIZED_INT, l);
189+
}
190+
187191
@Specialization(replaces = "callCachedBuiltin")
188192
static int callGenericSimpleBuiltin(TpSlotLenBuiltinSimple<?> slot, Object self) {
189193
return slot.executeUncached(self);
@@ -213,7 +217,7 @@ static int callHPy(VirtualFrame frame, Node inliningTarget, TpSlotNative slot, O
213217
Object result = hpyDispatcher.execute(frame, inliningTarget, ctx, state, slot.callable, self);
214218
long l = checkResultNode.executeLong(state, T___LEN__, result);
215219
if (!PInt.isIntRange(l)) {
216-
throw raiseNode.get(inliningTarget).raise(OverflowError, ErrorMessages.CANNOT_FIT_P_INTO_INDEXSIZED_INT, l);
220+
raiseOverflow(inliningTarget, raiseNode, l);
217221
}
218222
return (int) l;
219223
}

0 commit comments

Comments
 (0)