Search in sources :

Example 51 with ResolvedJavaMethod

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

the class ProfilingInfoTest method resetProfile.

private void resetProfile(String methodName) {
    ResolvedJavaMethod javaMethod = getResolvedJavaMethod(methodName);
    javaMethod.reprofile();
}
Also used : ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod)

Example 52 with ResolvedJavaMethod

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

the class ObjectTreePrinter method forScannedConstant.

@Override
protected void forScannedConstant(JavaConstant scannedValue, Object reason) {
    JVMCIError.guarantee(scannedValue != null, "scannedValue is null");
    constantToNode.computeIfAbsent(scannedValue, c -> {
        ObjectNodeBase node;
        if (reason instanceof ResolvedJavaField) {
            ResolvedJavaField field = (ResolvedJavaField) reason;
            if (field.isStatic()) {
                node = ObjectNodeBase.fromConstant(bb, scannedValue, new RootSource(field));
            } else {
                node = ObjectNodeBase.fromConstant(bb, scannedValue);
            }
        } else if (reason instanceof ResolvedJavaMethod) {
            ResolvedJavaMethod method = (ResolvedJavaMethod) reason;
            node = ObjectNodeBase.fromConstant(bb, scannedValue, new RootSource(method));
        } else {
            node = ObjectNodeBase.fromConstant(bb, scannedValue);
        }
        return node;
    });
}
Also used : ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod) ResolvedJavaField(jdk.vm.ci.meta.ResolvedJavaField)

Example 53 with ResolvedJavaMethod

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

the class StaticAnalysisResultsBuilder method createMethodProfile.

private JavaMethodProfile createMethodProfile(Collection<AnalysisMethod> callees) {
    ProfiledMethod[] pitems = new ProfiledMethod[callees.size()];
    double probability = 1d / pitems.length;
    int idx = 0;
    for (AnalysisMethod aMethod : callees) {
        ResolvedJavaMethod convertedMethod = converter == null ? aMethod : converter.lookup(aMethod);
        pitems[idx++] = new ProfiledMethod(convertedMethod, probability);
    }
    return new JavaMethodProfile(0, pitems);
}
Also used : ProfiledMethod(jdk.vm.ci.meta.JavaMethodProfile.ProfiledMethod) AnalysisMethod(com.oracle.graal.pointsto.meta.AnalysisMethod) JavaMethodProfile(jdk.vm.ci.meta.JavaMethodProfile) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod)

Example 54 with ResolvedJavaMethod

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

the class AnalysisType method resolveMethod.

@Override
public AnalysisMethod resolveMethod(ResolvedJavaMethod method, ResolvedJavaType callerType) {
    Object resolvedMethod = resolvedMethods.get(method);
    if (resolvedMethod == null) {
        ResolvedJavaMethod substMethod = universe.substitutions.resolve(((AnalysisMethod) method).wrapped);
        /*
             * We do not want any access checks to be performed, so we use the method's declaring
             * class as the caller type.
             */
        ResolvedJavaType substCallerType = substMethod.getDeclaringClass();
        Object newResolvedMethod = universe.lookup(wrapped.resolveMethod(substMethod, substCallerType));
        if (newResolvedMethod == null) {
            newResolvedMethod = NULL_METHOD;
        }
        Object oldResolvedMethod = resolvedMethods.putIfAbsent(method, newResolvedMethod);
        resolvedMethod = oldResolvedMethod != null ? oldResolvedMethod : newResolvedMethod;
    }
    return resolvedMethod == NULL_METHOD ? null : (AnalysisMethod) resolvedMethod;
}
Also used : AnalysisObject(com.oracle.graal.pointsto.flow.context.object.AnalysisObject) ConstantContextSensitiveObject(com.oracle.graal.pointsto.flow.context.object.ConstantContextSensitiveObject) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod) ResolvedJavaType(jdk.vm.ci.meta.ResolvedJavaType)

Example 55 with ResolvedJavaMethod

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

the class AnalysisUniverse method lookupAllowUnresolved.

@Override
public JavaMethod lookupAllowUnresolved(JavaMethod rawMethod) {
    if (rawMethod == null) {
        return null;
    }
    if (!(rawMethod instanceof ResolvedJavaMethod)) {
        return rawMethod;
    }
    assert !(rawMethod instanceof AnalysisMethod);
    ResolvedJavaMethod method = (ResolvedJavaMethod) rawMethod;
    method = substitutions.lookup(method);
    AnalysisMethod result = methods.get(method);
    if (result == null) {
        result = createMethod(method);
    }
    return result;
}
Also used : ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod)

Aggregations

ResolvedJavaMethod (jdk.vm.ci.meta.ResolvedJavaMethod)331 ValueNode (org.graalvm.compiler.nodes.ValueNode)104 InvocationPlugin (org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin)92 GraphBuilderContext (org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderContext)89 Registration (org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.Registration)67 ResolvedJavaType (jdk.vm.ci.meta.ResolvedJavaType)66 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)66 Receiver (org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin.Receiver)57 Test (org.junit.Test)54 DebugContext (org.graalvm.compiler.debug.DebugContext)35 OptionValues (org.graalvm.compiler.options.OptionValues)32 InstalledCode (jdk.vm.ci.code.InstalledCode)24 MetaAccessProvider (jdk.vm.ci.meta.MetaAccessProvider)23 GraalCompilerTest (org.graalvm.compiler.core.test.GraalCompilerTest)22 JavaKind (jdk.vm.ci.meta.JavaKind)21 MethodCallTargetNode (org.graalvm.compiler.nodes.java.MethodCallTargetNode)20 ConstantNode (org.graalvm.compiler.nodes.ConstantNode)19 JavaConstant (jdk.vm.ci.meta.JavaConstant)17 LogicNode (org.graalvm.compiler.nodes.LogicNode)17 ArrayList (java.util.ArrayList)16