/* * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.graalvm.compiler.nodes.spi; import org.graalvm.compiler.api.replacements.SnippetTemplateCache; import org.graalvm.compiler.bytecode.Bytecode; import org.graalvm.compiler.bytecode.BytecodeProvider; import org.graalvm.compiler.core.common.CompilationIdentifier; import org.graalvm.compiler.debug.DebugContext; import org.graalvm.compiler.graph.NodeSourcePosition; import org.graalvm.compiler.nodes.StructuredGraph; import org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration; import org.graalvm.compiler.options.OptionValues; import jdk.vm.ci.meta.ResolvedJavaMethod; /** * A convenience class when want to subclass and override just a portion of the Replacements API. */ public class DelegatingReplacements implements Replacements { protected final Replacements delegate; public DelegatingReplacements(Replacements delegate) { this.delegate = delegate; } @Override public OptionValues getOptions() { return delegate.getOptions(); } @Override public GraphBuilderConfiguration.Plugins getGraphBuilderPlugins() { return delegate.getGraphBuilderPlugins(); } @Override public StructuredGraph getSnippet(ResolvedJavaMethod method, Object[] args, boolean trackNodeSourcePosition, NodeSourcePosition replaceePosition) { return delegate.getSnippet(method, args, trackNodeSourcePosition, replaceePosition); } @Override public StructuredGraph getSnippet(ResolvedJavaMethod method, ResolvedJavaMethod recursiveEntry, Object[] args, boolean trackNodeSourcePosition, NodeSourcePosition replaceePosition) { return delegate.getSnippet(method, recursiveEntry, args, trackNodeSourcePosition, replaceePosition); } @Override public void registerSnippet(ResolvedJavaMethod method, boolean trackNodeSourcePosition) { delegate.registerSnippet(method, trackNodeSourcePosition); } @Override public StructuredGraph getSubstitution(ResolvedJavaMethod method, int invokeBci, boolean trackNodeSourcePosition, NodeSourcePosition replaceePosition) { return delegate.getSubstitution(method, invokeBci, trackNodeSourcePosition, replaceePosition); } @Override public Bytecode getSubstitutionBytecode(ResolvedJavaMethod method) { return delegate.getSubstitutionBytecode(method); } @Override public StructuredGraph getIntrinsicGraph(ResolvedJavaMethod method, CompilationIdentifier compilationId, DebugContext debug) { return delegate.getIntrinsicGraph(method, compilationId, debug); } @Override public boolean hasSubstitution(ResolvedJavaMethod method, int invokeBci) { return delegate.hasSubstitution(method, invokeBci); } @Override public BytecodeProvider getDefaultReplacementBytecodeProvider() { return delegate.getDefaultReplacementBytecodeProvider(); } @Override public void registerSnippetTemplateCache(SnippetTemplateCache snippetTemplates) { delegate.registerSnippetTemplateCache(snippetTemplates); } @Override public T getSnippetTemplateCache(Class templatesClass) { return delegate.getSnippetTemplateCache(templatesClass); } }