mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
Fixes infinite loop in dependency checker in some cases
This commit is contained in:
parent
a353a05e23
commit
7831ade3a6
|
@ -56,6 +56,13 @@ class TAbstractStringBuilder extends TObject implements TSerializable, TCharSequ
|
|||
buffer = new char[capacity];
|
||||
}
|
||||
|
||||
public TAbstractStringBuilder(TString value) {
|
||||
buffer = new char[value.length()];
|
||||
for (int i = 0; i < buffer.length; ++i) {
|
||||
buffer[i] = value.charAt(i);
|
||||
}
|
||||
}
|
||||
|
||||
protected TAbstractStringBuilder append(TString string) {
|
||||
if (string == null) {
|
||||
string = TString.wrap("null");
|
||||
|
|
|
@ -28,6 +28,10 @@ public class TStringBuilder extends TAbstractStringBuilder implements TAppendabl
|
|||
super();
|
||||
}
|
||||
|
||||
public TStringBuilder(TString value) {
|
||||
super(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TStringBuilder append(TString string) {
|
||||
super.append(string);
|
||||
|
|
|
@ -33,12 +33,21 @@ public class DependencyNode implements ValueDependencyInfo {
|
|||
private volatile String tag;
|
||||
private final AtomicReference<DependencyNode> arrayItemNode = new AtomicReference<>();
|
||||
private volatile CountDownLatch arrayItemNodeLatch = new CountDownLatch(1);
|
||||
private int degree;
|
||||
|
||||
DependencyNode(DependencyChecker dependencyChecker) {
|
||||
this(dependencyChecker, 0);
|
||||
}
|
||||
|
||||
DependencyNode(DependencyChecker dependencyChecker, int degree) {
|
||||
this.dependencyChecker = dependencyChecker;
|
||||
this.degree = degree;
|
||||
}
|
||||
|
||||
public void propagate(String type) {
|
||||
if (degree > 2) {
|
||||
return;
|
||||
}
|
||||
if (types.putIfAbsent(type, mapValue) == null) {
|
||||
if (DependencyChecker.shouldLog) {
|
||||
System.out.println(tag + " -> " + type);
|
||||
|
@ -75,7 +84,7 @@ public class DependencyNode implements ValueDependencyInfo {
|
|||
public DependencyNode getArrayItem() {
|
||||
DependencyNode result = arrayItemNode.get();
|
||||
if (result == null) {
|
||||
result = new DependencyNode(dependencyChecker);
|
||||
result = new DependencyNode(dependencyChecker, degree + 1);
|
||||
if (arrayItemNode.compareAndSet(null, result)) {
|
||||
if (DependencyChecker.shouldLog) {
|
||||
arrayItemNode.get().tag = tag + "[";
|
||||
|
|
Loading…
Reference in New Issue
Block a user