src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/spi/DelegatingReplacements.java
author dlong
Thu, 31 Oct 2019 16:54:16 -0700
changeset 58877 aec7bf35d6f5
parent 58299 6df94ce3ab2f
permissions -rw-r--r--
8233273: Update Graal Reviewed-by: kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
52578
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
     1
/*
58299
6df94ce3ab2f 8229201: Update Graal
dlong
parents: 55509
diff changeset
     2
 * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
52578
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
     4
 *
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
     7
 * published by the Free Software Foundation.
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
     8
 *
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    13
 * accompanied this code).
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    14
 *
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    18
 *
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    21
 * questions.
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    22
 */
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    23
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    24
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    25
package org.graalvm.compiler.nodes.spi;
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    26
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    27
import org.graalvm.compiler.api.replacements.SnippetTemplateCache;
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    28
import org.graalvm.compiler.bytecode.BytecodeProvider;
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    29
import org.graalvm.compiler.core.common.CompilationIdentifier;
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    30
import org.graalvm.compiler.debug.DebugContext;
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    31
import org.graalvm.compiler.graph.NodeSourcePosition;
55509
d58442b8abc1 8225497: Update Graal
jwilhelm
parents: 54601
diff changeset
    32
import org.graalvm.compiler.nodes.Cancellable;
52578
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    33
import org.graalvm.compiler.nodes.StructuredGraph;
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    34
import org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration;
52956
4b0b796dd581 8215224: Update Graal
iveresov
parents: 52578
diff changeset
    35
import org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderPlugin;
54601
c40b2a190173 8221598: Update Graal
jwilhelm
parents: 52956
diff changeset
    36
import org.graalvm.compiler.nodes.graphbuilderconf.IntrinsicContext;
58877
aec7bf35d6f5 8233273: Update Graal
dlong
parents: 58299
diff changeset
    37
import org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin;
54601
c40b2a190173 8221598: Update Graal
jwilhelm
parents: 52956
diff changeset
    38
