mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -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
|
||||
public void exit(VariableReader valueToReturn) {
|
||||
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) {
|
||||
return;
|
||||
}
|
||||
connect(getFieldNode(field), receiver.getIndex());
|
||||
builder.addEdge(getFieldNode(field), receiver.getIndex());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -261,7 +261,7 @@ public class DataFlowGraphBuilder implements InstructionReader {
|
|||
if (fieldType instanceof ValueType.Primitive) {
|
||||
return;
|
||||
}
|
||||
connect(value.getIndex(), getFieldNode(field));
|
||||
builder.addEdge(value.getIndex(), getFieldNode(field));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -51,6 +51,7 @@ import org.teavm.model.Program;
|
|||
import org.teavm.model.ValueType;
|
||||
import org.teavm.model.util.ModelUtils;
|
||||
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)) {
|
||||
throw new IllegalArgumentException("Method is not native: " + methodRef);
|
||||
}
|
||||
if (!dep.used) {
|
||||
return;
|
||||
}
|
||||
method.getModifiers().remove(ElementModifier.NATIVE);
|
||||
method.setProgram(ProgramUtils.copy(program));
|
||||
new UnreachableBasicBlockEliminator().optimize(method.getProgram());
|
||||
|
||||
dep.used = false;
|
||||
lock(dep, false);
|
||||
scheduleMethodAnalysis(dep);
|
||||
tasks.add(() -> {
|
||||
DependencyGraphBuilder graphBuilder = new DependencyGraphBuilder(DependencyChecker.this);
|
||||
graphBuilder.buildGraph(dep);
|
||||
dep.used = true;
|
||||
});
|
||||
|
||||
processQueue();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user