Skip to content

Commit ce864a8

Browse files
author
Adam Hrbac
committed
fix SVM compilation
1 parent 0b5aece commit ce864a8

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/frame/FrameBuiltins.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,22 +202,22 @@ PNone set(VirtualFrame frame, PFrame self, Object newLineno,
202202
@Cached.Shared("materialize") @Cached MaterializeFrameNode materializeNode,
203203
@Cached PRaiseNode.Lazy raise,
204204
@Cached PyLongCheckExactNode isLong,
205-
@Cached PyLongAsLongAndOverflowNode toLong) {
205+
@Cached PyLongAsLongAndOverflowNode toLong) {
206206
syncLocationIfNeeded(frame, self, inliningTarget, isCurrentFrameProfile, materializeNode);
207207
if (self.isTraceArgument()) {
208208
if (isLong.execute(inliningTarget, newLineno)) {
209209
try {
210210
long lineno = toLong.execute(frame, inliningTarget, newLineno);
211211
if (lineno <= Integer.MAX_VALUE && lineno >= Integer.MIN_VALUE) {
212-
self.setJumpDestLine((int)lineno);
212+
self.setJumpDestLine((int) lineno);
213213
} else {
214214
throw raise.get(inliningTarget).raise(PythonBuiltinClassType.ValueError, ErrorMessages.LINENO_OUT_OF_RANGE);
215215
}
216216
} catch (OverflowException e) {
217217
throw raise.get(inliningTarget).raise(PythonBuiltinClassType.ValueError, ErrorMessages.LINENO_OUT_OF_RANGE);
218218
}
219219
} else {
220-
throw raise.get(inliningTarget).raise(PythonBuiltinClassType.ValueError, ErrorMessages.LINENO_MUST_BE_AN_INTEGER)
220+
throw raise.get(inliningTarget).raise(PythonBuiltinClassType.ValueError, ErrorMessages.LINENO_MUST_BE_AN_INTEGER);
221221
}
222222
} else {
223223
throw raise.get(inliningTarget).raise(PythonBuiltinClassType.ValueError, ErrorMessages.CANT_JUMP_FROM_S_EVENT, getContext().getThreadState(getLanguage()).getTracingWhat().pythonName);

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/bytecode/PBytecodeRootNode.java

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2942,12 +2942,7 @@ private int traceLine(VirtualFrame virtualFrame, MutableLoopData mutableData, by
29422942
// line after the code block
29432943
throw PRaiseNode.getUncached().raise(ValueError, ErrorMessages.LINE_D_COMES_BEFORE_THE_CURRENT_CODE_BLOCK, pyFrame.getJumpDestLine());
29442944
} else {
2945-
var stacks = co.computeStackElems();
2946-
String error = co.checkJump(stacks, bci, newBci);
2947-
if (error != null) {
2948-
throw PRaiseNode.getUncached().raise(ValueError, ErrorMessages.CANT_JUMP_INTO_S, error);
2949-
}
2950-
ret = stacks.get(newBci).size() - stacks.get(bci).size();
2945+
ret = computeJump(bci, newBci);
29512946
setCurrentBci(virtualFrame, bcioffset, newBci);
29522947
}
29532948
}
@@ -2958,6 +2953,18 @@ private int traceLine(VirtualFrame virtualFrame, MutableLoopData mutableData, by
29582953
return ret;
29592954
}
29602955

2956+
@TruffleBoundary
2957+
private int computeJump(int bci, int newBci) {
2958+
int ret;
2959+
var stacks = co.computeStackElems();
2960+
String error = co.checkJump(stacks, bci, newBci);
2961+
if (error != null) {
2962+
throw PRaiseNode.getUncached().raise(ValueError, ErrorMessages.CANT_JUMP_INTO_S, error);
2963+
}
2964+
ret = stacks.get(newBci).size() - stacks.get(bci).size();
2965+
return ret;
2966+
}
2967+
29612968
private int bytecodeBinarySubscrAdaptive(VirtualFrame virtualFrame, int stackTop, int bci, Node[] localNodes, int bciSlot) {
29622969
CompilerDirectives.transferToInterpreterAndInvalidate();
29632970
if (virtualFrame.isInt(stackTop) && virtualFrame.getObject(stackTop - 1) instanceof PSequence) {

0 commit comments

Comments
 (0)