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