Skip to content

Commit 5c704c9

Browse files
committed
[GR-67854] Limit search distances and use an int[] for ranges
PullRequest: graal/21410
2 parents a1ce776 + 641ecfb commit 5c704c9

File tree

17 files changed

+802
-452
lines changed

17 files changed

+802
-452
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/graph/Graph.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,20 @@ public class Graph implements EventCounter {
6363

6464
public static class Options {
6565
@Option(help = "Verify graphs often during compilation when assertions are turned on", type = OptionType.Debug)//
66-
public static final OptionKey<Boolean> VerifyGraalGraphs = new OptionKey<>(true);
66+
public static final OptionKey<Boolean> VerifyGraalGraphs = new OptionKey<>(true) {
67+
@Override
68+
public Boolean getValueOrDefault(UnmodifiableEconomicMap<OptionKey<?>, Object> values) {
69+
if (!Assertions.assertionsEnabled()) {
70+
return false;
71+
}
72+
return super.getValueOrDefault(values);
73+
}
74+
75+
@Override
76+
public Boolean getValue(OptionValues values) {
77+
return getValueOrDefault(values.getMap());
78+
}
79+
};
6780
@Option(help = "Perform expensive verification of graph inputs, usages, successors and predecessors", type = OptionType.Debug)//
6881
public static final OptionKey<Boolean> VerifyGraalGraphEdges = new OptionKey<>(false);
6982
@Option(help = "Graal graph compression is performed when percent of live nodes falls below this value", type = OptionType.Debug)//

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/HotSpotReferenceMapBuilder.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,21 @@
2424
*/
2525
package jdk.graal.compiler.hotspot;
2626

27+
import static jdk.graal.compiler.lir.LIRValueUtil.isJavaConstant;
2728
import static jdk.vm.ci.code.ValueUtil.asRegister;
2829
import static jdk.vm.ci.code.ValueUtil.asStackSlot;
2930
import static jdk.vm.ci.code.ValueUtil.isRegister;
30-
import static jdk.graal.compiler.lir.LIRValueUtil.isJavaConstant;
3131

3232
import java.util.ArrayList;
3333

3434
import jdk.graal.compiler.core.common.LIRKind;
3535
import jdk.graal.compiler.core.common.PermanentBailoutException;
36+
import jdk.graal.compiler.debug.Assertions;
3637
import jdk.graal.compiler.debug.GraalError;
3738
import jdk.graal.compiler.lir.LIRFrameState;
3839
import jdk.graal.compiler.lir.LIRValueUtil;
3940
import jdk.graal.compiler.lir.Variable;
4041
import jdk.graal.compiler.lir.framemap.ReferenceMapBuilder;
41-
import jdk.graal.compiler.debug.Assertions;
42-
4342
import jdk.vm.ci.code.Location;
4443
import jdk.vm.ci.code.ReferenceMap;
4544
import jdk.vm.ci.code.StackSlot;
@@ -115,6 +114,7 @@ public ReferenceMap finish(LIRFrameState state) {
115114
Location base = null;
116115
if (kind.isDerivedReference()) {
117116
Variable baseVariable = LIRValueUtil.asVariable(kind.getDerivedReferenceBase());
117+
GraalError.guarantee(state.getLiveBasePointers() != null, "no live base pointers for derived reference %s", baseVariable);
118118
Value baseValue = state.getLiveBasePointers().get(baseVariable.index);
119119
assert baseValue.getPlatformKind().getVectorLength() == 1 &&
120120
((LIRKind) baseValue.getValueKind()).isReference(0) &&

0 commit comments

Comments
 (0)