Skip to content

Commit d7ec202

Browse files
committed
Use deopt + uncached raise for fatal errors
1 parent 7e9e1aa commit d7ec202

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/MathModuleBuiltins.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,18 +1016,18 @@ private static long count(long a, long b) {
10161016
}
10171017

10181018
@Specialization
1019-
long gcd(long x, long y) {
1019+
static long gcd(long x, long y) {
10201020
return Math.abs(count(x, y));
10211021
}
10221022

10231023
@Specialization
1024-
PInt gcd(long x, PInt y,
1024+
static PInt gcd(long x, PInt y,
10251025
@Shared("factory") @Cached PythonObjectFactory factory) {
10261026
return factory.createInt(op(PInt.longToBigInteger(x), y.getValue()));
10271027
}
10281028

10291029
@Specialization
1030-
PInt gcd(PInt x, long y,
1030+
static PInt gcd(PInt x, long y,
10311031
@Shared("factory") @Cached PythonObjectFactory factory) {
10321032
return factory.createInt(op(x.getValue(), PInt.longToBigInteger(y)));
10331033
}
@@ -1084,9 +1084,9 @@ static Object gcd(VirtualFrame frame, Object x, Object y,
10841084
}
10851085

10861086
@Specialization
1087-
static Object gcdNative(@SuppressWarnings("unused") PythonAbstractNativeObject a, @SuppressWarnings("unused") Object b,
1088-
@Shared @Cached PRaiseNode raiseNode) {
1089-
throw raiseNode.raise(SystemError, ErrorMessages.GCD_FOR_NATIVE_NOT_SUPPORTED);
1087+
Object gcdNative(@SuppressWarnings("unused") PythonAbstractNativeObject a, @SuppressWarnings("unused") Object b) {
1088+
CompilerDirectives.transferToInterpreter();
1089+
throw PRaiseNode.raiseUncached(this, SystemError, ErrorMessages.GCD_FOR_NATIVE_NOT_SUPPORTED);
10901090
}
10911091

10921092
@NeverDefault

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/ctypes/CtypesModuleBuiltins.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,10 +1234,12 @@ static Object callManagedFunction(Node inliningTarget, NativeFunction pProc, Obj
12341234
} catch (PException e) {
12351235
throw e;
12361236
} catch (UnsupportedTypeException | ArityException | UnsupportedMessageException | AbstractTruffleException e) {
1237-
throw raiseNode.get(inliningTarget).raise(RuntimeError, FFI_CALL_FAILED);
1237+
CompilerDirectives.transferToInterpreter();
1238+
throw PRaiseNode.raiseUncached(inliningTarget, RuntimeError, FFI_CALL_FAILED);
12381239
} catch (UnsupportedSpecializationException ee) {
12391240
// TODO: llvm/GR-???
1240-
throw raiseNode.get(inliningTarget).raise(NotImplementedError, toTruffleStringUncached("require backend support."));
1241+
CompilerDirectives.transferToInterpreter();
1242+
throw PRaiseNode.raiseUncached(inliningTarget, NotImplementedError, toTruffleStringUncached("require backend support."));
12411243
}
12421244
}
12431245

@@ -1271,7 +1273,8 @@ Object callNativeFunction(Node inliningTarget, NativeFunction pProc, Object[] av
12711273
try {
12721274
return ilib.execute(function, avalues);
12731275
} catch (UnsupportedTypeException | ArityException | UnsupportedMessageException e) {
1274-
throw raiseNode.get(inliningTarget).raise(RuntimeError, FFI_CALL_FAILED);
1276+
CompilerDirectives.transferToInterpreter();
1277+
throw PRaiseNode.raiseUncached(inliningTarget, RuntimeError, FFI_CALL_FAILED);
12751278
}
12761279
}
12771280

0 commit comments

Comments
 (0)