Skip to content

Commit 5597913

Browse files
committed
[GR-51363] Remove ExtendedAsserts option.
PullRequest: graal/16865
2 parents 0e0c552 + 0996e1f commit 5597913

File tree

8 files changed

+43
-55
lines changed

8 files changed

+43
-55
lines changed

substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/AbstractAnalysisEngine.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ public abstract class AbstractAnalysisEngine implements BigBang {
7777
protected final AnalysisMetaAccess metaAccess;
7878
protected final AnalysisPolicy analysisPolicy;
7979

80-
protected final Boolean extendedAsserts;
8180
protected final int maxConstantObjectsPerType;
8281
protected final boolean profileConstantObjects;
8382
protected final boolean optimizeReturnedParameter;
@@ -120,7 +119,6 @@ public AbstractAnalysisEngine(OptionValues options, AnalysisUniverse universe, H
120119
this.verifyHeapTimer = timerCollection.get(TimerCollection.Registry.VERIFY_HEAP);
121120
this.analysisTimer = timerCollection.get(TimerCollection.Registry.ANALYSIS);
122121

123-
this.extendedAsserts = PointstoOptions.ExtendedAsserts.getValue(options);
124122
maxConstantObjectsPerType = PointstoOptions.MaxConstantObjectsPerType.getValue(options);
125123
profileConstantObjects = PointstoOptions.ProfileConstantObjects.getValue(options);
126124
optimizeReturnedParameter = PointstoOptions.OptimizeReturnedParameter.getValue(options);
@@ -242,11 +240,6 @@ public void printTimerStatistics(PrintWriter out) {
242240
StatisticsPrinter.printLast(out, "total_memory_bytes", analysisTimer.getTotalMemory());
243241
}
244242

245-
@Override
246-
public boolean extendedAsserts() {
247-
return extendedAsserts;
248-
}
249-
250243
public int maxConstantObjectsPerType() {
251244
return maxConstantObjectsPerType;
252245
}

substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/AnalysisPolicy.java

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@
2626

2727
import java.util.BitSet;
2828

29-
import jdk.graal.compiler.options.OptionValues;
30-
import jdk.graal.compiler.replacements.nodes.BasicArrayCopyNode;
31-
3229
import com.oracle.graal.pointsto.api.PointstoOptions;
3330
import com.oracle.graal.pointsto.flow.AbstractSpecialInvokeTypeFlow;
3431
import com.oracle.graal.pointsto.flow.AbstractStaticInvokeTypeFlow;
@@ -50,11 +47,12 @@
5047
import com.oracle.graal.pointsto.typestate.MultiTypeState;
5148
import com.oracle.graal.pointsto.typestate.SingleTypeState;
5249
import com.oracle.graal.pointsto.typestate.TypeState;
53-
import com.oracle.graal.pointsto.typestate.TypeStateUtils;
5450
import com.oracle.graal.pointsto.typestore.ArrayElementsTypeStore;
5551
import com.oracle.graal.pointsto.typestore.FieldTypeStore;
5652
import com.oracle.svm.common.meta.MultiMethod;
5753

54+
import jdk.graal.compiler.options.OptionValues;
55+
import jdk.graal.compiler.replacements.nodes.BasicArrayCopyNode;
5856
import jdk.vm.ci.code.BytecodePosition;
5957
import jdk.vm.ci.meta.JavaConstant;
6058

@@ -217,9 +215,7 @@ public abstract InvokeTypeFlow createDeoptInvokeTypeFlow(BytecodePosition invoke
217215

218216
public abstract TypeState doUnion(PointsToAnalysis bb, MultiTypeState s1, MultiTypeState s2);
219217

220-
@SuppressWarnings("static-method")
221-
public final TypeState doIntersection(PointsToAnalysis bb, SingleTypeState s1, SingleTypeState s2) {
222-
assert !bb.extendedAsserts() || TypeStateUtils.isContextInsensitiveTypeState(bb, s2) : "Current implementation limitation.";
218+
public TypeState doIntersection(PointsToAnalysis bb, SingleTypeState s1, SingleTypeState s2) {
223219
boolean resultCanBeNull = s1.canBeNull() && s2.canBeNull();
224220
if (s1.exactType().equals(s2.exactType())) {
225221
/* The inputs have the same type, the result will be s1. */
@@ -230,9 +226,7 @@ public final TypeState doIntersection(PointsToAnalysis bb, SingleTypeState s1, S
230226
}
231227
}
232228

233-
@SuppressWarnings("static-method")
234-
public final TypeState doIntersection(PointsToAnalysis bb, SingleTypeState s1, MultiTypeState s2) {
235-
assert !bb.extendedAsserts() || TypeStateUtils.isContextInsensitiveTypeState(bb, s2) : "Current implementation limitation.";
229+
public TypeState doIntersection(PointsToAnalysis bb, SingleTypeState s1, MultiTypeState s2) {
236230
boolean resultCanBeNull = s1.canBeNull() && s2.canBeNull();
237231
if (s2.containsType(s1.exactType())) {
238232
return s1.forCanBeNull(bb, resultCanBeNull);
@@ -245,9 +239,7 @@ public final TypeState doIntersection(PointsToAnalysis bb, SingleTypeState s1, M
245239

246240
public abstract TypeState doIntersection(PointsToAnalysis bb, MultiTypeState s1, MultiTypeState s2);
247241

248-
@SuppressWarnings("static-method")
249-
public final TypeState doSubtraction(PointsToAnalysis bb, SingleTypeState s1, SingleTypeState s2) {
250-
assert !bb.extendedAsserts() || TypeStateUtils.isContextInsensitiveTypeState(bb, s2) : "Current implementation limitation.";
242+
public TypeState doSubtraction(PointsToAnalysis bb, SingleTypeState s1, SingleTypeState s2) {
251243
boolean resultCanBeNull = s1.canBeNull() && !s2.canBeNull();
252244
if (s1.exactType().equals(s2.exactType())) {
253245
return TypeState.forEmpty().forCanBeNull(bb, resultCanBeNull);
@@ -256,9 +248,7 @@ public final TypeState doSubtraction(PointsToAnalysis bb, SingleTypeState s1, Si
256248
}
257249
}
258250

259-
@SuppressWarnings("static-method")
260-
public final TypeState doSubtraction(PointsToAnalysis bb, SingleTypeState s1, MultiTypeState s2) {
261-
assert !bb.extendedAsserts() || TypeStateUtils.isContextInsensitiveTypeState(bb, s2) : "Current implementation limitation.";
251+
public TypeState doSubtraction(PointsToAnalysis bb, SingleTypeState s1, MultiTypeState s2) {
262252
boolean resultCanBeNull = s1.canBeNull() && !s2.canBeNull();
263253
if (s2.containsType(s1.exactType())) {
264254
return TypeState.forEmpty().forCanBeNull(bb, resultCanBeNull);

substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/BigBang.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,6 @@ default HostedProviders getProviders(AnalysisMethod method) {
9090

9191
DebugContext getDebug();
9292

93-
boolean extendedAsserts();
94-
9593
void runAnalysis(DebugContext debug, Function<AnalysisUniverse, Boolean> duringAnalysisAction) throws InterruptedException;
9694

9795
boolean trackPrimitiveValues();

substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/api/PointstoOptions.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@
2727
import static jdk.graal.compiler.options.OptionType.Expert;
2828
import static jdk.vm.ci.common.JVMCIError.shouldNotReachHere;
2929

30+
import java.util.Locale;
31+
3032
import org.graalvm.collections.EconomicMap;
3133

3234
import jdk.graal.compiler.options.Option;
3335
import jdk.graal.compiler.options.OptionKey;
3436

35-
import java.util.Locale;
36-
3737
public class PointstoOptions {
3838

3939
@Option(help = "Track primitive values using the infrastructure of points-to analysis.")//
@@ -91,9 +91,6 @@ public class PointstoOptions {
9191
@Option(help = "Analysis: Detect methods that return one of their parameters and hardwire the parameter straight to the return.")//
9292
public static final OptionKey<Boolean> OptimizeReturnedParameter = new OptionKey<>(true);
9393

94-
@Option(help = "Enable extended asserts which slow down analysis.")//
95-
public static final OptionKey<Boolean> ExtendedAsserts = new OptionKey<>(false);
96-
9794
@Option(help = "Track the callers for methods and accessing methods for fields.")//
9895
public static final OptionKey<Boolean> TrackAccessChain = new OptionKey<>(false);
9996

substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/flow/context/bytecode/BytecodeSensitiveAnalysisPolicy.java

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
import java.util.Arrays;
3131
import java.util.BitSet;
3232

33-
import jdk.graal.compiler.options.OptionValues;
34-
3533
import com.oracle.graal.pointsto.AnalysisPolicy;
3634
import com.oracle.graal.pointsto.BigBang;
3735
import com.oracle.graal.pointsto.PointsToAnalysis;
@@ -76,6 +74,7 @@
7674
import com.oracle.graal.pointsto.util.ListUtils.UnsafeArrayListClosable;
7775
import com.oracle.svm.common.meta.MultiMethod;
7876

77+
import jdk.graal.compiler.options.OptionValues;
7978
import jdk.vm.ci.code.BytecodePosition;
8079
import jdk.vm.ci.meta.JavaConstant;
8180
import jdk.vm.ci.meta.JavaKind;
@@ -464,7 +463,7 @@ public TypeState doUnion(PointsToAnalysis bb, SingleTypeState state1, SingleType
464463
}
465464

466465
/* Due to the test above the union set cannot be equal to any of the two arrays. */
467-
assert !bb.extendedAsserts() || !Arrays.equals(resultObjects, s1.objects) && !Arrays.equals(resultObjects, s2.objects) : resultObjects;
466+
assert !Arrays.equals(resultObjects, s1.objects) && !Arrays.equals(resultObjects, s2.objects) : resultObjects;
468467

469468
/* Create the resulting exact type state. */
470469
SingleTypeState result = new ContextSensitiveSingleTypeState(bb, resultCanBeNull, s1.exactType(), resultObjects);
@@ -529,7 +528,7 @@ public TypeState doUnion(PointsToAnalysis bb, MultiTypeState state1, SingleTypeS
529528
* Due to the test above and to the fact that TypeStateUtils.union checks if one array
530529
* contains the other the union set cannot be equal to s1's objects slice.
531530
*/
532-
assert !bb.extendedAsserts() || !Arrays.equals(unionObjects, s1ObjectsSlice) : unionObjects;
531+
assert !Arrays.equals(unionObjects, s1ObjectsSlice) : unionObjects;
533532

534533
/*
535534
* Replace the s1 objects slice of the same type as s2 with the union objects and create
@@ -852,10 +851,22 @@ private TypeState doUnion2(PointsToAnalysis bb, ContextSensitiveMultiTypeState s
852851
* must only contain context insensitive objects.
853852
*/
854853

854+
@Override
855+
public TypeState doIntersection(PointsToAnalysis bb, SingleTypeState s1, SingleTypeState s2) {
856+
assert TypeStateUtils.isContextInsensitiveTypeState(bb, s2) : "Current implementation limitation.";
857+
return super.doIntersection(bb, s1, s2);
858+
}
859+
860+
@Override
861+
public TypeState doIntersection(PointsToAnalysis bb, SingleTypeState s1, MultiTypeState s2) {
862+
assert TypeStateUtils.isContextInsensitiveTypeState(bb, s2) : "Current implementation limitation.";
863+
return super.doIntersection(bb, s1, s2);
864+
}
865+
855866
@Override
856867
public TypeState doIntersection(PointsToAnalysis bb, MultiTypeState s1, SingleTypeState s2) {
857868
/* See comment above for the limitation explanation. */
858-
assert !bb.extendedAsserts() || TypeStateUtils.isContextInsensitiveTypeState(bb, s2) : "Current implementation limitation.";
869+
assert TypeStateUtils.isContextInsensitiveTypeState(bb, s2) : "Current implementation limitation.";
859870

860871
boolean resultCanBeNull = s1.canBeNull() && s2.canBeNull();
861872
if (s1.containsType(s2.exactType())) {
@@ -874,7 +885,7 @@ public TypeState doIntersection(PointsToAnalysis bb, MultiTypeState state1, Mult
874885
ContextSensitiveMultiTypeState s1 = (ContextSensitiveMultiTypeState) state1;
875886
ContextSensitiveMultiTypeState s2 = (ContextSensitiveMultiTypeState) state2;
876887

877-
assert !bb.extendedAsserts() || TypeStateUtils.isContextInsensitiveTypeState(bb, s2) : "Current implementation limitation.";
888+
assert TypeStateUtils.isContextInsensitiveTypeState(bb, s2) : "Current implementation limitation.";
878889

879890
boolean resultCanBeNull = s1.canBeNull() && s2.canBeNull();
880891

@@ -1033,8 +1044,19 @@ private static TypeState doIntersection2(PointsToAnalysis bb, ContextSensitiveMu
10331044
*/
10341045

10351046
@Override
1036-
public TypeState doSubtraction(PointsToAnalysis bb, MultiTypeState state1, SingleTypeState state2) {
1047+
public TypeState doSubtraction(PointsToAnalysis bb, SingleTypeState s1, SingleTypeState s2) {
1048+
assert TypeStateUtils.isContextInsensitiveTypeState(bb, s2) : "Current implementation limitation.";
1049+
return super.doSubtraction(bb, s1, s2);
1050+
}
1051+
1052+
@Override
1053+
public TypeState doSubtraction(PointsToAnalysis bb, SingleTypeState s1, MultiTypeState s2) {
1054+
assert TypeStateUtils.isContextInsensitiveTypeState(bb, s2) : "Current implementation limitation.";
1055+
return super.doSubtraction(bb, s1, s2);
1056+
}
10371057

1058+
@Override
1059+
public TypeState doSubtraction(PointsToAnalysis bb, MultiTypeState state1, SingleTypeState state2) {
10381060
ContextSensitiveMultiTypeState s1 = (ContextSensitiveMultiTypeState) state1;
10391061
ContextSensitiveSingleTypeState s2 = (ContextSensitiveSingleTypeState) state2;
10401062

@@ -1043,7 +1065,7 @@ public TypeState doSubtraction(PointsToAnalysis bb, MultiTypeState state1, Singl
10431065
/* s2 is contained in s1, so remove all objects of the same type from s1. */
10441066

10451067
/* See comment above for the limitation explanation. */
1046-
assert !bb.extendedAsserts() || TypeStateUtils.isContextInsensitiveTypeState(bb, s2) : "Current implementation limitation.";
1068+
assert TypeStateUtils.isContextInsensitiveTypeState(bb, s2) : "Current implementation limitation.";
10471069

10481070
/* Find the range of objects of s2.exactType() in s1. */
10491071
ContextSensitiveMultiTypeState.Range typeRange = s1.findTypeRange(s2.exactType());

substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/flow/context/bytecode/ContextSensitiveMultiTypeState.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public ContextSensitiveMultiTypeState(PointsToAnalysis bb, boolean canBeNull, Bi
4747
super(bb, canBeNull, typesBitSet, typesCount);
4848
this.objects = objects;
4949
assert objects.length > 1 : "Multi type state with single object.";
50-
assert checkObjects(bb);
50+
assert checkObjects();
5151
}
5252

5353
/** Create a type state with the same content and a reversed canBeNull value. */
@@ -79,11 +79,7 @@ public int[] getObjectTypeIds() {
7979
return objectTypeIds;
8080
}
8181

82-
private boolean checkObjects(PointsToAnalysis bb) {
83-
if (!bb.extendedAsserts()) {
84-
return true;
85-
}
86-
82+
private boolean checkObjects() {
8783
for (int idx = 0; idx < objects.length - 1; idx++) {
8884
AnalysisObject o0 = objects[idx];
8985
AnalysisObject o1 = objects[idx + 1];

substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/flow/context/bytecode/ContextSensitiveSingleTypeState.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public class ContextSensitiveSingleTypeState extends SingleTypeState {
4545
public ContextSensitiveSingleTypeState(PointsToAnalysis bb, boolean canBeNull, AnalysisType type, AnalysisObject... objects) {
4646
super(bb, canBeNull, type);
4747
this.objects = objects;
48-
assert checkObjects(bb);
48+
assert checkObjects();
4949
}
5050

5151
/** Create a type state with the same content and a reversed canBeNull value. */
@@ -54,11 +54,7 @@ protected ContextSensitiveSingleTypeState(PointsToAnalysis bb, boolean canBeNull
5454
this.objects = other.objects;
5555
}
5656

57-
protected boolean checkObjects(BigBang bb) {
58-
if (!bb.extendedAsserts()) {
59-
return true;
60-
}
61-
57+
protected boolean checkObjects() {
6258
/* Check that the objects array are sorted by type. */
6359
for (int idx = 0; idx < objects.length - 1; idx++) {
6460
AnalysisObject o0 = objects[idx];

substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/typestate/DefaultAnalysisPolicy.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
import java.util.BitSet;
2828
import java.util.Objects;
2929

30-
import jdk.graal.compiler.options.OptionValues;
31-
3230
import com.oracle.graal.pointsto.AnalysisPolicy;
3331
import com.oracle.graal.pointsto.PointsToAnalysis;
3432
import com.oracle.graal.pointsto.flow.AbstractSpecialInvokeTypeFlow;
@@ -57,6 +55,7 @@
5755
import com.oracle.graal.pointsto.util.AnalysisError;
5856
import com.oracle.svm.common.meta.MultiMethod;
5957

58+
import jdk.graal.compiler.options.OptionValues;
6059
import jdk.vm.ci.code.BytecodePosition;
6160
import jdk.vm.ci.meta.JavaConstant;
6261

@@ -376,8 +375,6 @@ public TypeState doUnion(PointsToAnalysis bb, MultiTypeState s1, MultiTypeState
376375

377376
@Override
378377
public TypeState doIntersection(PointsToAnalysis bb, MultiTypeState s1, SingleTypeState s2) {
379-
assert !bb.extendedAsserts() || TypeStateUtils.isContextInsensitiveTypeState(bb, s2) : "Current implementation limitation.";
380-
381378
boolean resultCanBeNull = s1.canBeNull() && s2.canBeNull();
382379
if (s1.containsType(s2.exactType())) {
383380
/* s1 contains s2's type, return s2. */
@@ -427,7 +424,6 @@ public TypeState doIntersection(PointsToAnalysis bb, MultiTypeState s1, MultiTyp
427424

428425
@Override
429426
public TypeState doSubtraction(PointsToAnalysis bb, MultiTypeState s1, SingleTypeState s2) {
430-
assert !bb.extendedAsserts() || TypeStateUtils.isContextInsensitiveTypeState(bb, s2) : "Current implementation limitation.";
431427
boolean resultCanBeNull = s1.canBeNull() && !s2.canBeNull();
432428
if (s1.containsType(s2.exactType())) {
433429
/* s2 is contained in s1, so remove s2's type from s1. */

0 commit comments

Comments
 (0)