mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2025-01-09 08:24:10 -08:00
Fix error in transforming classes if missing items found
This commit is contained in:
parent
7d2e323af0
commit
67677494b3
|
@ -21,6 +21,7 @@ import org.teavm.dependency.DependencyInfo;
|
||||||
import org.teavm.diagnostics.Diagnostics;
|
import org.teavm.diagnostics.Diagnostics;
|
||||||
import org.teavm.model.*;
|
import org.teavm.model.*;
|
||||||
import org.teavm.model.instructions.*;
|
import org.teavm.model.instructions.*;
|
||||||
|
import org.teavm.optimization.UnreachableBasicBlockEliminator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -61,6 +62,7 @@ public class MissingItemsProcessor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
new UnreachableBasicBlockEliminator().optimize(program);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void truncateBlock(BasicBlock block, int index) {
|
private void truncateBlock(BasicBlock block, int index) {
|
||||||
|
|
|
@ -53,6 +53,16 @@ public class UnreachableBasicBlockEliminator {
|
||||||
}
|
}
|
||||||
for (int i = 0; i < reachable.length; ++i) {
|
for (int i = 0; i < reachable.length; ++i) {
|
||||||
if (!reachable[i]) {
|
if (!reachable[i]) {
|
||||||
|
BasicBlock block = program.basicBlockAt(i);
|
||||||
|
if (block.getLastInstruction() != null) {
|
||||||
|
block.getLastInstruction().acceptVisitor(transitionExtractor);
|
||||||
|
for (BasicBlock successor : transitionExtractor.getTargets()) {
|
||||||
|
successor.removeIncomingsFrom(block);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (TryCatchBlock tryCatch : block.getTryCatchBlocks()) {
|
||||||
|
tryCatch.getHandler().removeIncomingsFrom(block);
|
||||||
|
}
|
||||||
program.deleteBasicBlock(i);
|
program.deleteBasicBlock(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,12 +22,13 @@ import org.teavm.javascript.ni.Rename;
|
||||||
import org.teavm.javascript.ni.Superclass;
|
import org.teavm.javascript.ni.Superclass;
|
||||||
import org.teavm.model.*;
|
import org.teavm.model.*;
|
||||||
import org.teavm.model.instructions.*;
|
import org.teavm.model.instructions.*;
|
||||||
|
import org.teavm.model.util.ModelUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Alexey Andreev
|
* @author Alexey Andreev
|
||||||
*/
|
*/
|
||||||
class ClassRefsRenamer implements InstructionVisitor {
|
public class ClassRefsRenamer implements InstructionVisitor {
|
||||||
private Mapper<String, String> classNameMapper;
|
private Mapper<String, String> classNameMapper;
|
||||||
|
|
||||||
public ClassRefsRenamer(Mapper<String, String> classNameMapper) {
|
public ClassRefsRenamer(Mapper<String, String> classNameMapper) {
|
||||||
|
@ -54,8 +55,7 @@ class ClassRefsRenamer implements InstructionVisitor {
|
||||||
renamedCls.addMethod(rename(method));
|
renamedCls.addMethod(rename(method));
|
||||||
}
|
}
|
||||||
for (FieldHolder field : cls.getFields().toArray(new FieldHolder[0])) {
|
for (FieldHolder field : cls.getFields().toArray(new FieldHolder[0])) {
|
||||||
cls.removeField(field);
|
renamedCls.addField(ModelUtils.copyField(field));
|
||||||
renamedCls.addField(field);
|
|
||||||
}
|
}
|
||||||
if (cls.getOwnerName() != null) {
|
if (cls.getOwnerName() != null) {
|
||||||
renamedCls.setOwnerName(classNameMapper.map(cls.getOwnerName()));
|
renamedCls.setOwnerName(classNameMapper.map(cls.getOwnerName()));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user