mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2025-01-08 16:04:10 -08:00
Fix bug in dependency analyzer
This commit is contained in:
parent
ac2bd7599b
commit
8a55510d4f
|
@ -75,7 +75,7 @@ public class DependencyAnalyzer implements DependencyInfo {
|
|||
private CachedMapper<String, ClassDependency> classCache;
|
||||
private List<DependencyListener> listeners = new ArrayList<>();
|
||||
private ServiceRepository services;
|
||||
private Deque<DependencyNodeToNodeTransition> pendingTransitions = new ArrayDeque<>();
|
||||
private Deque<Transition> pendingTransitions = new ArrayDeque<>();
|
||||
private Deque<Runnable> tasks = new ArrayDeque<>();
|
||||
private Queue<Runnable> deferredTasks = new ArrayDeque<>();
|
||||
List<DependencyType> types = new ArrayList<>();
|
||||
|
@ -275,7 +275,7 @@ public class DependencyAnalyzer implements DependencyInfo {
|
|||
}
|
||||
}
|
||||
|
||||
void schedulePropagation(DependencyNodeToNodeTransition consumer, DependencyType type) {
|
||||
void schedulePropagation(Transition consumer, DependencyType type) {
|
||||
if (!consumer.destination.filter(type)) {
|
||||
return;
|
||||
}
|
||||
|
@ -294,7 +294,7 @@ public class DependencyAnalyzer implements DependencyInfo {
|
|||
}
|
||||
}
|
||||
|
||||
void schedulePropagation(DependencyNodeToNodeTransition consumer, DependencyType[] types) {
|
||||
void schedulePropagation(Transition consumer, DependencyType[] types) {
|
||||
if (types.length == 0) {
|
||||
return;
|
||||
}
|
||||
|
@ -630,7 +630,7 @@ public class DependencyAnalyzer implements DependencyInfo {
|
|||
|
||||
private void processNodeToNodeTransitionQueue() {
|
||||
while (!pendingTransitions.isEmpty()) {
|
||||
DependencyNodeToNodeTransition transition = pendingTransitions.remove();
|
||||
Transition transition = pendingTransitions.remove();
|
||||
IntSet pendingTypes = transition.pendingTypes;
|
||||
transition.pendingTypes = null;
|
||||
if (pendingTypes.size() == 1) {
|
||||
|
|
|
@ -36,8 +36,8 @@ public class DependencyNode implements ValueDependencyInfo {
|
|||
DependencyAnalyzer dependencyAnalyzer;
|
||||
List<DependencyConsumer> followers;
|
||||
TypeSet typeSet;
|
||||
ObjectObjectHashMap<DependencyNode, DependencyNodeToNodeTransition> transitions;
|
||||
ObjectArrayList<DependencyNodeToNodeTransition> transitionList;
|
||||
ObjectObjectHashMap<DependencyNode, Transition> transitions;
|
||||
ObjectArrayList<Transition> transitionList;
|
||||
String tag;
|
||||
private DependencyNode arrayItemNode;
|
||||
private DependencyNode classValueNode;
|
||||
|
@ -78,15 +78,15 @@ public class DependencyNode implements ValueDependencyInfo {
|
|||
}
|
||||
}
|
||||
|
||||
ObjectArrayList<DependencyNodeToNodeTransition> transitions = new ObjectArrayList<>(typeSet.getTransitions());
|
||||
ObjectArrayList<Transition> transitions = new ObjectArrayList<>(typeSet.getTransitions());
|
||||
List<ConsumerWithNode> consumerEntries = typeSet.getConsumers();
|
||||
|
||||
if (action != null) {
|
||||
action.run();
|
||||
}
|
||||
|
||||
for (ObjectCursor<DependencyNodeToNodeTransition> cursor : transitions) {
|
||||
DependencyNodeToNodeTransition transition = cursor.value;
|
||||
for (ObjectCursor<Transition> cursor : transitions) {
|
||||
Transition transition = cursor.value;
|
||||
if (transition.source.filter(type) && transition.filterType(type)) {
|
||||
dependencyAnalyzer.schedulePropagation(transition, type);
|
||||
}
|
||||
|
@ -156,15 +156,15 @@ public class DependencyNode implements ValueDependencyInfo {
|
|||
}
|
||||
}
|
||||
|
||||
ObjectArrayList<DependencyNodeToNodeTransition> transitions = new ObjectArrayList<>(typeSet.getTransitions());
|
||||
ObjectArrayList<Transition> transitions = new ObjectArrayList<>(typeSet.getTransitions());
|
||||
List<ConsumerWithNode> consumerEntries = typeSet.getConsumers();
|
||||
|
||||
if (action != null) {
|
||||
action.run();
|
||||
}
|
||||
|
||||
for (ObjectCursor<DependencyNodeToNodeTransition> cursor : transitions) {
|
||||
DependencyNodeToNodeTransition transition = cursor.value;
|
||||
for (ObjectCursor<Transition> cursor : transitions) {
|
||||
Transition transition = cursor.value;
|
||||
DependencyType[] typesToPropagate = newTypes;
|
||||
if (transition.source.typeFilter != null || transition.filter != null) {
|
||||
int j = 0;
|
||||
|
@ -276,7 +276,7 @@ public class DependencyNode implements ValueDependencyInfo {
|
|||
return;
|
||||
}
|
||||
|
||||
DependencyNodeToNodeTransition transition = new DependencyNodeToNodeTransition(this, node, filter);
|
||||
Transition transition = new Transition(this, node, filter);
|
||||
transitions.put(node, transition);
|
||||
transitionList.add(transition);
|
||||
if (DependencyAnalyzer.shouldLog) {
|
||||
|
@ -358,8 +358,7 @@ public class DependencyNode implements ValueDependencyInfo {
|
|||
return;
|
||||
}
|
||||
|
||||
for (DependencyNodeToNodeTransition transition : classNodeParent.transitionList
|
||||
.toArray(DependencyNodeToNodeTransition.class)) {
|
||||
for (Transition transition : classNodeParent.transitionList.toArray(Transition.class)) {
|
||||
connect(transition.destination.getClassValueNode());
|
||||
}
|
||||
}
|
||||
|
@ -370,7 +369,7 @@ public class DependencyNode implements ValueDependencyInfo {
|
|||
}
|
||||
}
|
||||
|
||||
private void propagateTypes(DependencyNodeToNodeTransition transition) {
|
||||
private void propagateTypes(Transition transition) {
|
||||
if (typeSet != null) {
|
||||
dependencyAnalyzer.schedulePropagation(transition, getTypesInternal());
|
||||
}
|
||||
|
@ -522,8 +521,8 @@ public class DependencyNode implements ValueDependencyInfo {
|
|||
}
|
||||
|
||||
if (node.transitions != null) {
|
||||
for (ObjectCursor<DependencyNodeToNodeTransition> cursor : node.transitionList) {
|
||||
DependencyNodeToNodeTransition transition = cursor.value;
|
||||
for (ObjectCursor<Transition> cursor : node.transitionList) {
|
||||
Transition transition = cursor.value;
|
||||
if (transition.filter == null && transition.destination.typeSet == typeSet
|
||||
&& !visited.contains(transition.destination) && transition.isDestSubsetOfSrc()) {
|
||||
stack.push(transition.destination);
|
||||
|
|
|
@ -22,7 +22,7 @@ import java.util.Collection;
|
|||
import org.teavm.model.ClassReaderSource;
|
||||
import org.teavm.model.ValueType;
|
||||
|
||||
class DependencyNodeToNodeTransition {
|
||||
class Transition {
|
||||
DependencyNode source;
|
||||
DependencyNode destination;
|
||||
DependencyTypeFilter filter;
|
||||
|
@ -30,7 +30,7 @@ class DependencyNodeToNodeTransition {
|
|||
IntHashSet pendingTypes;
|
||||
byte destSubsetOfSrc;
|
||||
|
||||
DependencyNodeToNodeTransition(DependencyNode source, DependencyNode destination, DependencyTypeFilter filter) {
|
||||
Transition(DependencyNode source, DependencyNode destination, DependencyTypeFilter filter) {
|
||||
this.source = source;
|
||||
this.destination = destination;
|
||||
this.filter = filter;
|
||||
|
@ -79,7 +79,7 @@ class DependencyNodeToNodeTransition {
|
|||
}
|
||||
|
||||
boolean shouldMergeDomains() {
|
||||
if (filter != null) {
|
||||
if (filter != null || !isDestSubsetOfSrc()) {
|
||||
return false;
|
||||
}
|
||||
if (destination.typeSet == null) {
|
|
@ -34,7 +34,7 @@ class TypeSet {
|
|||
private int typesCount;
|
||||
|
||||
Set<DependencyNode> domain = new LinkedHashSet<>();
|
||||
ObjectArrayList<DependencyNodeToNodeTransition> transitions;
|
||||
ObjectArrayList<Transition> transitions;
|
||||
ArrayList<ConsumerWithNode> consumers;
|
||||
|
||||
TypeSet(DependencyAnalyzer dependencyAnalyzer, DependencyNode origin) {
|
||||
|
@ -154,13 +154,13 @@ class TypeSet {
|
|||
consumers = null;
|
||||
}
|
||||
|
||||
ObjectArrayList<DependencyNodeToNodeTransition> getTransitions() {
|
||||
ObjectArrayList<Transition> getTransitions() {
|
||||
if (transitions == null) {
|
||||
transitions = new ObjectArrayList<>(domain.size() * 2);
|
||||
for (DependencyNode node : domain) {
|
||||
if (node.transitions != null) {
|
||||
for (ObjectCursor<DependencyNodeToNodeTransition> cursor : node.transitionList) {
|
||||
DependencyNodeToNodeTransition transition = cursor.value;
|
||||
for (ObjectCursor<Transition> cursor : node.transitionList) {
|
||||
Transition transition = cursor.value;
|
||||
if (transition.filter != null || transition.destination.typeSet != this) {
|
||||
transitions.add(transition);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user