mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
Fix support for multi-dimensional arrays of degree 3 and more in dependency analyzer
This commit is contained in:
parent
18d63863c9
commit
24d672e820
|
@ -32,7 +32,6 @@ import org.teavm.model.MethodReference;
|
|||
import org.teavm.model.ValueType;
|
||||
|
||||
public class DependencyNode implements ValueDependencyInfo {
|
||||
private static final int DEGREE_THRESHOLD = 2;
|
||||
DependencyAnalyzer dependencyAnalyzer;
|
||||
List<DependencyConsumer> followers;
|
||||
TypeSet typeSet;
|
||||
|
@ -58,9 +57,6 @@ public class DependencyNode implements ValueDependencyInfo {
|
|||
}
|
||||
|
||||
public void propagate(DependencyType type) {
|
||||
if (degree > DEGREE_THRESHOLD) {
|
||||
return;
|
||||
}
|
||||
if (!hasType(type) && filter(type)) {
|
||||
propagateCount++;
|
||||
moveToSeparateDomain();
|
||||
|
@ -96,10 +92,6 @@ public class DependencyNode implements ValueDependencyInfo {
|
|||
}
|
||||
|
||||
public void propagate(DependencyType[] newTypes) {
|
||||
if (degree > DEGREE_THRESHOLD) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (newTypes.length == 0) {
|
||||
return;
|
||||
}
|
||||
|
@ -314,9 +306,6 @@ public class DependencyNode implements ValueDependencyInfo {
|
|||
}
|
||||
|
||||
private void connectArrayItemNodes(DependencyNode node) {
|
||||
if (degree > DEGREE_THRESHOLD || node.degree > DEGREE_THRESHOLD) {
|
||||
return;
|
||||
}
|
||||
if (!isArray(typeFilter) || !isArray(node.typeFilter)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,9 @@ import org.teavm.model.ReferenceCache;
|
|||
import org.teavm.model.ValueType;
|
||||
|
||||
public class PreciseDependencyAnalyzer extends DependencyAnalyzer {
|
||||
private DependencyNode allArrayItemsNode;
|
||||
private static final int DEGREE_THRESHOLD = 2;
|
||||
|
||||
public PreciseDependencyAnalyzer(ClassReaderSource classSource, ClassLoader classLoader,
|
||||
ServiceRepository services, Diagnostics diagnostics, ReferenceCache referenceCache,
|
||||
String[] platformTags) {
|
||||
|
@ -80,12 +83,23 @@ public class PreciseDependencyAnalyzer extends DependencyAnalyzer {
|
|||
ValueType itemTypeFilter = parent.typeFilter instanceof ValueType.Array
|
||||
? ((ValueType.Array) parent.typeFilter).getItemType()
|
||||
: null;
|
||||
DependencyNode node = createNode(itemTypeFilter);
|
||||
DependencyNode node;
|
||||
if (parent.degree > DEGREE_THRESHOLD) {
|
||||
if (allArrayItemsNode == null) {
|
||||
allArrayItemsNode = createNode(null);
|
||||
if (DependencyAnalyzer.shouldTag) {
|
||||
allArrayItemsNode.tag = "<any array item>";
|
||||
}
|
||||
}
|
||||
node = allArrayItemsNode;
|
||||
} else {
|
||||
node = createNode(itemTypeFilter);
|
||||
node.degree = parent.degree + 1;
|
||||
node.method = parent.method;
|
||||
if (DependencyAnalyzer.shouldTag) {
|
||||
node.tag = parent.tag + "[";
|
||||
}
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user