use of jdk.vm.ci.meta.JavaType in project graal by oracle.
the class GraphKit method startInvokeWithException.
public InvokeWithExceptionNode startInvokeWithException(ResolvedJavaMethod method, InvokeKind invokeKind, FrameStateBuilder frameStateBuilder, int invokeBci, int exceptionEdgeBci, ValueNode... args) {
assert method.isStatic() == (invokeKind == InvokeKind.Static);
Signature signature = method.getSignature();
JavaType returnType = signature.getReturnType(null);
assert checkArgs(method, args);
StampPair returnStamp = graphBuilderPlugins.getOverridingStamp(this, returnType, false);
if (returnStamp == null) {
returnStamp = StampFactory.forDeclaredType(graph.getAssumptions(), returnType, false);
}
ExceptionObjectNode exceptionObject = add(new ExceptionObjectNode(getMetaAccess()));
if (frameStateBuilder != null) {
FrameStateBuilder exceptionState = frameStateBuilder.copy();
exceptionState.clearStack();
exceptionState.push(JavaKind.Object, exceptionObject);
exceptionState.setRethrowException(false);
exceptionObject.setStateAfter(exceptionState.create(exceptionEdgeBci, exceptionObject));
}
MethodCallTargetNode callTarget = graph.add(createMethodCallTarget(invokeKind, method, args, returnStamp, invokeBci));
InvokeWithExceptionNode invoke = append(new InvokeWithExceptionNode(callTarget, exceptionObject, invokeBci));
AbstractBeginNode noExceptionEdge = graph.add(KillingBeginNode.create(LocationIdentity.any()));
invoke.setNext(noExceptionEdge);
if (frameStateBuilder != null) {
if (invoke.getStackKind() != JavaKind.Void) {
frameStateBuilder.push(invoke.getStackKind(), invoke);
}
invoke.setStateAfter(frameStateBuilder.create(invokeBci, invoke));
if (invoke.getStackKind() != JavaKind.Void) {
frameStateBuilder.pop(invoke.getStackKind());
}
}
lastFixedNode = null;
InvokeWithExceptionStructure s = new InvokeWithExceptionStructure();
s.state = InvokeWithExceptionStructure.State.INVOKE;
s.noExceptionEdge = noExceptionEdge;
s.exceptionEdge = exceptionObject;
s.exceptionObject = exceptionObject;
pushStructure(s);
return invoke;
}
use of jdk.vm.ci.meta.JavaType in project graal by oracle.
the class SystemArrayCopyTest method parse.
@Override
protected StructuredGraph parse(StructuredGraph.Builder builder, PhaseSuite<HighTierContext> graphBuilderSuite) {
StructuredGraph graph = super.parse(builder, graphBuilderSuite);
if (argsToBind != null) {
ResolvedJavaMethod m = graph.method();
Object receiver = isStatic(m.getModifiers()) ? null : this;
Object[] args = argsWithReceiver(receiver, argsToBind);
JavaType[] parameterTypes = m.toParameterTypes();
assert parameterTypes.length == args.length;
for (ParameterNode param : graph.getNodes(ParameterNode.TYPE)) {
int index = param.index();
if (args[index] != null) {
JavaConstant c = getSnippetReflection().forBoxed(parameterTypes[index].getJavaKind(), args[index]);
ConstantNode replacement = ConstantNode.forConstant(c, getMetaAccess(), graph);
param.replaceAtUsages(replacement);
}
}
}
return graph;
}
use of jdk.vm.ci.meta.JavaType in project graal by oracle.
the class JNIFieldAccessorMethod method createSignature.
private JNISignature createSignature(MetaAccessProvider metaAccess) {
Class<?> valueClass = fieldKind.toJavaClass();
if (fieldKind.isObject()) {
valueClass = JNIObjectHandle.class;
}
ResolvedJavaType objectHandle = metaAccess.lookupJavaType(JNIObjectHandle.class);
List<JavaType> args = new ArrayList<>();
args.add(metaAccess.lookupJavaType(JNIEnvironment.class));
// this (instance field) or class (static field)
args.add(objectHandle);
args.add(metaAccess.lookupJavaType(JNIFieldId.class));
if (isSetter) {
args.add(metaAccess.lookupJavaType(valueClass));
}
ResolvedJavaType returnType;
if (isSetter) {
returnType = metaAccess.lookupJavaType(Void.TYPE);
} else {
returnType = metaAccess.lookupJavaType(valueClass);
}
return new JNISignature(args, returnType);
}
use of jdk.vm.ci.meta.JavaType in project graal by oracle.
the class InstalledCodeExecuteHelperTest method parse.
@Override
protected StructuredGraph parse(Builder builder, PhaseSuite<HighTierContext> graphBuilderSuite) {
StructuredGraph graph = super.parse(builder, graphBuilderSuite);
if (argsToBind != null) {
ResolvedJavaMethod m = graph.method();
Object receiver = isStatic(m.getModifiers()) ? null : this;
Object[] args = argsWithReceiver(receiver, argsToBind);
JavaType[] parameterTypes = m.toParameterTypes();
assert parameterTypes.length == args.length;
for (int i = 0; i < argsToBind.length; i++) {
ParameterNode param = graph.getParameter(i);
JavaConstant c = getSnippetReflection().forBoxed(parameterTypes[i].getJavaKind(), argsToBind[i]);
ConstantNode replacement = ConstantNode.forConstant(c, getMetaAccess(), graph);
param.replaceAtUsages(replacement);
}
}
return graph;
}
use of jdk.vm.ci.meta.JavaType in project graal by oracle.
the class SPARCHotSpotNodeLIRBuilder method visitBreakpointNode.
@Override
public void visitBreakpointNode(BreakpointNode node) {
JavaType[] sig = new JavaType[node.arguments().size()];
for (int i = 0; i < sig.length; i++) {
sig[i] = node.arguments().get(i).stamp(NodeView.DEFAULT).javaType(gen.getMetaAccess());
}
Value[] parameters = visitInvokeArguments(gen.getRegisterConfig().getCallingConvention(HotSpotCallingConventionType.JavaCall, null, sig, gen), node.arguments());
append(new SPARCBreakpointOp(parameters));
}
Aggregations