diff --git a/core/src/main/java/org/teavm/dependency/DependencyNode.java b/core/src/main/java/org/teavm/dependency/DependencyNode.java index 74125e277..18b8a535c 100644 --- a/core/src/main/java/org/teavm/dependency/DependencyNode.java +++ b/core/src/main/java/org/teavm/dependency/DependencyNode.java @@ -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 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; } diff --git a/core/src/main/java/org/teavm/dependency/PreciseDependencyAnalyzer.java b/core/src/main/java/org/teavm/dependency/PreciseDependencyAnalyzer.java index a27513aaf..fbfcf0e1e 100644 --- a/core/src/main/java/org/teavm/dependency/PreciseDependencyAnalyzer.java +++ b/core/src/main/java/org/teavm/dependency/PreciseDependencyAnalyzer.java @@ -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,11 +83,22 @@ public class PreciseDependencyAnalyzer extends DependencyAnalyzer { ValueType itemTypeFilter = parent.typeFilter instanceof ValueType.Array ? ((ValueType.Array) parent.typeFilter).getItemType() : null; - DependencyNode node = createNode(itemTypeFilter); - node.degree = parent.degree + 1; - node.method = parent.method; - if (DependencyAnalyzer.shouldTag) { - node.tag = parent.tag + "["; + DependencyNode node; + if (parent.degree > DEGREE_THRESHOLD) { + if (allArrayItemsNode == null) { + allArrayItemsNode = createNode(null); + if (DependencyAnalyzer.shouldTag) { + allArrayItemsNode.tag = ""; + } + } + node = allArrayItemsNode; + } else { + node = createNode(itemTypeFilter); + node.degree = parent.degree + 1; + node.method = parent.method; + if (DependencyAnalyzer.shouldTag) { + node.tag = parent.tag + "["; + } } return node; }