mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-23 00:24:11 -08:00
Fix bug in method submit API
This commit is contained in:
parent
ce83560279
commit
804b51abf5
|
@ -216,7 +216,7 @@ public class DataFlowGraphBuilder implements InstructionReader {
|
||||||
@Override
|
@Override
|
||||||
public void exit(VariableReader valueToReturn) {
|
public void exit(VariableReader valueToReturn) {
|
||||||
if (valueToReturn != null && returnIndex >= 0) {
|
if (valueToReturn != null && returnIndex >= 0) {
|
||||||
connect(valueToReturn.getIndex(), returnIndex);
|
builder.addEdge(valueToReturn.getIndex(), returnIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,7 +253,7 @@ public class DataFlowGraphBuilder implements InstructionReader {
|
||||||
if (fieldType instanceof ValueType.Primitive) {
|
if (fieldType instanceof ValueType.Primitive) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
connect(getFieldNode(field), receiver.getIndex());
|
builder.addEdge(getFieldNode(field), receiver.getIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -261,7 +261,7 @@ public class DataFlowGraphBuilder implements InstructionReader {
|
||||||
if (fieldType instanceof ValueType.Primitive) {
|
if (fieldType instanceof ValueType.Primitive) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
connect(value.getIndex(), getFieldNode(field));
|
builder.addEdge(value.getIndex(), getFieldNode(field));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -51,6 +51,7 @@ import org.teavm.model.Program;
|
||||||
import org.teavm.model.ValueType;
|
import org.teavm.model.ValueType;
|
||||||
import org.teavm.model.util.ModelUtils;
|
import org.teavm.model.util.ModelUtils;
|
||||||
import org.teavm.model.util.ProgramUtils;
|
import org.teavm.model.util.ProgramUtils;
|
||||||
|
import org.teavm.optimization.UnreachableBasicBlockEliminator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -177,12 +178,20 @@ public class DependencyChecker implements DependencyInfo {
|
||||||
if (!method.hasModifier(ElementModifier.NATIVE)) {
|
if (!method.hasModifier(ElementModifier.NATIVE)) {
|
||||||
throw new IllegalArgumentException("Method is not native: " + methodRef);
|
throw new IllegalArgumentException("Method is not native: " + methodRef);
|
||||||
}
|
}
|
||||||
|
if (!dep.used) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
method.getModifiers().remove(ElementModifier.NATIVE);
|
method.getModifiers().remove(ElementModifier.NATIVE);
|
||||||
method.setProgram(ProgramUtils.copy(program));
|
method.setProgram(ProgramUtils.copy(program));
|
||||||
|
new UnreachableBasicBlockEliminator().optimize(method.getProgram());
|
||||||
|
|
||||||
dep.used = false;
|
dep.used = false;
|
||||||
lock(dep, false);
|
lock(dep, false);
|
||||||
scheduleMethodAnalysis(dep);
|
tasks.add(() -> {
|
||||||
|
DependencyGraphBuilder graphBuilder = new DependencyGraphBuilder(DependencyChecker.this);
|
||||||
|
graphBuilder.buildGraph(dep);
|
||||||
|
dep.used = true;
|
||||||
|
});
|
||||||
|
|
||||||
processQueue();
|
processQueue();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user