Skip to content
Snippets Groups Projects
Commit f1992a30 authored by Lukas Stadler's avatar Lukas Stadler
Browse files

catch and convert common runtime exceptions in root nodes

parent b841bd37
Branches
No related tags found
No related merge requests found
......@@ -22,6 +22,7 @@
*/
package com.oracle.truffle.r.nodes.builtin;
import com.oracle.truffle.api.*;
import com.oracle.truffle.api.frame.*;
import com.oracle.truffle.r.nodes.*;
import com.oracle.truffle.r.nodes.function.*;
......@@ -39,7 +40,12 @@ public final class RBuiltinRootNode extends RRootNode {
@Override
public Object execute(VirtualFrame frame) {
verifyEnclosingAssumptions(frame);
return builtin.execute(frame);
try {
return builtin.execute(frame);
} catch (NullPointerException | ArrayIndexOutOfBoundsException | AssertionError e) {
CompilerDirectives.transferToInterpreter();
throw new RInternalError(e, "internal error");
}
}
public RBuiltinNode getBuiltin() {
......
......@@ -171,6 +171,9 @@ public final class FunctionDefinitionNode extends RRootNode implements RSyntaxNo
verifyEnclosingAssumptions(vf);
setupS3Slots(vf);
return body.execute(vf);
} catch (NullPointerException | ArrayIndexOutOfBoundsException | AssertionError e) {
CompilerDirectives.transferToInterpreter();
throw new RInternalError(e, "internal error");
} catch (ReturnException ex) {
returnProfile.enter();
MaterializedFrame returnFrame = ex.getReturnFrame();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment