Search in sources :

Example 1 with JavaType

use of jdk.vm.ci.meta.JavaType in project graal by oracle.

the class AArch64HotSpotNodeLIRBuilder 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 AArch64BreakpointOp(parameters));
}
Also used : JavaType(jdk.vm.ci.meta.JavaType) RegisterValue(jdk.vm.ci.code.RegisterValue) Value(jdk.vm.ci.meta.Value) AllocatableValue(jdk.vm.ci.meta.AllocatableValue) AArch64BreakpointOp(org.graalvm.compiler.lir.aarch64.AArch64BreakpointOp)

Example 2 with JavaType

use of jdk.vm.ci.meta.JavaType in project graal by oracle.

the class AMD64HotSpotNodeLIRBuilder 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 AMD64BreakpointOp(parameters));
}
Also used : AMD64BreakpointOp(org.graalvm.compiler.lir.amd64.AMD64BreakpointOp) JavaType(jdk.vm.ci.meta.JavaType) RegisterValue(jdk.vm.ci.code.RegisterValue) Value(jdk.vm.ci.meta.Value) AllocatableValue(jdk.vm.ci.meta.AllocatableValue)

Example 3 with JavaType

use of jdk.vm.ci.meta.JavaType in project graal by oracle.

the class SubstrateGraphKit method returnStamp.

private Stamp returnStamp(Signature signature) {
    JavaType returnType = signature.getReturnType(null);
    JavaKind returnKind = signature.getReturnKind();
    if (returnKind == JavaKind.Object && returnType instanceof ResolvedJavaType) {
        return StampFactory.object(TypeReference.createTrustedWithoutAssumptions((ResolvedJavaType) returnType));
    } else {
        return getLoweringProvider().loadStamp(StampFactory.forKind(returnKind), signature.getReturnKind());
    }
}
Also used : ResolvedJavaType(jdk.vm.ci.meta.ResolvedJavaType) JavaType(jdk.vm.ci.meta.JavaType) ResolvedJavaType(jdk.vm.ci.meta.ResolvedJavaType) JavaKind(jdk.vm.ci.meta.JavaKind)

Example 4 with JavaType

use of jdk.vm.ci.meta.JavaType in project graal by oracle.

the class MethodHandleNode method createTargetInvokeNode.

/**
 * Creates an {@link InvokeNode} for the given target method. The {@link CallTargetNode} passed
 * to the InvokeNode is in fact a {@link ResolvedMethodHandleCallTargetNode}.
 *
 * @return invoke node for the member name target
 */
private static InvokeNode createTargetInvokeNode(Assumptions assumptions, IntrinsicMethod intrinsicMethod, ResolvedJavaMethod target, ResolvedJavaMethod original, int bci, StampPair returnStamp, ValueNode[] arguments) {
    InvokeKind targetInvokeKind = target.isStatic() ? InvokeKind.Static : InvokeKind.Special;
    JavaType targetReturnType = target.getSignature().getReturnType(null);
    // MethodHandleLinkTo* nodes have a trailing MemberName argument which
    // needs to be popped.
    ValueNode[] targetArguments;
    switch(intrinsicMethod) {
        case INVOKE_BASIC:
            targetArguments = arguments;
            break;
        case LINK_TO_STATIC:
        case LINK_TO_SPECIAL:
        case LINK_TO_VIRTUAL:
        case LINK_TO_INTERFACE:
            targetArguments = Arrays.copyOfRange(arguments, 0, arguments.length - 1);
            break;
        default:
            throw GraalError.shouldNotReachHere();
    }
    StampPair targetReturnStamp = StampFactory.forDeclaredType(assumptions, targetReturnType, false);
    MethodCallTargetNode callTarget = ResolvedMethodHandleCallTargetNode.create(targetInvokeKind, target, targetArguments, targetReturnStamp, original, arguments, returnStamp);
    // (usually java.lang.Object).
    if (returnStamp.getTrustedStamp().getStackKind() == JavaKind.Void) {
        return new InvokeNode(callTarget, bci, StampFactory.forVoid());
    } else {
        return new InvokeNode(callTarget, bci);
    }
}
Also used : ResolvedJavaType(jdk.vm.ci.meta.ResolvedJavaType) JavaType(jdk.vm.ci.meta.JavaType) MethodCallTargetNode(org.graalvm.compiler.nodes.java.MethodCallTargetNode) ValueNode(org.graalvm.compiler.nodes.ValueNode) StampPair(org.graalvm.compiler.core.common.type.StampPair) InvokeNode(org.graalvm.compiler.nodes.InvokeNode) InvokeKind(org.graalvm.compiler.nodes.CallTargetNode.InvokeKind)

Example 5 with JavaType

use of jdk.vm.ci.meta.JavaType in project graal by oracle.

the class JavaConstantFieldProvider method getArrayDimension.

private static int getArrayDimension(JavaType type) {
    int dimensions = 0;
    JavaType componentType = type;
    while ((componentType = componentType.getComponentType()) != null) {
        dimensions++;
    }
    return dimensions;
}
Also used : JavaType(jdk.vm.ci.meta.JavaType) ResolvedJavaType(jdk.vm.ci.meta.ResolvedJavaType)

Aggregations

JavaType (jdk.vm.ci.meta.JavaType)45 ResolvedJavaType (jdk.vm.ci.meta.ResolvedJavaType)35 ValueNode (org.graalvm.compiler.nodes.ValueNode)22 ResolvedJavaMethod (jdk.vm.ci.meta.ResolvedJavaMethod)15 JavaKind (jdk.vm.ci.meta.JavaKind)14 Signature (jdk.vm.ci.meta.Signature)11 ConstantNode (org.graalvm.compiler.nodes.ConstantNode)8 InvokeNode (org.graalvm.compiler.nodes.InvokeNode)8 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)8 InvokeKind (org.graalvm.compiler.nodes.CallTargetNode.InvokeKind)7 EnumInfo (com.oracle.svm.hosted.c.info.EnumInfo)6 ArrayList (java.util.ArrayList)6 InvokeWithExceptionNode (org.graalvm.compiler.nodes.InvokeWithExceptionNode)6 CEntryPoint (org.graalvm.nativeimage.c.function.CEntryPoint)6 NativeLibraries (com.oracle.svm.hosted.c.NativeLibraries)5 StampPair (org.graalvm.compiler.core.common.type.StampPair)5 CEntryPointOptions (com.oracle.svm.core.c.function.CEntryPointOptions)4 ElementInfo (com.oracle.svm.hosted.c.info.ElementInfo)4 HostedGraphKit (com.oracle.svm.hosted.phases.HostedGraphKit)4 ObjectStamp (org.graalvm.compiler.core.common.type.ObjectStamp)4