< prev index next >
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/alloc/ComputeBlockOrder.java
Print this page
rev 52509 : [mq]: graal
*** 141,155 ****
// We are at a merge. Check probabilities of predecessors that are not yet
// scheduled.
double unscheduledSum = 0.0;
for (T pred : mostLikelySuccessor.getPredecessors()) {
if (pred.getLinearScanNumber() == -1) {
! unscheduledSum += pred.probability();
}
}
! if (unscheduledSum > block.probability() / PENALTY_VERSUS_UNSCHEDULED) {
// Add this merge only after at least one additional predecessor gets scheduled.
visitedBlocks.clear(mostLikelySuccessor.getId());
return null;
}
}
--- 141,155 ----
// We are at a merge. Check probabilities of predecessors that are not yet
// scheduled.
double unscheduledSum = 0.0;
for (T pred : mostLikelySuccessor.getPredecessors()) {
if (pred.getLinearScanNumber() == -1) {
! unscheduledSum += pred.getRelativeFrequency();
}
}
! if (unscheduledSum > block.getRelativeFrequency() / PENALTY_VERSUS_UNSCHEDULED) {
// Add this merge only after at least one additional predecessor gets scheduled.
visitedBlocks.clear(mostLikelySuccessor.getId());
return null;
}
}
*** 210,221 ****
* Find the highest likely unvisited successor block of a given block.
*/
private static <T extends AbstractBlockBase<T>> T findAndMarkMostLikelySuccessor(T block, BitSet visitedBlocks) {
T result = null;
for (T successor : block.getSuccessors()) {
! assert successor.probability() >= 0.0 : "Probabilities must be positive";
! if (!visitedBlocks.get(successor.getId()) && successor.getLoopDepth() >= block.getLoopDepth() && (result == null || successor.probability() >= result.probability())) {
result = successor;
}
}
if (result != null) {
visitedBlocks.set(result.getId());
--- 210,221 ----
* Find the highest likely unvisited successor block of a given block.
*/
private static <T extends AbstractBlockBase<T>> T findAndMarkMostLikelySuccessor(T block, BitSet visitedBlocks) {
T result = null;
for (T successor : block.getSuccessors()) {
! assert successor.getRelativeFrequency() >= 0.0 : "Relative frequencies must be positive";
! if (!visitedBlocks.get(successor.getId()) && successor.getLoopDepth() >= block.getLoopDepth() && (result == null || successor.getRelativeFrequency() >= result.getRelativeFrequency())) {
result = successor;
}
}
if (result != null) {
visitedBlocks.set(result.getId());
*** 259,277 ****
@Override
public int compare(T a, T b) {
// Loop blocks before any loop exit block. The only exception are blocks that are
// (almost) impossible to reach.
! if (a.probability() > EPSILON && b.probability() > EPSILON) {
int diff = b.getLoopDepth() - a.getLoopDepth();
if (diff != 0) {
return diff;
}
}
// Blocks with high probability before blocks with low probability.
! if (a.probability() > b.probability()) {
return -1;
} else {
return 1;
}
}
--- 259,277 ----
@Override
public int compare(T a, T b) {
// Loop blocks before any loop exit block. The only exception are blocks that are
// (almost) impossible to reach.
! if (a.getRelativeFrequency() > EPSILON && b.getRelativeFrequency() > EPSILON) {
int diff = b.getLoopDepth() - a.getLoopDepth();
if (diff != 0) {
return diff;
}
}
// Blocks with high probability before blocks with low probability.
! if (a.getRelativeFrequency() > b.getRelativeFrequency()) {
return -1;
} else {
return 1;
}
}
< prev index next >