# HG changeset patch # User Josef Eisl # Date 1405359121 -7200 # Node ID 45f92700119f53856fe24d5d11b007e81440d9e8 # Parent b07f96c783ad5d8da9f89bfdcdf6e2ad31f0a309 Move AbstractBlock.{dominates, isDominatedBy} to AbstractControlFlowGraph. diff -r b07f96c783ad -r 45f92700119f graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/cfg/AbstractBlock.java --- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/cfg/AbstractBlock.java Mon Jul 14 19:27:35 2014 +0200 +++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/cfg/AbstractBlock.java Mon Jul 14 19:32:01 2014 +0200 @@ -64,26 +64,4 @@ double probability(); - /** - * True if block {@code a} dominates block {@code b}. - */ - static boolean dominates(AbstractBlock a, AbstractBlock b) { - assert a != null; - return isDominatedBy(b, a); - } - - /** - * True if block {@code a} is dominated by block {@code b}. - */ - static boolean isDominatedBy(AbstractBlock a, AbstractBlock b) { - assert a != null; - if (a == b) { - return true; - } - if (a.getDominator() == null) { - return false; - } - return isDominatedBy(a.getDominator(), b); - } - } diff -r b07f96c783ad -r 45f92700119f graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/cfg/AbstractControlFlowGraph.java --- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/cfg/AbstractControlFlowGraph.java Mon Jul 14 19:27:35 2014 +0200 +++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/cfg/AbstractControlFlowGraph.java Mon Jul 14 19:32:01 2014 +0200 @@ -44,6 +44,28 @@ T getStartBlock(); /** + * True if block {@code a} is dominated by block {@code b}. + */ + static boolean isDominatedBy(AbstractBlock a, AbstractBlock b) { + assert a != null; + if (a == b) { + return true; + } + if (a.getDominator() == null) { + return false; + } + return isDominatedBy(a.getDominator(), b); + } + + /** + * True if block {@code a} dominates block {@code b}. + */ + static boolean dominates(AbstractBlock a, AbstractBlock b) { + assert a != null; + return isDominatedBy(b, a); + } + + /** * Calculates the common dominator of two blocks. * * Note that this algorithm makes use of special properties regarding the numbering of blocks. diff -r b07f96c783ad -r 45f92700119f graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java Mon Jul 14 19:27:35 2014 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java Mon Jul 14 19:32:01 2014 +0200 @@ -25,7 +25,7 @@ import static com.oracle.graal.api.code.CodeUtil.*; import static com.oracle.graal.api.code.ValueUtil.*; import static com.oracle.graal.compiler.GraalDebugConfig.*; -import static com.oracle.graal.compiler.common.cfg.AbstractBlock.*; +import static com.oracle.graal.compiler.common.cfg.AbstractControlFlowGraph.*; import static com.oracle.graal.lir.LIRValueUtil.*; import java.util.*; @@ -1720,7 +1720,7 @@ } else { AbstractBlock spillBlock = blockForId(spillPos); if (interval.alwaysInMemory() && !interval.location().equals(interval.spillSlot())) { - if ((spillBlock.equals(block) && op.id() > spillPos) || AbstractBlock.dominates(spillBlock, block)) { + if ((spillBlock.equals(block) && op.id() > spillPos) || dominates(spillBlock, block)) { assert spillPos > 0 : "position not set correctly"; assert interval.spillSlot() != null : "no spill slot assigned"; assert !isRegister(interval.operand) : "interval is on stack : so stack slot is registered twice"; diff -r b07f96c783ad -r 45f92700119f graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java Mon Jul 14 19:27:35 2014 +0200 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java Mon Jul 14 19:32:01 2014 +0200 @@ -24,7 +24,6 @@ import static com.oracle.graal.api.meta.LocationIdentity.*; import static com.oracle.graal.compiler.common.GraalOptions.*; -import static com.oracle.graal.compiler.common.cfg.AbstractBlock.*; import static com.oracle.graal.compiler.common.cfg.AbstractControlFlowGraph.*; import java.util.*;