Skip to content

Commit 641ecfb

Browse files
committed
Adjust some defaults based on statistics about ranges and use pos lists
1 parent 3c0b54f commit 641ecfb

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/core/common/util/IntList.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,11 @@ public final class IntList {
4444
* @param initialCapacity
4545
*/
4646
public IntList(int initialCapacity) {
47-
array = new int[initialCapacity];
47+
if (initialCapacity == 0) {
48+
array = EMPTY_INT_ARRAY;
49+
} else {
50+
array = new int[initialCapacity];
51+
}
4852
}
4953

5054
/**

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/lir/alloc/lsra/Interval.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -650,8 +650,6 @@ void removeFirstUsePos() {
650650
usePosList.removeLowestUsePos();
651651
}
652652

653-
private static final int[] EMPTY_INT_ARRAY = new int[0];
654-
655653
/**
656654
* The length of the valid portion of {@link #rangePairs}.
657655
*/
@@ -1082,8 +1080,11 @@ int currentIntersectsAtLimit(Interval other, int limit) {
10821080
assert isIllegal(operand) || LIRValueUtil.isVariable(operand);
10831081
}
10841082
this.kind = LIRKind.Illegal;
1085-
this.rangePairs = EMPTY_INT_ARRAY;
1086-
this.usePosList = new UsePosList(4);
1083+
// intervals only exist to contain ranges and 30% of ranges only contain a single element so
1084+
// start with enough space for a single range.
1085+
this.rangePairs = new int[2];
1086+
// 50% of intervals have empty UsePosLists.
1087+
this.usePosList = new UsePosList(0);
10871088
this.next = intervalEndMarker;
10881089
this.spillState = SpillState.NoDefinitionFound;
10891090
this.spillDefinitionPos = -1;

0 commit comments

Comments
 (0)