Search in sources :

Example 11 with StampPair

use of org.graalvm.compiler.core.common.type.StampPair in project graal by oracle.

the class SubstrateObjectCloneNode method genLoadFieldNode.

@Override
protected LoadFieldNode genLoadFieldNode(Assumptions assumptions, ValueNode originalAlias, ResolvedJavaField field) {
    if (field.getJavaKind() == JavaKind.Object && field.getType() instanceof SharedType) {
        /*
             * We have the static analysis to check interface types, e.g.., if a parameter of field
             * has a declared interface type and is assigned something that does not implement the
             * interface, the static analysis reports an error.
             */
        TypeReference trusted = TypeReference.createTrustedWithoutAssumptions((SharedType) field.getType());
        StampPair pair = StampPair.createSingle(StampFactory.object(trusted, false));
        return LoadFieldNode.createOverrideStamp(pair, originalAlias, field);
    } else {
        return super.genLoadFieldNode(assumptions, originalAlias, field);
    }
}
Also used : SharedType(com.oracle.svm.core.meta.SharedType) StampPair(org.graalvm.compiler.core.common.type.StampPair) TypeReference(org.graalvm.compiler.core.common.type.TypeReference)

Example 12 with StampPair

use of org.graalvm.compiler.core.common.type.StampPair in project graal by oracle.

the class WordOperationPlugin method handleLoadField.

@Override
public boolean handleLoadField(GraphBuilderContext b, ValueNode receiver, ResolvedJavaField field) {
    StampPair wordStamp = interceptType(b, field.getType(), false);
    if (wordStamp != null) {
        LoadFieldNode loadFieldNode = LoadFieldNode.createOverrideStamp(wordStamp, receiver, field);
        b.addPush(field.getJavaKind(), loadFieldNode);
        return true;
    }
    return false;
}
Also used : StampPair(org.graalvm.compiler.core.common.type.StampPair) LoadFieldNode(org.graalvm.compiler.nodes.java.LoadFieldNode)

Aggregations

StampPair (org.graalvm.compiler.core.common.type.StampPair)12 MethodCallTargetNode (org.graalvm.compiler.nodes.java.MethodCallTargetNode)7 ResolvedJavaType (jdk.vm.ci.meta.ResolvedJavaType)6 InvokeNode (org.graalvm.compiler.nodes.InvokeNode)6 ValueNode (org.graalvm.compiler.nodes.ValueNode)5 JavaType (jdk.vm.ci.meta.JavaType)4 Signature (jdk.vm.ci.meta.Signature)3 JavaKind (jdk.vm.ci.meta.JavaKind)2 ResolvedJavaMethod (jdk.vm.ci.meta.ResolvedJavaMethod)2 ObjectStamp (org.graalvm.compiler.core.common.type.ObjectStamp)2 Stamp (org.graalvm.compiler.core.common.type.Stamp)2 CallTargetNode (org.graalvm.compiler.nodes.CallTargetNode)2 InvokeKind (org.graalvm.compiler.nodes.CallTargetNode.InvokeKind)2 FrameState (org.graalvm.compiler.nodes.FrameState)2 ParameterNode (org.graalvm.compiler.nodes.ParameterNode)2 SharedType (com.oracle.svm.core.meta.SharedType)1 IntrinsicMethod (jdk.vm.ci.meta.MethodHandleAccessProvider.IntrinsicMethod)1 ResolveClassBeforeStaticInvoke (org.graalvm.compiler.core.common.GraalOptions.ResolveClassBeforeStaticInvoke)1 TypeReference (org.graalvm.compiler.core.common.type.TypeReference)1 DebugCloseable (org.graalvm.compiler.debug.DebugCloseable)1