diff graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/call/SLDispatchNode.java @ 21493:99e3f4c5c853

SL: handle undefined functions gracefully.
author Christian Humer <christian.humer@gmail.com>
date Tue, 26 May 2015 20:04:07 +0200
parents 2170de9acab0
children
line wrap: on
line diff
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/call/SLDispatchNode.java	Tue May 26 20:02:07 2015 +0200
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/call/SLDispatchNode.java	Tue May 26 20:04:07 2015 +0200
@@ -34,6 +34,11 @@
 
     public abstract Object executeDispatch(VirtualFrame frame, SLFunction function, Object[] arguments);
 
+    @Specialization(guards = "function.getCallTarget() == null")
+    protected Object doUndefinedFunction(SLFunction function, @SuppressWarnings("unused") Object[] arguments) {
+        throw new SLUndefinedFunctionException(function.getName());
+    }
+
     /**
      * Inline cached specialization of the dispatch.
      *