Search in sources :

Example 86 with GraphBuilderContext

use of org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderContext in project graal by oracle.

the class AArch64GraphBuilderPlugins method registerMathPlugins.

private static void registerMathPlugins(InvocationPlugins plugins) {
    Registration r = new Registration(plugins, Math.class);
    registerUnaryMath(r, "sin", SIN);
    registerUnaryMath(r, "cos", COS);
    registerUnaryMath(r, "tan", TAN);
    registerUnaryMath(r, "exp", EXP);
    registerUnaryMath(r, "log", LOG);
    registerUnaryMath(r, "log10", LOG10);
    r.register2("pow", Double.TYPE, Double.TYPE, new InvocationPlugin() {

        @Override
        public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode x, ValueNode y) {
            b.push(JavaKind.Double, b.append(BinaryMathIntrinsicNode.create(x, y, BinaryMathIntrinsicNode.BinaryOperation.POW)));
            return true;
        }
    });
}
Also used : GraphBuilderContext(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderContext) Registration(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.Registration) ValueNode(org.graalvm.compiler.nodes.ValueNode) InvocationPlugin(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod)

Example 87 with GraphBuilderContext

use of org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderContext in project graal by oracle.

the class Target_com_oracle_truffle_api_interop_java_ObjectProxyHandler method registerNeverPartOfCompilation.

private void registerNeverPartOfCompilation(InvocationPlugins plugins) {
    Registration r = new Registration(plugins, CompilerAsserts.class);
    r.setAllowOverwrite(true);
    r.register0("neverPartOfCompilation", new InvocationPlugin() {

        @Override
        public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver) {
            return handleNeverPartOfCompilation(b, targetMethod, null);
        }
    });
    r.register1("neverPartOfCompilation", String.class, new InvocationPlugin() {

        @Override
        public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode message) {
            return handleNeverPartOfCompilation(b, targetMethod, message);
        }
    });
}
Also used : GraphBuilderContext(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderContext) Registration(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.Registration) ValueNode(org.graalvm.compiler.nodes.ValueNode) InvocationPlugin(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod)

Example 88 with GraphBuilderContext

use of org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderContext in project graal by oracle.

the class Target_com_oracle_truffle_api_interop_java_ObjectProxyHandler method registerInvocationPlugins.

@Override
public void registerInvocationPlugins(Providers providers, SnippetReflectionProvider snippetReflection, InvocationPlugins invocationPlugins, boolean hosted) {
    /*
         * We need to constant-fold Profile.isProfilingEnabled already during static analysis, so
         * that we get exact types for fields that store profiles.
         */
    Registration r = new Registration(invocationPlugins, Profile.class);
    r.register0("isProfilingEnabled", new InvocationPlugin() {

        @Override
        public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver) {
            b.addPush(JavaKind.Boolean, ConstantNode.forBoolean(Truffle.getRuntime().isProfilingEnabled()));
            return true;
        }
    });
}
Also used : GraphBuilderContext(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderContext) Registration(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.Registration) InvocationPlugin(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod)

Aggregations

GraphBuilderContext (org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderContext)88 ResolvedJavaMethod (jdk.vm.ci.meta.ResolvedJavaMethod)86 InvocationPlugin (org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin)83 ValueNode (org.graalvm.compiler.nodes.ValueNode)76 Registration (org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.Registration)66 Receiver (org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin.Receiver)57 ConvertUnknownValueNode (com.oracle.graal.pointsto.nodes.ConvertUnknownValueNode)13 StackValueNode (com.oracle.svm.core.graal.stackvalue.StackValueNode)13 ResolvedJavaType (jdk.vm.ci.meta.ResolvedJavaType)10 LogicNode (org.graalvm.compiler.nodes.LogicNode)10 JavaKind (jdk.vm.ci.meta.JavaKind)9 DeoptimizeNode (org.graalvm.compiler.nodes.DeoptimizeNode)8 ConstantNode (org.graalvm.compiler.nodes.ConstantNode)7 FixedGuardNode (org.graalvm.compiler.nodes.FixedGuardNode)7 JavaConstant (jdk.vm.ci.meta.JavaConstant)6 ConditionalNode (org.graalvm.compiler.nodes.calc.ConditionalNode)6 ResolvedJavaSymbol (org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.ResolvedJavaSymbol)6 Stamp (org.graalvm.compiler.core.common.type.Stamp)4 GetClassNode (org.graalvm.compiler.nodes.extended.GetClassNode)4 OffsetAddressNode (org.graalvm.compiler.nodes.memory.address.OffsetAddressNode)4