src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/match/MatchStatement.java
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/match/MatchStatement.java Thu Mar 28 11:06:00 2019 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/match/MatchStatement.java Thu Mar 28 19:39:14 2019 +0100
@@ -26,8 +26,6 @@
import static org.graalvm.compiler.debug.DebugOptions.LogVerbose;
-import java.util.List;
-
import org.graalvm.compiler.core.gen.NodeLIRBuilder;
import org.graalvm.compiler.core.match.MatchPattern.MatchResultCode;
import org.graalvm.compiler.core.match.MatchPattern.Result;
@@ -38,6 +36,8 @@
import org.graalvm.compiler.nodeinfo.Verbosity;
import jdk.vm.ci.meta.Value;
+import org.graalvm.compiler.nodes.StructuredGraph;
+import org.graalvm.compiler.nodes.cfg.Block;
/**
* A named {@link MatchPattern} along with a {@link MatchGenerator} that can be evaluated to replace
@@ -80,20 +80,21 @@
*
* @param builder the current builder instance.
* @param node the node to be matched
- * @param nodes the nodes in the current block
+ * @param block the current block
+ * @param schedule the schedule that's being used
* @return true if the statement matched something and set a {@link ComplexMatchResult} to be
* evaluated by the NodeLIRBuilder.
*/
- public boolean generate(NodeLIRBuilder builder, int index, Node node, List<Node> nodes) {
+ public boolean generate(NodeLIRBuilder builder, int index, Node node, Block block, StructuredGraph.ScheduleResult schedule) {
DebugContext debug = node.getDebug();
- assert index == nodes.indexOf(node);
+ assert index == schedule.getBlockToNodesMap().get(block).indexOf(node);
// Check that the basic shape matches
Result result = pattern.matchShape(node, this);
if (result != Result.OK) {
return false;
}
// Now ensure that the other safety constraints are matched.
- MatchContext context = new MatchContext(builder, this, index, node, nodes);
+ MatchContext context = new MatchContext(builder, this, index, node, block, schedule);
result = pattern.matchUsage(node, context);
if (result == Result.OK) {
// Invoke the generator method and set the result if it's non null.