src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/spi/DelegatingReplacements.java
author iveresov
Tue, 11 Dec 2018 16:50:43 -0800
changeset 52956 4b0b796dd581
parent 52578 7dd81e82d083
child 54601 c40b2a190173
permissions -rw-r--r--
8215224: 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
/*
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
     2
 * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
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.Bytecode;
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    29
import org.graalvm.compiler.bytecode.BytecodeProvider;
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    30
import org.graalvm.compiler.core.common.CompilationIdentifier;
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    31
import org.graalvm.compiler.debug.DebugContext;
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    32
import org.graalvm.compiler.graph.NodeSourcePosition;
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;
52578
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    36
import org.graalvm.compiler.options.OptionValues;
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    37
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    38
import jdk.vm.ci.meta.ResolvedJavaMethod;
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    39
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    40
/**
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    41
 * A convenience class when want to subclass and override just a portion of the Replacements API.
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    42
 */
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    43
public class DelegatingReplacements implements Replacements {
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    44
    protected final Replacements delegate;
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    45
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    46
    public DelegatingReplacements(Replacements delegate) {
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    47
        this.delegate = delegate;
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    48
    }
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    49
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    50
    @Override
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    51
    public OptionValues getOptions() {
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    52
        return delegate.getOptions();
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    53
    }
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    54
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    55
    @Override
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    56
    public GraphBuilderConfiguration.Plugins getGraphBuilderPlugins() {
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    57
        return delegate.getGraphBuilderPlugins();
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    58
    }
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    59
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    60
    @Override
52956
4b0b796dd581 8215224: Update Graal
iveresov
parents: 52578
diff changeset
    61
    public Class<? extends GraphBuilderPlugin> getIntrinsifyingPlugin(ResolvedJavaMethod method) {
4b0b796dd581 8215224: Update Graal
iveresov
parents: 52578
diff changeset
    62
        return delegate.getIntrinsifyingPlugin(method);
4b0b796dd581 8215224: Update Graal
iveresov
parents: 52578
diff changeset
    63
    }
4b0b796dd581 8215224: Update Graal
iveresov
parents: 52578
diff changeset
    64
4b0b796dd581 8215224: Update Graal
iveresov
parents: 52578
diff changeset
    65
    @Override
52578
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    66
    public StructuredGraph getSnippet(ResolvedJavaMethod method, Object[] args, boolean trackNodeSourcePosition, NodeSourcePosition replaceePosition) {
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    67
        return delegate.getSnippet(method, args, trackNodeSourcePosition, replaceePosition);
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    68
    }
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    69
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    70
    @Override
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    71
    public StructuredGraph getSnippet(ResolvedJavaMethod method, ResolvedJavaMethod recursiveEntry, Object[] args, boolean trackNodeSourcePosition, NodeSourcePosition replaceePosition) {
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    72
        return delegate.getSnippet(method, recursiveEntry, args, trackNodeSourcePosition, replaceePosition);
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    73
    }
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    74
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    75
    @Override
52956
4b0b796dd581 8215224: Update Graal
iveresov
parents: 52578
diff changeset
    76
    public void registerSnippet(ResolvedJavaMethod method, ResolvedJavaMethod original, Object receiver, boolean trackNodeSourcePosition) {
4b0b796dd581 8215224: Update Graal
iveresov
parents: 52578
diff changeset
    77
        delegate.registerSnippet(method, original, receiver, trackNodeSourcePosition);
52578
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    78
    }
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    79
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    80
    @Override
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    81
    public StructuredGraph getSubstitution(ResolvedJavaMethod method, int invokeBci, boolean trackNodeSourcePosition, NodeSourcePosition replaceePosition) {
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    82
        return delegate.getSubstitution(method, invokeBci, trackNodeSourcePosition, replaceePosition);
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
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    86
    public Bytecode getSubstitutionBytecode(ResolvedJavaMethod method) {
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    87
        return delegate.getSubstitutionBytecode(method);
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    88
    }
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    89
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    90
    @Override
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    91
    public StructuredGraph getIntrinsicGraph(ResolvedJavaMethod method, CompilationIdentifier compilationId, DebugContext debug) {
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    92
        return delegate.getIntrinsicGraph(method, compilationId, debug);
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
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    96
    public boolean hasSubstitution(ResolvedJavaMethod method, int invokeBci) {
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
    97
        return delegate.hasSubstitution(method, invokeBci);
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
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
   101
    public BytecodeProvider getDefaultReplacementBytecodeProvider() {
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
   102
        return delegate.getDefaultReplacementBytecodeProvider();
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 void registerSnippetTemplateCache(SnippetTemplateCache snippetTemplates) {
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
   107
        delegate.registerSnippetTemplateCache(snippetTemplates);
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 <T extends SnippetTemplateCache> T getSnippetTemplateCache(Class<T> templatesClass) {
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
   112
        return delegate.getSnippetTemplateCache(templatesClass);
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
   113
    }
7dd81e82d083 8210777: Update Graal
dlong
parents:
diff changeset
   114
}