src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/cfg/AbstractBlockBase.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/cfg

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/cfg/AbstractBlockBase.java

Print this page




   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 package org.graalvm.compiler.core.common.cfg;
  24 
  25 import java.util.Collections;
  26 import java.util.List;
  27 
  28 public abstract class AbstractBlockBase<T extends AbstractBlockBase<T>> {
  29 
  30     protected int id;
  31     protected int domDepth;
  32 
  33     protected T[] predecessors;
  34     protected T[] successors;
  35 
  36     private T dominator;
  37     private List<T> dominated;

  38     private int domNumber;
  39     private int maxChildDomNumber;
  40 
  41     private boolean align;
  42     private int linearScanNumber;
  43 
  44     protected AbstractBlockBase() {
  45         this.id = AbstractControlFlowGraph.BLOCK_ID_INITIAL;
  46         this.linearScanNumber = -1;
  47         this.domNumber = -1;
  48         this.maxChildDomNumber = -1;
  49     }
  50 
  51     public void setDominatorNumber(int domNumber) {
  52         this.domNumber = domNumber;
  53     }
  54 
  55     public void setMaxChildDomNumber(int maxChildDomNumber) {
  56         this.maxChildDomNumber = maxChildDomNumber;
  57     }


  80         this.predecessors = predecessors;
  81     }
  82 
  83     public T[] getSuccessors() {
  84         return successors;
  85     }
  86 
  87     public void setSuccessors(T[] successors) {
  88         this.successors = successors;
  89     }
  90 
  91     public T getDominator() {
  92         return dominator;
  93     }
  94 
  95     public void setDominator(T dominator) {
  96         this.dominator = dominator;
  97         this.domDepth = dominator.domDepth + 1;
  98     }
  99 



 100     public int getDominatorDepth() {
 101         return domDepth;
 102     }
 103 
 104     public List<T> getDominated() {
 105         if (dominated == null) {
 106             return Collections.emptyList();



 107         }
 108         return dominated;


 109     }
 110 
 111     public void setDominated(List<T> blocks) {
 112         dominated = blocks;
 113     }
 114 
 115     @Override
 116     public String toString() {
 117         return "B" + id;
 118     }
 119 
 120     public int getPredecessorCount() {
 121         return getPredecessors().length;
 122     }
 123 
 124     public int getSuccessorCount() {
 125         return getSuccessors().length;
 126     }
 127 
 128     public int getLinearScanNumber() {
 129         return linearScanNumber;
 130     }
 131 
 132     public void setLinearScanNumber(int linearScanNumber) {


 141         this.align = align;
 142     }
 143 
 144     public abstract boolean isExceptionEntry();
 145 
 146     public abstract Loop<T> getLoop();
 147 
 148     public abstract int getLoopDepth();
 149 
 150     public abstract void delete();
 151 
 152     public abstract boolean isLoopEnd();
 153 
 154     public abstract boolean isLoopHeader();
 155 
 156     public abstract T getPostdominator();
 157 
 158     public abstract double probability();
 159 
 160     public abstract T getDominator(int distance);





 161 }


   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 package org.graalvm.compiler.core.common.cfg;
  24 



  25 public abstract class AbstractBlockBase<T extends AbstractBlockBase<T>> {
  26 
  27     protected int id;
  28     protected int domDepth;
  29 
  30     protected T[] predecessors;
  31     protected T[] successors;
  32 
  33     private T dominator;
  34     private T firstDominated;
  35     private T dominatedSibling;
  36     private int domNumber;
  37     private int maxChildDomNumber;
  38 
  39     private boolean align;
  40     private int linearScanNumber;
  41 
  42     protected AbstractBlockBase() {
  43         this.id = AbstractControlFlowGraph.BLOCK_ID_INITIAL;
  44         this.linearScanNumber = -1;
  45         this.domNumber = -1;
  46         this.maxChildDomNumber = -1;
  47     }
  48 
  49     public void setDominatorNumber(int domNumber) {
  50         this.domNumber = domNumber;
  51     }
  52 
  53     public void setMaxChildDomNumber(int maxChildDomNumber) {
  54         this.maxChildDomNumber = maxChildDomNumber;
  55     }


  78         this.predecessors = predecessors;
  79     }
  80 
  81     public T[] getSuccessors() {
  82         return successors;
  83     }
  84 
  85     public void setSuccessors(T[] successors) {
  86         this.successors = successors;
  87     }
  88 
  89     public T getDominator() {
  90         return dominator;
  91     }
  92 
  93     public void setDominator(T dominator) {
  94         this.dominator = dominator;
  95         this.domDepth = dominator.domDepth + 1;
  96     }
  97 
  98     /**
  99      * Level in the dominator tree starting with 0 for the start block.
 100      */
 101     public int getDominatorDepth() {
 102         return domDepth;
 103     }
 104 
 105     public T getFirstDominated() {
 106         return this.firstDominated;
 107     }
 108 
 109     public void setFirstDominated(T block) {
 110         this.firstDominated = block;
 111     }
 112 
 113     public T getDominatedSibling() {
 114         return this.dominatedSibling;
 115     }
 116 
 117     public void setDominatedSibling(T block) {
 118         this.dominatedSibling = block;
 119     }
 120 
 121     @Override
 122     public String toString() {
 123         return "B" + id;
 124     }
 125 
 126     public int getPredecessorCount() {
 127         return getPredecessors().length;
 128     }
 129 
 130     public int getSuccessorCount() {
 131         return getSuccessors().length;
 132     }
 133 
 134     public int getLinearScanNumber() {
 135         return linearScanNumber;
 136     }
 137 
 138     public void setLinearScanNumber(int linearScanNumber) {


 147         this.align = align;
 148     }
 149 
 150     public abstract boolean isExceptionEntry();
 151 
 152     public abstract Loop<T> getLoop();
 153 
 154     public abstract int getLoopDepth();
 155 
 156     public abstract void delete();
 157 
 158     public abstract boolean isLoopEnd();
 159 
 160     public abstract boolean isLoopHeader();
 161 
 162     public abstract T getPostdominator();
 163 
 164     public abstract double probability();
 165 
 166     public abstract T getDominator(int distance);
 167 
 168     @Override
 169     public int hashCode() {
 170         return id;
 171     }
 172 }
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/cfg/AbstractBlockBase.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File