Skip to content

Commit

Permalink
use Replacements instead of GeneratedPluginInjectionProvider for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
dougxc committed Nov 1, 2024
1 parent e19da11 commit 6789769
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ protected void createExecute(AbstractProcessor processor, PrintWriter out, Injec
protected void createHelpers(AbstractProcessor processor, PrintWriter out, InjectedDependencies deps) {
out.printf("\n");
out.printf(" @Override\n");
out.printf(" public boolean replace(GraphBuilderContext b, GeneratedPluginInjectionProvider injection, Stamp stamp, NodeInputList<ValueNode> args) {\n");
out.printf(" public boolean replace(GraphBuilderContext b, Replacements injection, Stamp stamp, NodeInputList<ValueNode> args) {\n");

List<? extends VariableElement> params = intrinsicMethod.getParameters();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ protected void createHelpers(AbstractProcessor processor, PrintWriter out, Injec
}
out.printf("\n");
out.printf(" @Override\n");
out.printf(" public boolean replace(GraphBuilderContext b, GeneratedPluginInjectionProvider injection, Stamp stamp, NodeInputList<ValueNode> args) {\n");
out.printf(" public boolean replace(GraphBuilderContext b, Replacements injection, Stamp stamp, NodeInputList<ValueNode> args) {\n");

List<? extends VariableElement> params = getParameters();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ protected static void createImports(PrintWriter out, AbstractProcessor processor
if (plugin.needsReplacement(processor)) {
extra.add("jdk.graal.compiler.options.ExcludeFromJacocoGeneratedReport");
extra.add("jdk.graal.compiler.graph.NodeInputList");
extra.add("jdk.graal.compiler.nodes.spi.Replacements");
if (plugin.isWithExceptionReplacement(processor)) {
extra.add("jdk.graal.compiler.nodes.PluginReplacementWithExceptionNode");
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
*/
package jdk.graal.compiler.nodes;

import jdk.graal.compiler.nodes.graphbuilderconf.GeneratedPluginInjectionProvider;
import jdk.graal.compiler.nodes.graphbuilderconf.GraphBuilderContext;
import jdk.graal.compiler.nodes.graphbuilderconf.InvocationPlugin;
import jdk.graal.compiler.nodes.spi.Replacements;

/**
* Interface for nodes responsible for {@linkplain GraphBuilderContext#shouldDeferPlugin deferring}
Expand All @@ -36,5 +36,5 @@ public interface PluginReplacementInterface extends FixedNodeInterface {
/**
* Replaces this node by applying the stored plugin.
*/
boolean replace(GraphBuilderContext b, GeneratedPluginInjectionProvider injection);
boolean replace(GraphBuilderContext b, Replacements injection);
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
import jdk.graal.compiler.nodeinfo.NodeInfo;
import jdk.graal.compiler.nodeinfo.NodeSize;
import jdk.graal.compiler.nodeinfo.Verbosity;
import jdk.graal.compiler.nodes.graphbuilderconf.GeneratedPluginInjectionProvider;
import jdk.graal.compiler.nodes.graphbuilderconf.GraphBuilderContext;
import jdk.graal.compiler.nodes.spi.Replacements;

@NodeInfo(nameTemplate = "PluginReplacement/{p#pluginName}", cycles = NodeCycles.CYCLES_IGNORED, size = NodeSize.SIZE_IGNORED)
public final class PluginReplacementNode extends FixedWithNextNode implements PluginReplacementInterface {
Expand All @@ -52,12 +52,12 @@ public PluginReplacementNode(Stamp stamp, ValueNode[] args, ReplacementFunction
}

@Override
public boolean replace(GraphBuilderContext b, GeneratedPluginInjectionProvider injection) {
public boolean replace(GraphBuilderContext b, Replacements injection) {
return function.replace(b, injection, stamp, args);
}

public interface ReplacementFunction {
boolean replace(GraphBuilderContext b, GeneratedPluginInjectionProvider injection, Stamp stamp, NodeInputList<ValueNode> args);
boolean replace(GraphBuilderContext b, Replacements injection, Stamp stamp, NodeInputList<ValueNode> args);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
import jdk.graal.compiler.nodeinfo.NodeInfo;
import jdk.graal.compiler.nodeinfo.NodeSize;
import jdk.graal.compiler.nodeinfo.Verbosity;
import jdk.graal.compiler.nodes.graphbuilderconf.GeneratedPluginInjectionProvider;
import jdk.graal.compiler.nodes.graphbuilderconf.GraphBuilderContext;
import jdk.graal.compiler.nodes.spi.Replacements;

@NodeInfo(nameTemplate = "PluginReplacementWithException/{p#pluginName}", cycles = NodeCycles.CYCLES_IGNORED, size = NodeSize.SIZE_IGNORED)
public final class PluginReplacementWithExceptionNode extends WithExceptionNode implements PluginReplacementInterface {
Expand All @@ -52,12 +52,12 @@ public PluginReplacementWithExceptionNode(Stamp stamp, ValueNode[] args, Replace
}

@Override
public boolean replace(GraphBuilderContext b, GeneratedPluginInjectionProvider injection) {
public boolean replace(GraphBuilderContext b, Replacements injection) {
return function.replace(b, injection, stamp, args);
}

public interface ReplacementWithExceptionFunction {
boolean replace(GraphBuilderContext b, GeneratedPluginInjectionProvider injection, Stamp stamp, NodeInputList<ValueNode> args);
boolean replace(GraphBuilderContext b, Replacements injection, Stamp stamp, NodeInputList<ValueNode> args);
}

@Override
Expand Down

0 comments on commit 6789769

Please sign in to comment.