changeset 3006:6da8b9c8cdad

Renamed BlockEnd=>ControlSplit.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Thu, 16 Jun 2011 16:32:52 +0200
parents ba35c5e9894e
children de3ac4888421
files graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/BlockEnd.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/ControlSplit.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/ExceptionDispatch.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/If.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Switch.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/GraphBuilderPhase.java
diffstat 6 files changed, 124 insertions(+), 125 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/BlockEnd.java	Thu Jun 16 16:31:29 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) 2009, 2011, 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 com.oracle.max.graal.compiler.ir;
-
-import java.util.*;
-
-import com.oracle.max.graal.graph.*;
-import com.sun.cri.ci.*;
-
-/**
- * The {@code BlockEnd} instruction is a base class for all instructions that end a basic
- * block, including branches, switches, throws, and goto's.
- */
-public abstract class BlockEnd extends FixedNode {
-
-    private static final int INPUT_COUNT = 0;
-
-    private static final int SUCCESSOR_COUNT = 0;
-    private final int blockSuccessorCount;
-
-    @Override
-    protected int inputCount() {
-        return super.inputCount() + INPUT_COUNT;
-    }
-
-    @Override
-    protected int successorCount() {
-        return super.successorCount() + blockSuccessorCount + SUCCESSOR_COUNT;
-    }
-
-    /**
-     * The list of instructions that produce input for this instruction.
-     */
-    public FixedNode blockSuccessor(int index) {
-        assert index >= 0 && index < blockSuccessorCount;
-        return (FixedNode) successors().get(super.successorCount() + SUCCESSOR_COUNT + index);
-    }
-
-    public FixedNode setBlockSuccessor(int index, FixedNode n) {
-        assert index >= 0 && index < blockSuccessorCount;
-        return (FixedNode) successors().set(super.successorCount() + SUCCESSOR_COUNT + index, n);
-    }
-
-    public int blockSuccessorCount() {
-        return blockSuccessorCount;
-    }
-
-    /**
-     * Constructs a new block end with the specified value type.
-     * @param kind the type of the value produced by this instruction
-     * @param successors the list of successor blocks. If {@code null}, a new one will be created.
-     */
-    public BlockEnd(CiKind kind, List<? extends FixedNode> blockSuccessors, int inputCount, int successorCount, Graph graph) {
-        this(kind, blockSuccessors.size(), inputCount, successorCount, graph);
-        for (int i = 0; i < blockSuccessors.size(); i++) {
-            setBlockSuccessor(i, blockSuccessors.get(i));
-        }
-    }
-
-    public BlockEnd(CiKind kind, int blockSuccessorCount, int inputCount, int successorCount, Graph graph) {
-        super(kind, inputCount + INPUT_COUNT, successorCount + blockSuccessorCount + SUCCESSOR_COUNT, graph);
-        this.blockSuccessorCount = blockSuccessorCount;
-    }
-
-    public BlockEnd(CiKind kind, Graph graph) {
-        this(kind, 2, 0, 0, graph);
-    }
-
-    /**
-     * Gets the successor corresponding to the default (fall through) case.
-     * @return the default successor
-     */
-    public FixedNode defaultSuccessor() {
-        return blockSuccessor(blockSuccessorCount - 1);
-    }
-
-    /**
-     * Searches for the specified successor and returns its index into the
-     * successor list if found.
-     * @param b the block to search for in the successor list
-     * @return the index of the block in the list if found; <code>-1</code> otherwise
-     */
-    public int successorIndex(Merge b) {
-        for (int i = 0; i < blockSuccessorCount; i++) {
-            if (blockSuccessor(i) == b) {
-                return i;
-            }
-        }
-        return -1;
-    }
-
-    /**
-     * Gets this block end's list of successors.
-     * @return the successor list
-     */
-    @SuppressWarnings({ "unchecked", "rawtypes"})
-    public List<Instruction> blockSuccessors() {
-        List<Instruction> list = (List) successors().subList(super.successorCount() + SUCCESSOR_COUNT, super.successorCount() + blockSuccessorCount + SUCCESSOR_COUNT);
-        return Collections.unmodifiableList(list);
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/ControlSplit.java	Thu Jun 16 16:32:52 2011 +0200
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2009, 2011, 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 com.oracle.max.graal.compiler.ir;
+
+import java.util.*;
+
+import com.oracle.max.graal.graph.*;
+import com.sun.cri.ci.*;
+
+/**
+ * The {@code BlockEnd} instruction is a base class for all instructions that end a basic
+ * block, including branches, switches, throws, and goto's.
+ */
+public abstract class ControlSplit extends FixedNode {
+
+    private static final int INPUT_COUNT = 0;
+
+    private static final int SUCCESSOR_COUNT = 0;
+    private final int blockSuccessorCount;
+
+    @Override
+    protected int inputCount() {
+        return super.inputCount() + INPUT_COUNT;
+    }
+
+    @Override
+    protected int successorCount() {
+        return super.successorCount() + blockSuccessorCount + SUCCESSOR_COUNT;
+    }
+
+    /**
+     * The list of instructions that produce input for this instruction.
+     */
+    public FixedNode blockSuccessor(int index) {
+        assert index >= 0 && index < blockSuccessorCount;
+        return (FixedNode) successors().get(super.successorCount() + SUCCESSOR_COUNT + index);
+    }
+
+    public FixedNode setBlockSuccessor(int index, FixedNode n) {
+        assert index >= 0 && index < blockSuccessorCount;
+        return (FixedNode) successors().set(super.successorCount() + SUCCESSOR_COUNT + index, n);
+    }
+
+    public int blockSuccessorCount() {
+        return blockSuccessorCount;
+    }
+
+    /**
+     * Constructs a new block end with the specified value type.
+     * @param kind the type of the value produced by this instruction
+     * @param successors the list of successor blocks. If {@code null}, a new one will be created.
+     */
+    public ControlSplit(CiKind kind, List<? extends FixedNode> blockSuccessors, int inputCount, int successorCount, Graph graph) {
+        this(kind, blockSuccessors.size(), inputCount, successorCount, graph);
+        for (int i = 0; i < blockSuccessors.size(); i++) {
+            setBlockSuccessor(i, blockSuccessors.get(i));
+        }
+    }
+
+    public ControlSplit(CiKind kind, int blockSuccessorCount, int inputCount, int successorCount, Graph graph) {
+        super(kind, inputCount + INPUT_COUNT, successorCount + blockSuccessorCount + SUCCESSOR_COUNT, graph);
+        this.blockSuccessorCount = blockSuccessorCount;
+    }
+
+    public ControlSplit(CiKind kind, Graph graph) {
+        this(kind, 2, 0, 0, graph);
+    }
+
+    /**
+     * Gets the successor corresponding to the default (fall through) case.
+     * @return the default successor
+     */
+    public FixedNode defaultSuccessor() {
+        return blockSuccessor(blockSuccessorCount - 1);
+    }
+
+    /**
+     * Searches for the specified successor and returns its index into the
+     * successor list if found.
+     * @param b the block to search for in the successor list
+     * @return the index of the block in the list if found; <code>-1</code> otherwise
+     */
+    public int successorIndex(Merge b) {
+        for (int i = 0; i < blockSuccessorCount; i++) {
+            if (blockSuccessor(i) == b) {
+                return i;
+            }
+        }
+        return -1;
+    }
+
+    /**
+     * Gets this block end's list of successors.
+     * @return the successor list
+     */
+    @SuppressWarnings({ "unchecked", "rawtypes"})
+    public List<Instruction> blockSuccessors() {
+        List<Instruction> list = (List) successors().subList(super.successorCount() + SUCCESSOR_COUNT, super.successorCount() + blockSuccessorCount + SUCCESSOR_COUNT);
+        return Collections.unmodifiableList(list);
+    }
+}
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/ExceptionDispatch.java	Thu Jun 16 16:31:29 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/ExceptionDispatch.java	Thu Jun 16 16:32:52 2011 +0200
@@ -31,7 +31,7 @@
  * This instruction takes an exception object and has two successors:
  * The catchSuccessor is called whenever the exception matches the given type, otherwise otherSuccessor is called.
  */
-public final class ExceptionDispatch extends BlockEnd {
+public final class ExceptionDispatch extends ControlSplit {
 
     private static final int INPUT_COUNT = 1;
     private static final int INPUT_EXCEPTION = 0;
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/If.java	Thu Jun 16 16:31:29 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/If.java	Thu Jun 16 16:32:52 2011 +0200
@@ -30,7 +30,7 @@
  * The {@code If} instruction represents a branch that can go one of two directions
  * depending on the outcome of a comparison.
  */
-public final class If extends BlockEnd {
+public final class If extends ControlSplit {
 
     private static final int INPUT_COUNT = 1;
     private static final int INPUT_COMPARE = 0;
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Switch.java	Thu Jun 16 16:31:29 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Switch.java	Thu Jun 16 16:32:52 2011 +0200
@@ -30,7 +30,7 @@
 /**
  * The {@code Switch} class is the base of both lookup and table switches.
  */
-public abstract class Switch extends BlockEnd {
+public abstract class Switch extends ControlSplit {
 
     private static final int INPUT_COUNT = 1;
     private static final int INPUT_VALUE = 0;
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/GraphBuilderPhase.java	Thu Jun 16 16:31:29 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/GraphBuilderPhase.java	Thu Jun 16 16:32:52 2011 +0200
@@ -1217,7 +1217,6 @@
                     merge.setNext(begin.next());
                     merge.setStateAfter(begin.stateAfter());
                     begin.replace(merge);
-                    TTY.println("replace loop");
                 }
             }
         }