diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_C.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_C.java index ae1c62d397faac2f1a85ffa2a38dd958fca95e7a..5b0c8f546e17f2d739ebcdce3fad98451d759eae 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_C.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_C.java @@ -24,6 +24,7 @@ package com.oracle.truffle.r.ffi.impl.llvm; import com.oracle.truffle.api.CompilerDirectives; import com.oracle.truffle.api.interop.ForeignAccess; +import com.oracle.truffle.api.interop.InteropException; import com.oracle.truffle.api.interop.Message; import com.oracle.truffle.api.nodes.Node; import com.oracle.truffle.r.ffi.impl.interop.NativeDoubleArray; @@ -51,8 +52,8 @@ class TruffleLLVM_C implements CRFFI { } assert numArgs == args.length; ForeignAccess.sendExecute(messageNode, nativeCallInfo.address.asTruffleObject(), wargs); - } catch (Throwable t) { - throw RInternalError.shouldNotReachHere(t); + } catch (InteropException ex) { + throw RInternalError.shouldNotReachHere(ex); } } diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_Call.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_Call.java index c8c93913a0f459dc3c43d1e3034918b0a9915a09..a60438f16b52205b2395025ef51d4bad5fc8dc9b 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_Call.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_Call.java @@ -115,8 +115,8 @@ final class TruffleLLVM_Call implements CallRFFI { } else if (value instanceof TruffleObject) { ForeignAccess.sendExecute(executeNode, INIT_VAR_FUN.OBJ.symbolHandle.asTruffleObject(), i, value); } - } catch (Throwable t) { - throw RInternalError.shouldNotReachHere(t); + } catch (InteropException ex) { + throw RInternalError.shouldNotReachHere(ex); } } } finally { @@ -138,8 +138,8 @@ final class TruffleLLVM_Call implements CallRFFI { // llvm specific callbacks ForeignAccess.sendExecute(executeNode, symbolHandle.asTruffleObject(), callbacks.length, new BytesToNativeCharArrayCall(upCallsRFFIImpl)); ForeignAccess.sendExecute(executeNode, symbolHandle.asTruffleObject(), callbacks.length + 1, new CharSXPToNativeArrayCall(upCallsRFFIImpl)); - } catch (Throwable t) { - throw RInternalError.shouldNotReachHere(t); + } catch (InteropException ex) { + throw RInternalError.shouldNotReachHere(ex); } } @@ -231,8 +231,8 @@ final class TruffleLLVM_Call implements CallRFFI { result = unwrap.execute(result); } return result; - } catch (InteropException t) { - throw RInternalError.shouldNotReachHere(t); + } catch (InteropException ex) { + throw RInternalError.shouldNotReachHere(ex); } finally { RContext.getRForeignAccessFactory().setIsNull(isNullSetting); } diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_PkgInit.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_PkgInit.java index 62920f9001ae4e3a74df4347c91c0db82ad56419..8ae6a58474a1b58c535eb6a60dc30b36e36db67b 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_PkgInit.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_PkgInit.java @@ -23,6 +23,7 @@ package com.oracle.truffle.r.ffi.impl.llvm; import com.oracle.truffle.api.interop.ForeignAccess; +import com.oracle.truffle.api.interop.InteropException; import com.oracle.truffle.api.interop.Message; import com.oracle.truffle.api.interop.TruffleObject; import com.oracle.truffle.api.nodes.Node; @@ -70,8 +71,8 @@ final class TruffleLLVM_PkgInit extends Generic_PkgInit { ForeignAccess.sendExecute(executeNode, callbackSymbol, PkgInitUpCalls.Index.forceSymbols.ordinal(), new ForceSymbolsCall(trufflePkgInit)); ForeignAccess.sendExecute(executeNode, callbackSymbol, PkgInitUpCalls.Index.registerCCallable.ordinal(), new RegisterCCallableCall(trufflePkgInit)); ForeignAccess.sendExecute(executeNode, callbackSymbol, PkgInitUpCalls.Index.getCCallable.ordinal(), new GetCCallableCall(trufflePkgInit)); - } catch (Throwable t) { - throw RInternalError.shouldNotReachHere(t); + } catch (InteropException ex) { + throw RInternalError.shouldNotReachHere(ex); } } @@ -89,10 +90,9 @@ final class TruffleLLVM_PkgInit extends Generic_PkgInit { protected Object setSymbol(DLLInfo dllInfo, int nstOrd, long routines, int index) { Node executeNode = Message.createExecute(4).createNode(); try { - Object result = ForeignAccess.sendExecute(executeNode, setSymbolHandle, dllInfo, nstOrd, routines, index); - return result; - } catch (Throwable t) { - throw RInternalError.shouldNotReachHere(); + return ForeignAccess.sendExecute(executeNode, setSymbolHandle, dllInfo, nstOrd, routines, index); + } catch (InteropException ex) { + throw RInternalError.shouldNotReachHere(ex); } } } diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_Stats.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_Stats.java index 21a0da11b492b410fbd742947d4235f317118b94..a0b16fc81a7eb6224829d71d2c92de37e4e4e6b7 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_Stats.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_Stats.java @@ -26,6 +26,7 @@ import com.oracle.truffle.api.dsl.Cached; import com.oracle.truffle.api.dsl.ImportStatic; import com.oracle.truffle.api.dsl.Specialization; import com.oracle.truffle.api.interop.ForeignAccess; +import com.oracle.truffle.api.interop.InteropException; import com.oracle.truffle.api.interop.Message; import com.oracle.truffle.api.nodes.Node; import com.oracle.truffle.r.ffi.impl.interop.NativeDoubleArray; @@ -85,8 +86,8 @@ public class TruffleLLVM_Stats implements StatsRFFI { NativeDoubleArray nwork = new NativeDoubleArray(work); NativeIntegerArray niwork = new NativeIntegerArray(iwork)) { return (int) ForeignAccess.sendExecute(messageNode, fftWork.asTruffleObject(), na, nseg, n, nspn, isn, nwork, niwork); - } catch (Throwable t) { - throw RInternalError.shouldNotReachHere(t); + } catch (InteropException ex) { + throw RInternalError.shouldNotReachHere(ex); } } @@ -124,8 +125,8 @@ public class TruffleLLVM_Stats implements StatsRFFI { try (NativeIntegerArray npmaxf = new NativeIntegerArray(pmaxf); NativeIntegerArray npmaxp = new NativeIntegerArray(pmaxp)) { ForeignAccess.sendExecute(messageNode, fftFactor.asTruffleObject(), n, npmaxf, npmaxp); - } catch (Throwable t) { - throw RInternalError.shouldNotReachHere(t); + } catch (InteropException ex) { + throw RInternalError.shouldNotReachHere(ex); } } diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_Tools.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_Tools.java index b04deaa0d01f0fea5a97a92e402b60f37267c9dd..329e14e3f75bda1792c8d755c6b6dd172c6a7baf 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_Tools.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_Tools.java @@ -23,6 +23,7 @@ package com.oracle.truffle.r.ffi.impl.llvm; import com.oracle.truffle.api.interop.ForeignAccess; +import com.oracle.truffle.api.interop.InteropException; import com.oracle.truffle.api.interop.Message; import com.oracle.truffle.api.interop.TruffleObject; import com.oracle.truffle.api.nodes.Node; @@ -48,8 +49,8 @@ public class TruffleLLVM_Tools implements ToolsRFFI { try { ForeignAccess.sendExecute(executeNode, callbackSymbol, new RConnGetCCall()); addCallbackDone = true; - } catch (Throwable t) { - throw RInternalError.shouldNotReachHere(t); + } catch (InteropException ex) { + throw RInternalError.shouldNotReachHere(ex); } } } diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_UserRng.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_UserRng.java index 63cdf6286422c023c84116d1a67adc202d697615..a3a276221a49e367d90d59f8241f94e7c15bea41 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_UserRng.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_UserRng.java @@ -25,6 +25,7 @@ package com.oracle.truffle.r.ffi.impl.llvm; import com.oracle.truffle.api.CompilerDirectives; import com.oracle.truffle.api.CompilerDirectives.CompilationFinal; import com.oracle.truffle.api.interop.ForeignAccess; +import com.oracle.truffle.api.interop.InteropException; import com.oracle.truffle.api.interop.Message; import com.oracle.truffle.api.nodes.Node; import com.oracle.truffle.r.runtime.RInternalError; @@ -53,8 +54,8 @@ public class TruffleLLVM_UserRng implements UserRngRFFI { init(1); try { ForeignAccess.sendExecute(message, Function.Init.getSymbolHandle().asTruffleObject(), seed); - } catch (Throwable t) { - throw RInternalError.shouldNotReachHere(); + } catch (InteropException ex) { + throw RInternalError.shouldNotReachHere(ex); } } } @@ -67,8 +68,8 @@ public class TruffleLLVM_UserRng implements UserRngRFFI { try { Object address = ForeignAccess.sendExecute(message, Function.Rand.getSymbolHandle().asTruffleObject()); return (double) ForeignAccess.sendExecute(readPointerNode, TruffleLLVM_CAccess.Function.READ_POINTER_DOUBLE.getSymbolHandle().asTruffleObject(), address); - } catch (Throwable t) { - throw RInternalError.shouldNotReachHere(); + } catch (InteropException ex) { + throw RInternalError.shouldNotReachHere(ex); } } } @@ -81,8 +82,8 @@ public class TruffleLLVM_UserRng implements UserRngRFFI { try { Object address = ForeignAccess.sendExecute(message, Function.NSeed.getSymbolHandle().asTruffleObject()); return (int) ForeignAccess.sendExecute(readPointerNode, TruffleLLVM_CAccess.Function.READ_POINTER_INT.getSymbolHandle().asTruffleObject(), address); - } catch (Throwable t) { - throw RInternalError.shouldNotReachHere(); + } catch (InteropException ex) { + throw RInternalError.shouldNotReachHere(ex); } } } @@ -98,8 +99,8 @@ public class TruffleLLVM_UserRng implements UserRngRFFI { Object seed = ForeignAccess.sendExecute(readPointerNode, TruffleLLVM_CAccess.Function.READ_ARRAY_INT.getSymbolHandle().asTruffleObject(), address, i); n[i] = (int) seed; } - } catch (Throwable t) { - throw RInternalError.shouldNotReachHere(); + } catch (InteropException ex) { + throw RInternalError.shouldNotReachHere(ex); } } } diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_Call.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_Call.java index fb8810b3a672e26781d10710f255afc08c9d225b..799d8b5699825997b8d063cdffcb99989e6c8f02 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_Call.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_Call.java @@ -85,8 +85,8 @@ public class TruffleNFI_Call implements CallRFFI { SymbolHandle symbolHandle = DLL.findSymbol(initVarFun.funName, null); // libR try { initVarFun.initFunction = (TruffleObject) ForeignAccess.sendInvoke(bind, symbolHandle.asTruffleObject(), "bind", initVarFun.signature); - } catch (Throwable t) { - throw RInternalError.shouldNotReachHere(t); + } catch (InteropException ex) { + throw RInternalError.shouldNotReachHere(ex); } } Node executeNode = Message.createExecute(2).createNode(); @@ -109,8 +109,8 @@ public class TruffleNFI_Call implements CallRFFI { } else { ForeignAccess.sendExecute(executeNode, INIT_VAR_FUN.OBJ.initFunction, i, value); } - } catch (Throwable t) { - throw RInternalError.shouldNotReachHere(t); + } catch (InteropException ex) { + throw RInternalError.shouldNotReachHere(ex); } } } finally { @@ -130,8 +130,8 @@ public class TruffleNFI_Call implements CallRFFI { TruffleObject addCallbackFunction = (TruffleObject) ForeignAccess.sendInvoke(bind, symbolHandle.asTruffleObject(), "bind", addCallbackSignature); ForeignAccess.sendExecute(executeNode, addCallbackFunction, callback.ordinal(), callback.call); } - } catch (Throwable t) { - throw RInternalError.shouldNotReachHere(t); + } catch (InteropException ex) { + throw RInternalError.shouldNotReachHere(ex); } } @@ -162,8 +162,8 @@ public class TruffleNFI_Call implements CallRFFI { SymbolHandle symbolHandle = DLL.findSymbol(returnArrayFun.funName, null); // libR try { returnArrayFun.function = (TruffleObject) ForeignAccess.sendInvoke(bind, symbolHandle.asTruffleObject(), "bind", returnArrayFun.signature); - } catch (InteropException t) { - throw RInternalError.shouldNotReachHere(t); + } catch (InteropException ex) { + throw RInternalError.shouldNotReachHere(ex); } } } @@ -181,8 +181,8 @@ public class TruffleNFI_Call implements CallRFFI { } else { throw RInternalError.shouldNotReachHere(); } - } catch (InteropException t) { - throw RInternalError.shouldNotReachHere(t); + } catch (InteropException ex) { + throw RInternalError.shouldNotReachHere(ex); } } @@ -204,8 +204,8 @@ public class TruffleNFI_Call implements CallRFFI { throw RInternalError.shouldNotReachHere(); } - } catch (InteropException t) { - throw RInternalError.shouldNotReachHere(t); + } catch (InteropException ex) { + throw RInternalError.shouldNotReachHere(ex); } } @@ -213,8 +213,8 @@ public class TruffleNFI_Call implements CallRFFI { Node executeNode = Message.createExecute(1).createNode(); try { ForeignAccess.sendExecute(executeNode, ReturnArray.FREE.function, address); - } catch (InteropException t) { - throw RInternalError.shouldNotReachHere(t); + } catch (InteropException ex) { + throw RInternalError.shouldNotReachHere(ex); } } diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_PkgInit.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_PkgInit.java index e8dd18db02632ca1d128f6f625d08eaa3a87df76..e35a96709ca78ca805fece02b1dffc120fb3a8cb 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_PkgInit.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_PkgInit.java @@ -23,6 +23,7 @@ package com.oracle.truffle.r.ffi.impl.nfi; import com.oracle.truffle.api.interop.ForeignAccess; +import com.oracle.truffle.api.interop.InteropException; import com.oracle.truffle.api.interop.Message; import com.oracle.truffle.api.interop.TruffleObject; import com.oracle.truffle.api.nodes.Node; @@ -84,8 +85,8 @@ public final class TruffleNFI_PkgInit extends Generic_PkgInit { } symbolHandle = DLL.findSymbol("Rdynload_setSymbol", null); setSymbolFunction = (TruffleObject) ForeignAccess.sendInvoke(bind, symbolHandle.asTruffleObject(), "bind", SETSYMBOL_SIGNATURE); - } catch (Throwable t) { - throw RInternalError.shouldNotReachHere(t); + } catch (InteropException ex) { + throw RInternalError.shouldNotReachHere(ex); } } @@ -100,13 +101,12 @@ public final class TruffleNFI_PkgInit extends Generic_PkgInit { } @Override - protected Object setSymbol(DLLInfo dllInfo, int nstOrd, long routines, int index) { + protected DotSymbol setSymbol(DLLInfo dllInfo, int nstOrd, long routines, int index) { Node executeNode = Message.createExecute(4).createNode(); try { - DotSymbol result = (DotSymbol) ForeignAccess.sendExecute(executeNode, setSymbolFunction, dllInfo, nstOrd, routines, index); - return result; - } catch (Throwable t) { - throw RInternalError.shouldNotReachHere(t); + return (DotSymbol) ForeignAccess.sendExecute(executeNode, setSymbolFunction, dllInfo, nstOrd, routines, index); + } catch (InteropException ex) { + throw RInternalError.shouldNotReachHere(ex); } } } diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_Tools.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_Tools.java index d9fa3345f779223257c442449a99c63ca25c2365..30b9bcb94c904701f2a6584222d30e9a0ebfdd10 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_Tools.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_Tools.java @@ -67,8 +67,8 @@ public class TruffleNFI_Tools implements ToolsRFFI { try { TruffleObject function = (TruffleObject) ForeignAccess.sendInvoke(bind, symbolHandle.asTruffleObject(), "bind", "(env, (object): sint32): void"); ForeignAccess.sendExecute(executeNode, function, new RConnGetCCall()); - } catch (InteropException t) { - throw RInternalError.shouldNotReachHere(t); + } catch (InteropException ex) { + throw RInternalError.shouldNotReachHere(ex); } } } diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_UserRng.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_UserRng.java index e68c870b4a31a4e5e71819cc8f70b037a985727d..f348ec0d0f93ba8553737abe184bbe5e20175282 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_UserRng.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_UserRng.java @@ -25,6 +25,7 @@ package com.oracle.truffle.r.ffi.impl.nfi; import com.oracle.truffle.api.CompilerDirectives; import com.oracle.truffle.api.CompilerDirectives.CompilationFinal; import com.oracle.truffle.api.interop.ForeignAccess; +import com.oracle.truffle.api.interop.InteropException; import com.oracle.truffle.api.interop.Message; import com.oracle.truffle.api.interop.TruffleObject; import com.oracle.truffle.api.nodes.Node; @@ -50,8 +51,8 @@ public class TruffleNFI_UserRng implements UserRngRFFI { Node bind = Message.createInvoke(1).createNode(); try { targetFunction = (TruffleObject) ForeignAccess.sendInvoke(bind, function.getSymbolHandle().asTruffleObject(), "bind", signature); - } catch (Throwable t) { - throw RInternalError.shouldNotReachHere(); + } catch (InteropException ex) { + throw RInternalError.shouldNotReachHere(ex); } } } @@ -64,8 +65,8 @@ public class TruffleNFI_UserRng implements UserRngRFFI { init(Function.Init, "(sint32): void"); try { ForeignAccess.sendExecute(message, targetFunction, seed); - } catch (Throwable t) { - throw RInternalError.shouldNotReachHere(); + } catch (InteropException ex) { + throw RInternalError.shouldNotReachHere(ex); } } } @@ -78,8 +79,8 @@ public class TruffleNFI_UserRng implements UserRngRFFI { try { Object address = ForeignAccess.sendExecute(message, targetFunction); return (double) ForeignAccess.sendExecute(readPointerNode, TruffleNFI_CAccess.Function.READ_POINTER_DOUBLE.getSymbolFunction(), address); - } catch (Throwable t) { - throw RInternalError.shouldNotReachHere(); + } catch (InteropException ex) { + throw RInternalError.shouldNotReachHere(ex); } } } @@ -92,8 +93,8 @@ public class TruffleNFI_UserRng implements UserRngRFFI { try { Object address = ForeignAccess.sendExecute(message, targetFunction); return (int) ForeignAccess.sendExecute(readPointerNode, TruffleNFI_CAccess.Function.READ_POINTER_INT.getSymbolFunction(), address); - } catch (Throwable t) { - throw RInternalError.shouldNotReachHere(); + } catch (InteropException ex) { + throw RInternalError.shouldNotReachHere(ex); } } } @@ -108,8 +109,8 @@ public class TruffleNFI_UserRng implements UserRngRFFI { for (int i = 0; i < n.length; i++) { n[i] = (int) ForeignAccess.sendExecute(readPointerNode, TruffleNFI_CAccess.Function.READ_ARRAY_INT.getSymbolFunction(), address, i); } - } catch (Throwable t) { - throw RInternalError.shouldNotReachHere(); + } catch (InteropException ex) { + throw RInternalError.shouldNotReachHere(ex); } } }