comparison graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/InvocationPlugin.java @ 21543:93c50cefb9e8

moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
author Doug Simon <doug.simon@oracle.com>
date Mon, 25 May 2015 23:30:34 +0200
parents 9cc0395dcd36
children f4b3a6dadb44
comparison
equal deleted inserted replaced
21542:543957c1c6a6 21543:93c50cefb9e8
24 24
25 import java.lang.invoke.*; 25 import java.lang.invoke.*;
26 import java.lang.reflect.*; 26 import java.lang.reflect.*;
27 27
28 import com.oracle.graal.api.meta.*; 28 import com.oracle.graal.api.meta.*;
29 import com.oracle.graal.compiler.common.*;
30 import com.oracle.graal.graphbuilderconf.MethodIdMap.Receiver; 29 import com.oracle.graal.graphbuilderconf.MethodIdMap.Receiver;
31 import com.oracle.graal.nodes.*; 30 import com.oracle.graal.nodes.*;
31 import com.oracle.jvmci.common.*;
32 32
33 /** 33 /**
34 * Plugin for handling a specific method invocation. 34 * Plugin for handling a specific method invocation.
35 */ 35 */
36 public interface InvocationPlugin extends GraphBuilderPlugin { 36 public interface InvocationPlugin extends GraphBuilderPlugin {
163 163
164 /** 164 /**
165 * Handles an invocation when a specific {@code apply} method is not available. 165 * Handles an invocation when a specific {@code apply} method is not available.
166 */ 166 */
167 default boolean defaultHandler(@SuppressWarnings("unused") GraphBuilderContext b, ResolvedJavaMethod targetMethod, @SuppressWarnings("unused") Receiver receiver, ValueNode... args) { 167 default boolean defaultHandler(@SuppressWarnings("unused") GraphBuilderContext b, ResolvedJavaMethod targetMethod, @SuppressWarnings("unused") Receiver receiver, ValueNode... args) {
168 throw new GraalInternalError("Invocation plugin for %s does not handle invocations with %d arguments", targetMethod.format("%H.%n(%p)"), args.length); 168 throw new JVMCIError("Invocation plugin for %s does not handle invocations with %d arguments", targetMethod.format("%H.%n(%p)"), args.length);
169 } 169 }
170 170
171 default StackTraceElement getApplySourceLocation(MetaAccessProvider metaAccess) { 171 default StackTraceElement getApplySourceLocation(MetaAccessProvider metaAccess) {
172 Class<?> c = getClass(); 172 Class<?> c = getClass();
173 for (Method m : c.getDeclaredMethods()) { 173 for (Method m : c.getDeclaredMethods()) {
175 return metaAccess.lookupJavaMethod(m).asStackTraceElement(0); 175 return metaAccess.lookupJavaMethod(m).asStackTraceElement(0);
176 } else if (m.getName().equals("defaultHandler")) { 176 } else if (m.getName().equals("defaultHandler")) {
177 return metaAccess.lookupJavaMethod(m).asStackTraceElement(0); 177 return metaAccess.lookupJavaMethod(m).asStackTraceElement(0);
178 } 178 }
179 } 179 }
180 throw new GraalInternalError("could not find method named \"apply\" or \"defaultHandler\" in " + c.getName()); 180 throw new JVMCIError("could not find method named \"apply\" or \"defaultHandler\" in " + c.getName());
181 } 181 }
182 } 182 }