mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
dfa: don't multiply eq classes until really needed
This commit is contained in:
+10
-11
@@ -511,13 +511,12 @@ public class DfaMemoryStateImpl implements DfaMemoryState {
|
||||
@Override
|
||||
public boolean isNull(DfaValue dfaValue) {
|
||||
if (dfaValue instanceof DfaTypeValue && ((DfaTypeValue)dfaValue).isNotNull()) return false;
|
||||
|
||||
if (dfaValue instanceof DfaConstValue) return ((DfaConstValue)dfaValue).getConstant() == null;
|
||||
|
||||
if (dfaValue instanceof DfaVariableValue || dfaValue instanceof DfaConstValue) {
|
||||
DfaConstValue dfaNull = myFactory.getConstFactory().getNull();
|
||||
Integer c1Index = getOrCreateEqClassIndex(dfaValue);
|
||||
Integer c2Index = getOrCreateEqClassIndex(dfaNull);
|
||||
|
||||
return c1Index != null && c1Index.equals(c2Index);
|
||||
if (dfaValue instanceof DfaVariableValue) {
|
||||
int c1Index = getEqClassIndex(dfaValue);
|
||||
return c1Index >= 0 && c1Index == getEqClassIndex(myFactory.getConstFactory().getNull());
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -530,16 +529,16 @@ public class DfaMemoryStateImpl implements DfaMemoryState {
|
||||
}
|
||||
|
||||
DfaConstValue dfaNull = myFactory.getConstFactory().getNull();
|
||||
Integer c1Index = getOrCreateEqClassIndex(dfaVar);
|
||||
Integer c2Index = getOrCreateEqClassIndex(dfaNull);
|
||||
if (c1Index == null || c2Index == null) {
|
||||
int c1Index = getEqClassIndex(dfaVar);
|
||||
int c2Index = getEqClassIndex(dfaNull);
|
||||
if (c1Index < 0 || c2Index < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
long[] pairs = myDistinctClasses.toArray();
|
||||
for (long pair : pairs) {
|
||||
if (c1Index.equals(low(pair)) && c2Index.equals(high(pair)) ||
|
||||
c1Index.equals(high(pair)) && c2Index.equals(low(pair))) {
|
||||
if (c1Index == low(pair) && c2Index == high(pair) ||
|
||||
c1Index == high(pair) && c2Index == low(pair)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -384,4 +384,10 @@
|
||||
<description>Condition <code>i</code> is always <code>true</code> when reached</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>Test.java</file>
|
||||
<line>62</line>
|
||||
<module>testUnboxingNPE_7454908424878253728</module>
|
||||
<description>Switch label<code>case 0:</code> is unreachable</description>
|
||||
</problem>
|
||||
</problems>
|
||||
|
||||
Reference in New Issue
Block a user