import org.graalvm.compiler.nodes.graphbuilderconf.MethodSubstitutionPlugin;
52578
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    39
import org.graalvm.compiler.options.OptionValues;
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    40
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    41
import jdk.vm.ci.meta.ResolvedJavaMethod;
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    42
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    43
/**
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    44
 * A convenience class when want to subclass and override just a portion of the Replacements API.
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    45
 */
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    46
public class DelegatingReplacements implements Replacements {
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    47
    protected final Replacements delegate;
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    48
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    49
    public DelegatingReplacements(Replacements delegate) {
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    50
        this.delegate = delegate;
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    51
    }
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    52
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    53
    @Override
54601
c40b2a190173 8221598: Update Graal
jwilhelm
parents: 52956
diff changeset
    54
    public CoreProviders getProviders() {
c40b2a190173 8221598: Update Graal
jwilhelm
parents: 52956
diff changeset
    55
        return delegate.getProviders();
52578
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    56
    }
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    57
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    58
    @Override
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    59
    public GraphBuilderConfiguration.Plugins getGraphBuilderPlugins() {
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    60
        return delegate.getGraphBuilderPlugins();
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    61
    }
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    62
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    63
    @Override
52956
4b0b796dd581 8215224: Update Graal
iveresov
parents: 52578
diff changeset
    64
    public Class<? extends GraphBuilderPlugin> getIntrinsifyingPlugin(ResolvedJavaMethod method) {
4b0b796dd581 8215224: Update Graal
iveresov
parents: 52578
diff changeset
    65
        return delegate.getIntrinsifyingPlugin(method);
4b0b796dd581 8215224: Update Graal
iveresov
parents: 52578
diff changeset
    66
    }
4b0b796dd581 8215224: Update Graal
iveresov
parents: 52578
diff changeset
    67
4b0b796dd581 8215224: Update Graal
iveresov
parents: 52578
diff changeset
    68
    @Override
54601
c40b2a190173 8221598: Update Graal
jwilhelm
parents: 52956
diff changeset
    69
    public StructuredGraph getSnippet(ResolvedJavaMethod method, ResolvedJavaMethod recursiveEntry, Object[] args, boolean trackNodeSourcePosition, NodeSourcePosition replaceePosition,
c40b2a190173 8221598: Update Graal
jwilhelm
parents: 52956
diff changeset
    70
                    OptionValues options) {
c40b2a190173 8221598: Update Graal
jwilhelm
parents: 52956
diff changeset
    71
        return delegate.getSnippet(method, recursiveEntry, args, trackNodeSourcePosition, replaceePosition, options);
52578
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    72
    }
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    73
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    74
    @Override
54601
c40b2a190173 8221598: Update Graal
jwilhelm
parents: 52956
diff changeset
    75
    public void registerSnippet(ResolvedJavaMethod method, ResolvedJavaMethod original, Object receiver, boolean trackNodeSourcePosition, OptionValues options) {
c40b2a190173 8221598: Update Graal
jwilhelm
parents: 52956
diff changeset
    76
        delegate.registerSnippet(method, original, receiver, trackNodeSourcePosition, options);
52578
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    77
    }
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    78
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    79
    @Override
54601
c40b2a190173 8221598: Update Graal
jwilhelm
parents: 52956
diff changeset
    80
    public StructuredGraph getMethodSubstitution(MethodSubstitutionPlugin plugin, ResolvedJavaMethod original, IntrinsicContext.CompilationContext context,
55509
d58442b8abc1 8225497: Update Graal
jwilhelm
parents: 54601
diff changeset
    81
                    StructuredGraph.AllowAssumptions allowAssumptions, Cancellable cancellable, OptionValues options) {
d58442b8abc1 8225497: Update Graal
jwilhelm
parents: 54601
diff changeset
    82
        return delegate.getMethodSubstitution(plugin, original, context, allowAssumptions, cancellable, options);
52578
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    83
    }
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    84
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    85
    @Override
58877
aec7bf35d6f5 8233273: Update Graal
dlong
parents: 58299
diff changeset
    86
    public void registerMethodSubstitution(MethodSubstitutionPlugin plugin) {
aec7bf35d6f5 8233273: Update Graal
dlong
parents: 58299
diff changeset
    87
        delegate.registerMethodSubstitution(plugin);
aec7bf35d6f5 8233273: Update Graal
dlong
parents: 58299
diff changeset
    88
    }
aec7bf35d6f5 8233273: Update Graal
dlong
parents: 58299
diff changeset
    89
aec7bf35d6f5 8233273: Update Graal
dlong
parents: 58299
diff changeset
    90
    @Override
aec7bf35d6f5 8233273: Update Graal
dlong
parents: 58299
diff changeset
    91
    public void registerConditionalPlugin(InvocationPlugin plugin) {
aec7bf35d6f5 8233273: Update Graal
dlong
parents: 58299
diff changeset
    92
        delegate.registerConditionalPlugin(plugin);
52578
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    93
    }
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    94
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    95
    @Override
54601
c40b2a190173 8221598: Update Graal
jwilhelm
parents: 52956
diff changeset
    96
    public StructuredGraph getSubstitution(ResolvedJavaMethod method, int invokeBci, boolean trackNodeSourcePosition, NodeSourcePosition replaceePosition, OptionValues options) {
c40b2a190173 8221598: Update Graal
jwilhelm
parents: 52956
diff changeset
    97
        return delegate.getSubstitution(method, invokeBci, trackNodeSourcePosition, replaceePosition, options);
52578
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    98
    }
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    99
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
   100
    @Override
55509
d58442b8abc1 8225497: Update Graal
jwilhelm
parents: 54601
diff changeset
   101
    public StructuredGraph getIntrinsicGraph(ResolvedJavaMethod method, CompilationIdentifier compilationId, DebugContext debug, Cancellable cancellable) {
d58442b8abc1 8225497: Update Graal
jwilhelm
parents: 54601
diff changeset
   102
        return delegate.getIntrinsicGraph(method, compilationId, debug, cancellable);
52578
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
   103
    }
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
   104
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
   105
    @Override
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
   106
    public boolean hasSubstitution(ResolvedJavaMethod method, int invokeBci) {
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
   107
        return delegate.hasSubstitution(method, invokeBci);
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
   108
    }
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
   109
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
   110
    @Override
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
   111
    public BytecodeProvider getDefaultReplacementBytecodeProvider() {
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
   112
        return delegate.getDefaultReplacementBytecodeProvider();
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
   113
    }
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
   114
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
   115
    @Override
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
   116
    public void registerSnippetTemplateCache(SnippetTemplateCache snippetTemplates) {
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
   117
        delegate.registerSnippetTemplateCache(snippetTemplates);
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
   118
    }
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
   119
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
   120
    @Override
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
   121
    public <T extends SnippetTemplateCache> T getSnippetTemplateCache(Class<T> templatesClass) {
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
   122
        return delegate.getSnippetTemplateCache(templatesClass);
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
   123
    }
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
   124
}