src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/VerifyFoldableMethods.java
branchdatagramsocketimpl-branch
changeset 58678 9cf78a70fa4f
parent 54328 37648a9c4a6a
child 58679 9c3209ff7550
equal deleted inserted replaced
58677:13588c901957 58678:9cf78a70fa4f
     1 /*
     1 /*
     2  * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    30 
    30 
    31 import org.graalvm.compiler.api.replacements.Fold;
    31 import org.graalvm.compiler.api.replacements.Fold;
    32 import org.graalvm.compiler.nodes.StructuredGraph;
    32 import org.graalvm.compiler.nodes.StructuredGraph;
    33 import org.graalvm.compiler.nodes.graphbuilderconf.GeneratedInvocationPlugin;
    33 import org.graalvm.compiler.nodes.graphbuilderconf.GeneratedInvocationPlugin;
    34 import org.graalvm.compiler.nodes.java.MethodCallTargetNode;
    34 import org.graalvm.compiler.nodes.java.MethodCallTargetNode;
       
    35 import org.graalvm.compiler.nodes.spi.CoreProviders;
    35 import org.graalvm.compiler.phases.VerifyPhase;
    36 import org.graalvm.compiler.phases.VerifyPhase;
    36 import org.graalvm.compiler.phases.tiers.PhaseContext;
       
    37 
    37 
    38 import jdk.vm.ci.meta.ResolvedJavaMethod;
    38 import jdk.vm.ci.meta.ResolvedJavaMethod;
    39 import jdk.vm.ci.meta.ResolvedJavaType;
    39 import jdk.vm.ci.meta.ResolvedJavaType;
    40 
    40 
    41 /**
    41 /**
    42  * Verifies that all {@link Fold} annotated methods have at least one caller.
    42  * Verifies that all {@link Fold} annotated methods have at least one caller.
    43  */
    43  */
    44 public class VerifyFoldableMethods extends VerifyPhase<PhaseContext> {
    44 public class VerifyFoldableMethods extends VerifyPhase<CoreProviders> {
    45 
    45 
    46     @Override
    46     @Override
    47     public boolean checkContract() {
    47     public boolean checkContract() {
    48         return false;
    48         return false;
    49     }
    49     }
    50 
    50 
    51     private final Map<ResolvedJavaMethod, Boolean> foldables = new ConcurrentHashMap<>();
    51     private final Map<ResolvedJavaMethod, Boolean> foldables = new ConcurrentHashMap<>();
    52     ResolvedJavaType generatedInvocationPluginType;
    52     ResolvedJavaType generatedInvocationPluginType;
    53 
    53 
    54     @Override
    54     @Override
    55     protected void verify(StructuredGraph graph, PhaseContext context) {
    55     protected void verify(StructuredGraph graph, CoreProviders context) {
    56         ResolvedJavaMethod method = graph.method();
    56         ResolvedJavaMethod method = graph.method();
    57         if (method.getAnnotation(Fold.class) != null) {
    57         if (method.getAnnotation(Fold.class) != null) {
    58             foldables.putIfAbsent(method, false);
    58             foldables.putIfAbsent(method, false);
    59         } else {
    59         } else {
    60             if (generatedInvocationPluginType == null) {
    60             if (generatedInvocationPluginType == null) {