use of org.graalvm.compiler.nodes.java.NewInstanceNode in project graal by oracle.
the class ReflectionSubstitutionType method throwIllegalArgumentException.
private static void throwIllegalArgumentException(HostedGraphKit graphKit, String message) {
ResolvedJavaType exceptionType = graphKit.getMetaAccess().lookupJavaType(IllegalArgumentException.class);
ValueNode ite = graphKit.append(new NewInstanceNode(exceptionType, true));
ResolvedJavaMethod cons = null;
for (ResolvedJavaMethod c : exceptionType.getDeclaredConstructors()) {
if (c.getSignature().getParameterCount(false) == 2) {
cons = c;
}
}
JavaConstant msg = graphKit.getConstantReflection().forString(message);
ValueNode msgNode = graphKit.createConstant(msg, JavaKind.Object);
ValueNode cause = graphKit.createConstant(JavaConstant.NULL_POINTER, JavaKind.Object);
graphKit.createJavaCallWithExceptionAndUnwind(InvokeKind.Special, cons, ite, msgNode, cause);
graphKit.append(new UnwindNode(ite));
}
Aggregations