mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-23 00:24:11 -08:00
Fixes bug in GVN
This commit is contained in:
parent
520008913e
commit
9fe66c4f2e
|
@ -37,6 +37,9 @@ public class PreOptimizingClassHolderSource implements ClassHolderSource {
|
||||||
ClassHolder cls = cache.get(name);
|
ClassHolder cls = cache.get(name);
|
||||||
if (cls == null) {
|
if (cls == null) {
|
||||||
cls = innerClassSource.get(name);
|
cls = innerClassSource.get(name);
|
||||||
|
if (cls == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
for (MethodHolder method : cls.getMethods()) {
|
for (MethodHolder method : cls.getMethods()) {
|
||||||
new GlobalValueNumbering().optimize(method, method.getProgram());
|
new GlobalValueNumbering().optimize(method, method.getProgram());
|
||||||
new UnusedVariableElimination().optimize(method, method.getProgram());
|
new UnusedVariableElimination().optimize(method, method.getProgram());
|
||||||
|
|
|
@ -296,7 +296,7 @@ public class InstructionStringifier implements InstructionReader {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void cloneArray(VariableReader receiver, VariableReader array) {
|
public void cloneArray(VariableReader receiver, VariableReader array) {
|
||||||
sb.append("@").append(receiver.getIndex()).append("@").append(array.getIndex()).append(".clone()");
|
sb.append("@").append(receiver.getIndex()).append(" := @").append(array.getIndex()).append(".clone()");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -360,6 +360,8 @@ public class GlobalValueNumbering implements MethodOptimization {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void visit(CloneArrayInstruction insn) {
|
public void visit(CloneArrayInstruction insn) {
|
||||||
|
int a = map[insn.getArray().getIndex()];
|
||||||
|
insn.setArray(program.variableAt(a));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue
Block a user