Fix more bugs in devirtualization

This commit is contained in:
Alexey Andreev 2020-01-24 16:23:28 +03:00
parent 2d2ef642a3
commit 7a2cd6ae4f

View File

@ -262,6 +262,7 @@ public class ClassInference {
for (int predecessor : assignmentGraph.incomingEdges(variable)) { for (int predecessor : assignmentGraph.incomingEdges(variable)) {
int predecessorEntry = packNodeAndDegree(predecessor, degree); int predecessorEntry = packNodeAndDegree(predecessor, degree);
graphBuilder.addEdge(predecessorEntry, entry); graphBuilder.addEdge(predecessorEntry, entry);
graphBuilder.addEdge(entry, predecessorEntry);
if (!visited[predecessorEntry]) { if (!visited[predecessorEntry]) {
stack.push(predecessorEntry); stack.push(predecessorEntry);
} }
@ -270,12 +271,34 @@ public class ClassInference {
for (int successor : itemGraph.outgoingEdges(variable)) { for (int successor : itemGraph.outgoingEdges(variable)) {
nextEntries.add(packNodeAndDegree(successor, degree - 1)); nextEntries.add(packNodeAndDegree(successor, degree - 1));
} }
for (int predecessor : arrayGraph.incomingEdges(variable)) {
int predecessorEntry = packNodeAndDegree(predecessor, degree - 1);
graphBuilder.addEdge(predecessorEntry, entry);
if (!visited[predecessorEntry]) {
stack.push(predecessorEntry);
}
} }
for (int successor : assignmentGraph.outgoingEdges(variable)) {
graphBuilder.addEdge(packNodeAndDegree(successor, degree), entry);
}
}
if (degree <= MAX_DEGREE) {
for (int successor : arrayGraph.outgoingEdges(variable)) { for (int successor : arrayGraph.outgoingEdges(variable)) {
nextEntries.add(packNodeAndDegree(successor, degree + 1)); nextEntries.add(packNodeAndDegree(successor, degree + 1));
} }
for (int predecessor : itemGraph.incomingEdges(variable)) {
int predecessorEntry = packNodeAndDegree(predecessor, degree + 1);
graphBuilder.addEdge(predecessorEntry, entry);
if (!visited[predecessorEntry]) {
stack.push(predecessorEntry);
}
}
}
// //
// End: calculating successor nodes in resulting graph // End: calculating successor nodes in resulting graph
@ -321,7 +344,7 @@ public class ClassInference {
int node = nodeMapping[i]; int node = nodeMapping[i];
if (overflowTypesBackup[i]) { if (overflowTypesBackup[i]) {
overflowTypes[i] = true; overflowTypes[node] = true;
types[node] = null; types[node] = null;
} else if (typesBackup[i] != null && !overflowTypes[i]) { } else if (typesBackup[i] != null && !overflowTypes[i]) {
IntHashSet nodeTypes = getNodeTypes(node); IntHashSet nodeTypes = getNodeTypes(node);